Set the full const/var qualifier; only generate warnings about unimplemented functions if they have no qualifier at all

This commit is contained in:
Wolfgang (Blub) Bumiller 2012-11-30 14:05:25 +01:00
parent 5e23e8296d
commit 600ecda860
3 changed files with 10 additions and 7 deletions

2
ast.c
View file

@ -1270,6 +1270,7 @@ bool ast_global_codegen(ast_value *self, ir_builder *ir, bool isfield)
} }
/* link us to the ir_value */ /* link us to the ir_value */
v->cvq = self->cvq;
self->ir_v = v; self->ir_v = v;
return true; return true;
@ -1374,6 +1375,7 @@ bool ast_local_codegen(ast_value *self, ir_function *func, bool param)
} }
/* link us to the ir_value */ /* link us to the ir_value */
v->cvq = self->cvq;
self->ir_v = v; self->ir_v = v;
if (self->setter) { if (self->setter) {

6
ir.c
View file

@ -2952,8 +2952,10 @@ static bool gen_global_function_code(ir_builder *ir, ir_value *global)
irfun = global->constval.vfunc; irfun = global->constval.vfunc;
if (!irfun) { if (!irfun) {
irwarning(global->context, WARN_IMPLICIT_FUNCTION_POINTER, if (global->cvq == CV_NONE) {
"function `%s` has no body and in QC implicitly becomes a function-pointer", global->name); 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 */ /* this was a function pointer, don't generate code for those */
return true; return true;
} }

View file

@ -92,7 +92,7 @@ static void parser_enterblock(parser_t *parser);
static bool parser_leaveblock(parser_t *parser); static bool parser_leaveblock(parser_t *parser);
static void parser_addlocal(parser_t *parser, const char *name, ast_expression *e); static void parser_addlocal(parser_t *parser, const char *name, ast_expression *e);
static bool parse_typedef(parser_t *parser); 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 ast_block* parse_block(parser_t *parser);
static bool parse_block_into(parser_t *parser, ast_block *block); static bool parse_block_into(parser_t *parser, ast_block *block);
static ast_expression* parse_statement_or_block(parser_t *parser); static ast_expression* parse_statement_or_block(parser_t *parser);
@ -3562,7 +3562,7 @@ static bool parse_typedef(parser_t *parser)
return true; 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 *var;
ast_value *proto; 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 = qualifier;
var->cvq = CV_CONST;
/* Part 1: /* Part 1:
* check for validity: (end_sys_..., multiple-definitions, prototypes, ...) * check for validity: (end_sys_..., multiple-definitions, prototypes, ...)
@ -3999,7 +3998,7 @@ skipvar:
{ {
if (opts_standard != COMPILER_GMQCC && if (opts_standard != COMPILER_GMQCC &&
!OPTS_FLAG(INITIALIZED_NONCONSTANTS) && !OPTS_FLAG(INITIALIZED_NONCONSTANTS) &&
is_const_var != CV_VAR) qualifier != CV_VAR)
{ {
var->cvq = CV_CONST; var->cvq = CV_CONST;
} }