Fix a pile of warnings for gcc 12

Most were pretty easy and fairly logical, but gib's regex was a bit of a
pain until I figured out the real problem was the conditional
assignments.

However, libs/gamecode/test/test-conv4 fails when optimizing due to gcc
using vcvttps2dq (which is nice, actually) for vector forms, but not the
single equivalent other times. I haven't decided what to do with the
test (I might abandon it as it does seem to be UD).
This commit is contained in:
Bill Currie 2022-07-26 21:14:28 +09:00
parent 330569a3fb
commit 2c8bec27c7
16 changed files with 54 additions and 45 deletions

View file

@ -80,7 +80,7 @@ void Sys_FatalError (const char *error, ...) __attribute__((format(PRINTF,1,2),
void Sys_Quit (void) __attribute__((noreturn));
void Sys_Shutdown (void);
void Sys_RegisterShutdown (void (*func) (void *), void *data);
int64_t Sys_StartTime (void) __attribute__ ((const));
int64_t Sys_StartTime (void) __attribute__ ((pure));
int64_t Sys_LongTime (void);
double Sys_DoubleTime (void);
int64_t Sys_TimeBase (void) __attribute__ ((const));

View file

@ -311,6 +311,7 @@ alsa_process (snd_pcm_t *pcm, snd_t *snd)
if ((res = alsa_recover (pcm, -EPIPE)) < 0) {
Sys_Printf ("snd_alsa: XRUN recovery failed: %s\n",
qfsnd_strerror (res));
snd->xfer_data = 0;
return res;
}
ret = 0;
@ -323,6 +324,7 @@ alsa_process (snd_pcm_t *pcm, snd_t *snd)
if ((res = alsa_recover (pcm, res >= 0 ? -EPIPE : res)) < 0) {
Sys_Printf ("snd_alsa: XRUN recovery failed: %s\n",
qfsnd_strerror (res));
snd->xfer_data = 0;
return res;
}
ret = 0;
@ -330,6 +332,7 @@ alsa_process (snd_pcm_t *pcm, snd_t *snd)
size -= packet.nframes;
}
snd->xfer_data = 0;
return ret;
}

View file

@ -72,8 +72,8 @@ def dst_str(width, src_type, dst_type):
return f"OPC({types[dst_type]})"
def zero_str(width, src_type):
ones = "{%s}" % (", ".join(["0"] * (width + 1)))
return f"{cast_str(width, src_type, src_type)} {ones}"
zeros = "{%s}" % (", ".join(["0"] * (width + 1)))
return f"{cast_str(width, src_type, src_type)} {zeros}"
def one_str(width, src_type):
ones = "{%s}" % (", ".join(["1"] * (width + 1)))
@ -110,7 +110,7 @@ for width in range(4):
elif width == 2:
print(f"{case} VectorCompUop(&{dst},{cast},&{src}); break;")
else:
expand = expand_str(width, src)
expand = expand_str(width, src, f"({types[dst_type]})")
print(f"{case} {dst} = {cast} {expand}; break;")
elif mode == 2:
one = one_str(width, src_type)

View file

@ -5,6 +5,8 @@
#include "QF/va.h"
#include "QF/simd/types.h"
#define num_tests (sizeof (tests) / sizeof (tests[0]))
static int test_enabled[num_tests] = { 0 };
@ -156,6 +158,14 @@ check_result (test_t *test)
printf ("test #%zd: %s: OK\n", test - tests, test->desc);
} else {
printf ("test #%zd: %s: words differ\n", test - tests, test->desc);
for (pr_uint_t i = 0; i < test->num_globals; i += 4) {
pr_ivec4_t *a = (pr_ivec4_t *) &test->expect_globals[i];
pr_ivec4_t *b = (pr_ivec4_t *) &test_pr.pr_globals[i];
if (memcmp (a, b, sizeof (pr_ivec4_t))) {
printf ("-%4x { %8x, %8x %8x %8x }\n", i, VEC4_EXP (*a));
printf ("+%4x { %8x, %8x %8x %8x }\n", i, VEC4_EXP (*b));
}
}
}
return ret;
}

View file

@ -963,7 +963,11 @@ static reg_errcode_t compile_range (const char **p_ptr, const char *pend, char *
being larger than MAX_BUF_SIZE, then flag memory exhausted. */
#define EXTEND_BUFFER() \
do { \
unsigned char *old_buffer = bufp->buffer; \
intptr_t b_offs = b - bufp->buffer; \
intptr_t begalt_offs = b - begalt; \
intptr_t fixup_alt_jump_offs = b - fixup_alt_jump; \
intptr_t laststart_offs = b - laststart; \
intptr_t pending_exact_offs = b - pending_exact; \
if (bufp->allocated == MAX_BUF_SIZE) \
return REG_ESIZE; \
bufp->allocated <<= 1; \
@ -971,19 +975,18 @@ static reg_errcode_t compile_range (const char **p_ptr, const char *pend, char *
bufp->allocated = MAX_BUF_SIZE; \
bufp->buffer = (unsigned char *) realloc (bufp->buffer, bufp->allocated);\
if (bufp->buffer == NULL) \
return REG_ESPACE; \
/* If the buffer moved, move all the pointers into it. */ \
if (old_buffer != bufp->buffer) \
{ \
b = (b - old_buffer) + bufp->buffer; \
begalt = (begalt - old_buffer) + bufp->buffer; \
if (fixup_alt_jump) \
fixup_alt_jump = (fixup_alt_jump - old_buffer) + bufp->buffer;\
if (laststart) \
laststart = (laststart - old_buffer) + bufp->buffer; \
if (pending_exact) \
pending_exact = (pending_exact - old_buffer) + bufp->buffer; \
laststart = fixup_alt_jump = 0; \
return REG_ESPACE; \
} \
b = b_offs + bufp->buffer; \
begalt = b - begalt_offs; \
if (fixup_alt_jump) \
fixup_alt_jump = b - fixup_alt_jump_offs; \
if (laststart) \
laststart = b - laststart_offs; \
if (pending_exact) \
pending_exact = b - pending_exact_offs; \
} while (0)

View file

@ -637,8 +637,10 @@ Mod_LoadFaces (model_t *mod, bsp_t *bsp)
out->samples = brush->lightdata + (i * mod_lightmap_bytes);
// set the drawing flags flag
if (!out->texinfo->texture || !out->texinfo->texture->name)
continue; // avoid crashing on null textures
if (!out->texinfo->texture) {
// avoid crashing on null textures (which do exist)
continue;
}
if (!strncmp (out->texinfo->texture->name, "sky", 3)) { // sky
out->flags |= (SURF_DRAWSKY | SURF_DRAWTILED);

View file

@ -35,8 +35,6 @@
static int sprite_height;
static int minindex, maxindex;
static sspan_t *sprite_spans;
#ifdef PIC
#undef USE_INTEL_ASM //XXX asm pic hack
@ -195,15 +193,13 @@ D_SpriteDrawSpans (sspan_t *pspan)
#endif
static void
D_SpriteScanLeftEdge (void)
D_SpriteScanLeftEdge (sspan_t *pspan)
{
int i, v, itop, ibottom, lmaxindex;
emitpoint_t *pvert, *pnext;
sspan_t *pspan;
float du, dv, vtop, vbottom, slope;
fixed16_t u, u_step;
pspan = sprite_spans;
i = minindex;
if (i == 0)
i = r_spritedesc.nump;
@ -249,15 +245,13 @@ D_SpriteScanLeftEdge (void)
}
static void
D_SpriteScanRightEdge (void)
D_SpriteScanRightEdge (sspan_t *pspan)
{
int i, v, itop, ibottom;
emitpoint_t *pvert, *pnext;
sspan_t *pspan;
float du, dv, vtop, vbottom, slope, uvert, unext, vvert, vnext;
fixed16_t u, u_step;
pspan = sprite_spans;
i = minindex;
vvert = r_spritedesc.pverts[i].v;
@ -371,8 +365,6 @@ D_DrawSprite (const vec3_t relvieworg)
emitpoint_t *pverts;
sspan_t spans[MAXHEIGHT + 1];
sprite_spans = spans;
// find the top and bottom vertices, and make sure there's at least one
// scan to draw
ymin = 999999.9;
@ -410,7 +402,7 @@ D_DrawSprite (const vec3_t relvieworg)
pverts[nump] = pverts[0];
D_SpriteCalculateGradients (relvieworg);
D_SpriteScanLeftEdge ();
D_SpriteScanRightEdge ();
D_SpriteDrawSpans (sprite_spans);
D_SpriteScanLeftEdge (spans);
D_SpriteScanRightEdge (spans);
D_SpriteDrawSpans (spans);
}

View file

@ -49,7 +49,7 @@ static polydesc_t r_polydesc;
clipplane_t view_clipplanes[4];
medge_t *r_pedge;
medge_t *r_pedge; // FIXME used by asm
qboolean r_leftclipped, r_rightclipped;
static qboolean makeleftedge, makerightedge;
@ -518,7 +518,6 @@ R_RenderBmodelFace (entity_t *ent, bedge_t *pedges, msurface_t *psurf)
plane_t *pplane;
float distinv;
vec3_t p_normal;
medge_t tedge;
clipplane_t *pclip;
// skip out if no more surfs
@ -535,6 +534,7 @@ R_RenderBmodelFace (entity_t *ent, bedge_t *pedges, msurface_t *psurf)
c_faceclip++;
// this is a dummy to give the caching mechanism someplace to write to
static medge_t tedge;
r_pedge = &tedge;
// set up clip planes

View file

@ -5,7 +5,7 @@
typedef struct strset_s strset_t;
int count_strings (const char * const *str) __attribute__((const));
int count_strings (const char * const *str) __attribute__((pure));
void merge_strings (const char **out, const char * const *in1,
const char * const *in2);
void prune_strings (strset_t *strset, const char **strings, uint32_t *count);

View file

@ -297,8 +297,7 @@ Model_NextDownload (void)
return; // started a download
}
if (cl.model_name[1])
CL_MapCfg (cl.model_name[1]);
CL_MapCfg (cl.model_name[1]);
for (i = 1; i < cl.nummodels; i++) {
const char *info_key = 0;

View file

@ -118,9 +118,9 @@ struct selector_s;
int is_id (const struct type_s *type) __attribute__((pure));
int is_class (const struct type_s *type) __attribute__((pure));
int is_Class (const struct type_s *type) __attribute__((const));
int is_Class (const struct type_s *type) __attribute__((pure));
int is_classptr (const struct type_s *type) __attribute__((pure));
int is_SEL (const struct type_s *type) __attribute__((const));
int is_SEL (const struct type_s *type) __attribute__((pure));
int is_object (const struct type_s *type) __attribute__((const));
int is_method (const struct type_s *type) __attribute__((const));
int is_method_description (const struct type_s *type) __attribute__((const));

View file

@ -153,7 +153,7 @@ param_t *check_params (param_t *params);
enum storage_class_e;
struct defspace_s;
int value_too_large (struct type_s *val_type) __attribute__((const));
int value_too_large (struct type_s *val_type) __attribute__((pure));
void make_function (struct symbol_s *sym, const char *nice_name,
struct defspace_s *space, enum storage_class_e storage);
struct symbol_s *function_symbol (struct symbol_s *sym,

View file

@ -135,8 +135,8 @@ struct expr_s;
struct type_s;
struct dstring_s;
extern const char *op_type_names[];
extern const char *st_type_names[];
extern const char * const op_type_names[];
extern const char * const st_type_names[];
const char *optype_str (op_type_e type) __attribute__((const));

View file

@ -960,7 +960,7 @@ typedef struct globals_info_s {
} globals_info_t;
static globals_info_t
static globals_info_t __attribute__((pure))
qfo_count_globals (qfo_t *qfo, dprograms_t *progs, int word_align)
{
globals_info_t info = {};

View file

@ -65,7 +65,7 @@
#include "tools/qfcc/source/qc-parse.h"
const char *op_type_names[] = {
const char * const op_type_names[] = {
"op_def",
"op_value",
"op_label",
@ -75,7 +75,7 @@ const char *op_type_names[] = {
"op_pseudo",
};
const char *st_type_names[] = {
const char * const st_type_names[] = {
"st_none",
"st_expr",
"st_assign",

View file

@ -51,7 +51,7 @@
static symtab_t *symtabs_freelist;
static symbol_t *symbols_freelist;
static const char *sy_type_names[] = {
static const char * const sy_type_names[] = {
"sy_name",
"sy_var",
"sy_const",