diff --git a/include/QF/cexpr.h b/include/QF/cexpr.h index 5935e37bb..4299b7ead 100644 --- a/include/QF/cexpr.h +++ b/include/QF/cexpr.h @@ -29,6 +29,12 @@ #include +#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; diff --git a/libs/audio/renderer/snd_channels.c b/libs/audio/renderer/snd_channels.c index 6fdd3bca2..f7043de83 100644 --- a/libs/audio/renderer/snd_channels.c +++ b/libs/audio/renderer/snd_channels.c @@ -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; diff --git a/libs/client/cl_light.c b/libs/client/cl_light.c index 5e2bf39ca..fd8831783 100644 --- a/libs/client/cl_light.c +++ b/libs/client/cl_light.c @@ -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); } diff --git a/libs/gamecode/pr_parse.c b/libs/gamecode/pr_parse.c index 1f8f3cebd..6f7a032ed 100644 --- a/libs/gamecode/pr_parse.c +++ b/libs/gamecode/pr_parse.c @@ -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); diff --git a/libs/video/renderer/gl/gl_lightmap.c b/libs/video/renderer/gl/gl_lightmap.c index a5e112b35..a6de23b33 100644 --- a/libs/video/renderer/gl/gl_lightmap.c +++ b/libs/video/renderer/gl/gl_lightmap.c @@ -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) { diff --git a/libs/video/renderer/vulkan/vulkan_lighting.c b/libs/video/renderer/vulkan/vulkan_lighting.c index 966679238..b92ae2a67 100644 --- a/libs/video/renderer/vulkan/vulkan_lighting.c +++ b/libs/video/renderer/vulkan/vulkan_lighting.c @@ -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; diff --git a/libs/video/renderer/vulkan/vulkan_texture.c b/libs/video/renderer/vulkan/vulkan_texture.c index 26e005f08..699b3af3d 100644 --- a/libs/video/renderer/vulkan/vulkan_texture.c +++ b/libs/video/renderer/vulkan/vulkan_texture.c @@ -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; } diff --git a/tools/qfcc/source/value.c b/tools/qfcc/source/value.c index bd8ac599e..59de51d21 100644 --- a/tools/qfcc/source/value.c +++ b/tools/qfcc/source/value.c @@ -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));