From: Wolfgang (Blub) Bumiller Date: Fri, 30 Nov 2012 13:05:25 +0000 (+0100) Subject: Set the full const/var qualifier; only generate warnings about unimplemented function... X-Git-Tag: 0.1.9~187 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=600ecda8602a6fa173c7e0afaebee81f2ab82864;p=xonotic%2Fgmqcc.git Set the full const/var qualifier; only generate warnings about unimplemented functions if they have no qualifier at all --- diff --git a/ast.c b/ast.c index c63052c..5a10154 100644 --- 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 b1835c8..b2bdeb0 100644 --- 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; } diff --git a/parser.c b/parser.c index afe1f11..dab8b24 100644 --- 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; }