]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
-Wimplicit-function-pointer, functions without bodies still have a global function...
authorWolfgang (Blub) Bumiller <blub@speed.at>
Wed, 22 Aug 2012 10:37:06 +0000 (12:37 +0200)
committerWolfgang (Blub) Bumiller <blub@speed.at>
Wed, 22 Aug 2012 10:37:06 +0000 (12:37 +0200)
ir.c
main.c
warns.def

diff --git a/ir.c b/ir.c
index 074ed7f275b1b35b4617ddc29894e621989e5b9b..df2e32f06d47cb6e9f8aa635f4c9557f29a1e45f 100644 (file)
--- a/ir.c
+++ b/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;
     }
diff --git a/main.c b/main.c
index 64d6f0345905fa1cb9e998884e598c61218838dd..13fa575ff715f6e6b7a90d0ef4355769953b1ce3 100644 (file)
--- a/main.c
+++ b/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();
index b8609a6d78ef82bbafed76b935e9173f7e90ee07..16a5f9996c45f423c5b74e2e06f8553b35a22b86 100644 (file)
--- a/warns.def
+++ b/warns.def
@@ -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)