]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
Set the full const/var qualifier; only generate warnings about unimplemented function...
authorWolfgang (Blub) Bumiller <blub@speed.at>
Fri, 30 Nov 2012 13:05:25 +0000 (14:05 +0100)
committerWolfgang (Blub) Bumiller <blub@speed.at>
Fri, 30 Nov 2012 13:05:25 +0000 (14:05 +0100)
ast.c
ir.c
parser.c

diff --git a/ast.c b/ast.c
index c63052cdd39cece423db71911b024bc54080dff6..5a10154c44e1b237be43afc9cd9f36abe66bbebc 100644 (file)
--- a/ast.c
+++ b/ast.c
@@ -1270,6 +1270,7 @@ bool ast_global_codegen(ast_value *self, ir_builder *ir, bool isfield)
     }
 
     /* link us to the ir_value */
+    v->cvq = self->cvq;
     self->ir_v = v;
     return true;
 
@@ -1374,6 +1375,7 @@ bool ast_local_codegen(ast_value *self, ir_function *func, bool param)
     }
 
     /* link us to the ir_value */
+    v->cvq = self->cvq;
     self->ir_v = v;
 
     if (self->setter) {
diff --git a/ir.c b/ir.c
index b1835c875b586e3eae3bcc49cb0b80d1519e19b5..b2bdeb0bcc3b44c0d54e32567dde30316488c382 100644 (file)
--- a/ir.c
+++ b/ir.c
@@ -2952,8 +2952,10 @@ 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);
+        if (global->cvq == CV_NONE) {
+            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;
     }
index afe1f11220bab851f02cc15cc1409e546dfbe735..dab8b2483a2ae803940c401b92edef9522265188 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -92,7 +92,7 @@ static void parser_enterblock(parser_t *parser);
 static bool parser_leaveblock(parser_t *parser);
 static void parser_addlocal(parser_t *parser, const char *name, ast_expression *e);
 static bool parse_typedef(parser_t *parser);
-static bool parse_variable(parser_t *parser, ast_block *localblock, bool nofields, int is_const_var, ast_value *cached_typedef);
+static bool parse_variable(parser_t *parser, ast_block *localblock, bool nofields, int qualifier, ast_value *cached_typedef);
 static ast_block* parse_block(parser_t *parser);
 static bool parse_block_into(parser_t *parser, ast_block *block);
 static ast_expression* parse_statement_or_block(parser_t *parser);
@@ -3562,7 +3562,7 @@ static bool parse_typedef(parser_t *parser)
     return true;
 }
 
-static bool parse_variable(parser_t *parser, ast_block *localblock, bool nofields, int is_const_var, ast_value *cached_typedef)
+static bool parse_variable(parser_t *parser, ast_block *localblock, bool nofields, int qualifier, ast_value *cached_typedef)
 {
     ast_value *var;
     ast_value *proto;
@@ -3625,8 +3625,7 @@ static bool parse_variable(parser_t *parser, ast_block *localblock, bool nofield
             }
         }
 
-        if (is_const_var == CV_CONST)
-            var->cvq = CV_CONST;
+        var->cvq = qualifier;
 
         /* Part 1:
          * check for validity: (end_sys_..., multiple-definitions, prototypes, ...)
@@ -3999,7 +3998,7 @@ skipvar:
                 {
                     if (opts_standard != COMPILER_GMQCC &&
                         !OPTS_FLAG(INITIALIZED_NONCONSTANTS) &&
-                        is_const_var != CV_VAR)
+                        qualifier != CV_VAR)
                     {
                         var->cvq = CV_CONST;
                     }