mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2025-01-31 03:50:36 +00:00
-Wimplicit-function-pointer, functions without bodies still have a global function variable and thus are function pointers, though this shouldn't really be used, thus -Wimplicit-function-pointer is on by default
This commit is contained in:
parent
5390782d9b
commit
5f2fc64498
3 changed files with 4 additions and 0 deletions
2
ir.c
2
ir.c
|
@ -2599,6 +2599,8 @@ static bool gen_global_function_code(ir_builder *ir, ir_value *global)
|
|||
|
||||
irfun = global->constval.vfunc;
|
||||
if (!irfun) {
|
||||
irwarning(global->context, WARN_IMPLICIT_FUNCTION_POINTER,
|
||||
"function `%s` has no body and in QC implicitly becomes a function-pointer", global->name);
|
||||
/* this was a function pointer, don't generate code for those */
|
||||
return true;
|
||||
}
|
||||
|
|
1
main.c
1
main.c
|
@ -385,6 +385,7 @@ int main(int argc, char **argv) {
|
|||
options_set(opts_warn, WARN_USED_UNINITIALIZED, true);
|
||||
options_set(opts_warn, WARN_LOCAL_CONSTANTS, true);
|
||||
options_set(opts_warn, WARN_VOID_VARIABLES, true);
|
||||
options_set(opts_warn, WARN_IMPLICIT_FUNCTION_POINTER, true);
|
||||
|
||||
if (!options_parse(argc, argv)) {
|
||||
return usage();
|
||||
|
|
|
@ -13,3 +13,4 @@ GMQCC_DEFINE_FLAG(TOO_FEW_PARAMETERS)
|
|||
GMQCC_DEFINE_FLAG(LOCAL_SHADOWS)
|
||||
GMQCC_DEFINE_FLAG(LOCAL_CONSTANTS)
|
||||
GMQCC_DEFINE_FLAG(VOID_VARIABLES)
|
||||
GMQCC_DEFINE_FLAG(IMPLICIT_FUNCTION_POINTER)
|
||||
|
|
Loading…
Reference in a new issue