diff --git a/config.d/typedefs_structs_compiler.m4 b/config.d/typedefs_structs_compiler.m4 index 3ba73b7d6..8e6acac2e 100644 --- a/config.d/typedefs_structs_compiler.m4 +++ b/config.d/typedefs_structs_compiler.m4 @@ -74,9 +74,9 @@ AH_VERBATIM([HAVE___ATTRIBUTE__GCC_STRUCT], #endif]) AC_MSG_CHECKING(for __builtin_expect) -AC_TRY_COMPILE( - [long (*foo) (long, long) = __builtin_expect;], - [], +AC_TRY_LINK( + [int x;], + [if (__builtin_expect(!x, 1)) {}], AC_DEFINE(HAVE___BUILTIN_EXPECT) AC_MSG_RESULT(yes), AC_MSG_RESULT(no) diff --git a/include/QF/pr_comp.h b/include/QF/pr_comp.h index 4cc274f98..7bac7eb01 100644 --- a/include/QF/pr_comp.h +++ b/include/QF/pr_comp.h @@ -346,8 +346,8 @@ typedef union pr_type_u { string_t string_var; func_t func_var; pr_int_t entity_var; - float vector_var[1]; // really 3, but this structure must be 32 bits - float quat_var[1]; // really 4, but this structure must be 32 bits + float vector_var[0]; // really 3, but this structure must be 32 bits + float quat_var[0]; // really 4, but this structure must be 32 bits pr_int_t integer_var; pointer_t pointer_var; pr_uint_t uinteger_var; diff --git a/include/QF/progs.h b/include/QF/progs.h index 7c8bb3341..1c706ae4c 100644 --- a/include/QF/progs.h +++ b/include/QF/progs.h @@ -221,7 +221,7 @@ struct edict_s { int entnum; ///< number of this entity float freetime; ///< sv.time when the object was freed void *edata; ///< external per-edict data - pr_type_t v[1]; ///< fields from progs + pr_type_t v[]; ///< fields from progs }; // pr_edict.c diff --git a/libs/gamecode/pr_load.c b/libs/gamecode/pr_load.c index b9a6df13a..82864b096 100644 --- a/libs/gamecode/pr_load.c +++ b/libs/gamecode/pr_load.c @@ -177,7 +177,7 @@ PR_LoadProgsFile (progs_t *pr, QFile *file, int size, int max_edicts, int zone) // size of edict asked for by progs pr->pr_edict_size = max (1, progs.entityfields) * 4; // size of engine data - pr->pr_edict_size += sizeof (edict_t) - sizeof (pr_type_t); + pr->pr_edict_size += sizeof (edict_t); // round off to next highest whole word address (esp for Alpha) // this ensures that pointers in the engine data area are always // properly aligned diff --git a/libs/util/plugin.c b/libs/util/plugin.c index 31fa725fd..7baa8df72 100644 --- a/libs/util/plugin.c +++ b/libs/util/plugin.c @@ -98,11 +98,13 @@ loaded_plugin_delete (void *lp, void *unused) static int pi_close_lib (void *handle) { + if (handle) { #if defined(HAVE_DLOPEN) - return (dlclose (handle) == 0); + return (dlclose (handle) == 0); #elif defined (_WIN32) - return (FreeLibrary (handle) == 0); + return (FreeLibrary (handle) == 0); #endif + } return 1; } diff --git a/nq/source/sv_main.c b/nq/source/sv_main.c index 25def54ac..b666516f6 100644 --- a/nq/source/sv_main.c +++ b/nq/source/sv_main.c @@ -45,7 +45,7 @@ server_t sv; server_static_t svs; double sv_frametime; -char localmodels[MAX_MODELS][5]; // inline model names for precache +char localmodels[MAX_MODELS][6]; // inline model names for precache int sv_protocol = PROTOCOL_FITZQUAKE; diff --git a/qw/source/cl_slist.c b/qw/source/cl_slist.c index 569b711ce..585e6aa47 100644 --- a/qw/source/cl_slist.c +++ b/qw/source/cl_slist.c @@ -348,7 +348,7 @@ gettoklen (char *str, int req, char delim) int len = 0; start = gettokstart (str, req, delim); - if (start == '\0') { + if (*start == '\0') { return 0; } while (*start != delim && *start != '\0') { diff --git a/tools/qfcc/source/qp-lex.l b/tools/qfcc/source/qp-lex.l index e98b6511b..0bca559c9 100644 --- a/tools/qfcc/source/qp-lex.l +++ b/tools/qfcc/source/qp-lex.l @@ -296,7 +296,9 @@ convert_relop (const char *relop) #ifdef YY_FLEX_REALLOC_HACK static __attribute__ ((used)) void *(*const yy_flex_realloc_hack)(void *,yy_size_t) = yy_flex_realloc; #else +#ifdef yyunput static __attribute__ ((used)) void (*yyunput_hack)(int, char*) = yyunput; +#endif static __attribute__ ((used)) int (*input_hack)(void) = input; #endif