mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-19 07:20:50 +00:00
Fix a bunch of issues for clang
One *actual* error (wrong enum type), and some memory alignment issues. The rest just clang being lame.
This commit is contained in:
parent
2c8bec27c7
commit
732ea3a5fd
8 changed files with 22 additions and 26 deletions
|
@ -29,6 +29,12 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __clang__
|
||||
#define DESIGNATED_INIT
|
||||
#else
|
||||
#define DESIGNATED_INIT __attribute__((designated_init))
|
||||
#endif
|
||||
|
||||
struct exprval_s;
|
||||
struct exprctx_s;
|
||||
struct va_ctx_s;
|
||||
|
@ -57,7 +63,7 @@ typedef struct exprtype_s {
|
|||
binop_t *binops;
|
||||
unop_t *unops;
|
||||
void *data;
|
||||
} __attribute__((designated_init)) exprtype_t;
|
||||
} DESIGNATED_INIT exprtype_t;
|
||||
|
||||
typedef struct exprval_s {
|
||||
exprtype_t *type;
|
||||
|
|
|
@ -149,7 +149,7 @@ static void
|
|||
snd_free_channel (channel_t *ch)
|
||||
{
|
||||
sfxbuffer_t *buffer = ch->buffer;
|
||||
ch->buffer = 0;
|
||||
ch->buffer = (sfxbuffer_t *) 0;
|
||||
ch->stop = 0;
|
||||
ch->done = 0;
|
||||
int chan_ind = ch - snd_channels;
|
||||
|
|
|
@ -198,7 +198,12 @@ parse_light (light_t *light, int *style, const plitem_t *entity,
|
|||
|
||||
if ((str = PL_String (PL_ObjectForKey (entity, "color")))
|
||||
|| (str = PL_String (PL_ObjectForKey (entity, "_color")))) {
|
||||
sscanf (str, "%f %f %f", VectorExpandAddr (light->color));
|
||||
union {
|
||||
float a[4];
|
||||
vec4f_t v;
|
||||
} color = {};
|
||||
sscanf (str, "%f %f %f", VectorExpandAddr (color.a));
|
||||
light->color = color.v;
|
||||
VectorScale (light->color, 1/255.0, light->color);
|
||||
}
|
||||
|
||||
|
|
|
@ -231,6 +231,7 @@ ED_ParseEpair (progs_t *pr, pr_type_t *base, pr_def_t *key, const char *s)
|
|||
break;
|
||||
|
||||
case ev_vector:
|
||||
(void)0;//FIXME for clang
|
||||
vec3_t vec = {};
|
||||
char *str = alloca (strlen (s) + 1);
|
||||
strcpy (str, s);
|
||||
|
|
|
@ -418,26 +418,6 @@ R_BuildLightMap_4 (const transform_t *transform, mod_brush_t *brush,
|
|||
|
||||
// BRUSH MODELS ===============================================================
|
||||
|
||||
static inline void
|
||||
do_subimage_2 (int i)
|
||||
{
|
||||
byte *block, *lm, *b;
|
||||
int stride, width;
|
||||
glRect_t *rect = &gl_lightmap_rectchange[i];
|
||||
|
||||
width = rect->w * lightmap_bytes;
|
||||
stride = BLOCK_WIDTH * lightmap_bytes;
|
||||
b = block = Hunk_TempAlloc (0, rect->h * width);
|
||||
lm = lightmaps[i] + (rect->t * BLOCK_WIDTH + rect->l) * lightmap_bytes;
|
||||
for (i = rect->h; i > 0; i--) {
|
||||
memcpy (b, lm, width);
|
||||
b += width;
|
||||
lm += stride;
|
||||
}
|
||||
qfglTexSubImage2D (GL_TEXTURE_2D, 0, rect->l, rect->t, rect->w, rect->h,
|
||||
gl_lightmap_format, GL_UNSIGNED_BYTE, block);
|
||||
}
|
||||
|
||||
void
|
||||
gl_R_BlendLightmaps (void)
|
||||
{
|
||||
|
|
|
@ -438,6 +438,7 @@ create_light_matrices (lightingctx_t *lctx)
|
|||
break;
|
||||
case ST_CASCADE:
|
||||
case ST_PLANE:
|
||||
(void)0;//FIXME for clang
|
||||
//FIXME will fail for -ref_direction
|
||||
vec4f_t dir = light->direction;
|
||||
dir[3] = 0;
|
||||
|
|
|
@ -176,8 +176,8 @@ Vulkan_LoadTexArray (vulkan_ctx_t *ctx, tex_t *tex, int layers, int mip,
|
|||
|
||||
VkExtent3D extent = { tex[0].width, tex[0].height, 1 };
|
||||
VkImageType itype = layers > 0 ? VK_IMAGE_TYPE_2D : VK_IMAGE_TYPE_2D;
|
||||
VkImageType vtype = layers > 0 ? VK_IMAGE_VIEW_TYPE_2D_ARRAY
|
||||
: VK_IMAGE_VIEW_TYPE_2D;
|
||||
VkImageViewType vtype = layers > 0 ? VK_IMAGE_VIEW_TYPE_2D_ARRAY
|
||||
: VK_IMAGE_VIEW_TYPE_2D;
|
||||
if (layers < 1) {
|
||||
layers = 1;
|
||||
}
|
||||
|
|
|
@ -94,7 +94,9 @@ static ex_value_t *
|
|||
new_value (void)
|
||||
{
|
||||
ex_value_t *value;
|
||||
#define malloc(x) aligned_alloc (__alignof__(ex_value_t), x)
|
||||
ALLOC (256, ex_value_t, values, value);
|
||||
#undef malloc
|
||||
return value;
|
||||
}
|
||||
|
||||
|
@ -636,7 +638,8 @@ make_def_imm (def_t *def, hashtab_t *tab, ex_value_t *val)
|
|||
{
|
||||
immediate_t *imm;
|
||||
|
||||
imm = calloc (1, sizeof (immediate_t));
|
||||
imm = aligned_alloc (__alignof__(immediate_t), sizeof (immediate_t));
|
||||
memset (imm, 0, sizeof (immediate_t));
|
||||
imm->def = def;
|
||||
memcpy (&imm->i, &val->v, sizeof (imm->i));
|
||||
|
||||
|
|
Loading…
Reference in a new issue