Fix some issues found by gcc's -flto

More const/pure stuff and even some type issues.
This commit is contained in:
Bill Currie 2023-11-16 17:09:20 +09:00
parent 748bd377c6
commit 114f564a98
6 changed files with 10 additions and 10 deletions

View file

@ -42,7 +42,7 @@ extern lumpinfo_t *wad_lumps;
extern byte *wad_base;
void W_LoadWadFile (const char *filename);
void *W_GetLumpName (const char *name);
void *W_GetLumpName (const char *name) __attribute__((const));
void SwapPic (qpic_t *pic);

View file

@ -107,7 +107,7 @@ void V_NewScene (viewstate_t *vs, struct scene_s *scene);
void V_Init (viewstate_t *vs);
void V_Init_Cvars (void);
void V_RenderView (viewstate_t *vs);
float V_CalcRoll (const vec3_t angles, vec4f_t velocity);
float V_CalcRoll (const vec3_t angles, vec4f_t velocity) __attribute__((pure));
void V_StartPitchDrift (viewstate_t *vs);
void V_StopPitchDrift (viewstate_t *vs);
void V_SetContentsColor (viewstate_t *vs, int contents);

View file

@ -242,7 +242,7 @@ edges_intersect (const vec3_t p1, const vec3_t p2,
return true;
}
static bool
static bool __attribute__((pure))
trace_hits_portal (const hull_t *hull, const trace_t *trace,
clipport_t *portal, const vec3_t start, const vec3_t vel)
{
@ -274,7 +274,7 @@ trace_hits_portal (const hull_t *hull, const trace_t *trace,
return true;
}
static bool
static bool __attribute__((pure))
trace_enters_leaf (hull_t *hull, trace_t *trace, clipleaf_t *leaf,
plane_t *plane, const vec3_t vel, const vec3_t org)
{

View file

@ -76,7 +76,7 @@ int gl_release_number;
static int gl_bgra_capable;
int gl_use_bgra;
int gl_va_capable;
bool gl_va_capable;
static int driver_vaelements;
int vaelements;
int gl_filter_min = GL_LINEAR_MIPMAP_LINEAR;

View file

@ -119,7 +119,7 @@ Draw_DestroyPic (qpic_t *pic)
free (pic);
}
qpic_t *
qpic_t * __attribute__((const))
Draw_PicFromWad (const char *name)
{
return W_GetLumpName (name);

View file

@ -44,10 +44,10 @@ __attribute__((const)) int algebra_type_width (const struct type_s *type);
int algebra_type_width (const struct type_s *type){return 0;}
__attribute__((const)) int algebra_type_assignable (const type_t *dst, const type_t *src);
int algebra_type_assignable (const type_t *dst, const type_t *src){return 0;}
__attribute__((const)) int is_algebra (const type_t *type);
int is_algebra (const type_t *type){return 0;}
__attribute__((const)) int algebra_base_type (const type_t *type);
int algebra_base_type (const type_t *type){return 0;}
__attribute__((const)) bool is_algebra (const type_t *type);
bool is_algebra (const type_t *type){return 0;}
__attribute__((const)) type_t *algebra_base_type (const type_t *type);
type_t *algebra_base_type (const type_t *type){return 0;}
__attribute__((const)) pr_string_t ReuseString (const char *str) {return 0;}
__attribute__((const)) codespace_t *codespace_new (void) {return 0;}