From: Wolfgang (Blub) Bumiller Date: Sun, 25 Nov 2012 22:27:48 +0000 (+0100) Subject: introducing -fassign-function-types, previously guarded by std==qcc this is now the... X-Git-Tag: 0.1.9~218 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=0d3896ca54d6eb4878277e2fa7dac32b94a896cc;p=xonotic%2Fgmqcc.git introducing -fassign-function-types, previously guarded by std==qcc this is now the flag to cause a warning (-Wassign-function-types) instead of an error when assigning functions of wrong types --- diff --git a/main.c b/main.c index 6ee7d8e..9961ac1 100644 --- a/main.c +++ b/main.c @@ -202,11 +202,13 @@ static bool options_parse(int argc, char **argv) { opts_standard = COMPILER_GMQCC; } else if (!strcmp(argarg, "qcc")) { options_set(opts_flags, ADJUST_VECTOR_FIELDS, false); + options_set(opts_flags, ASSIGN_FUNCTION_TYPES, true); opts_standard = COMPILER_QCC; } else if (!strcmp(argarg, "fte") || !strcmp(argarg, "fteqcc")) { options_set(opts_flags, FTEPP, true); options_set(opts_flags, TRANSLATABLE_STRINGS, true); options_set(opts_flags, ADJUST_VECTOR_FIELDS, false); + options_set(opts_flags, ASSIGN_FUNCTION_TYPES, true); opts_standard = COMPILER_FTEQCC; } else if (!strcmp(argarg, "qccx")) { options_set(opts_flags, ADJUST_VECTOR_FIELDS, false); diff --git a/opts.def b/opts.def index 7f4c15e..9779889 100644 --- a/opts.def +++ b/opts.def @@ -37,6 +37,7 @@ GMQCC_DEFINE_FLAG(PERL_LOGIC) GMQCC_DEFINE_FLAG(TRANSLATABLE_STRINGS) GMQCC_DEFINE_FLAG(INITIALIZED_NONCONSTANTS) + GMQCC_DEFINE_FLAG(ASSIGN_FUNCTION_TYPES) #endif /* warning flags */ diff --git a/parser.c b/parser.c index fb4f867..2af798b 100644 --- a/parser.c +++ b/parser.c @@ -905,7 +905,7 @@ static bool parser_sy_pop(parser_t *parser, shunt *sy) if (!ast_compare_type(field->expression.next, exprs[1])) { ast_type_to_string(field->expression.next, ty1, sizeof(ty1)); ast_type_to_string(exprs[1], ty2, sizeof(ty2)); - if (opts_standard == COMPILER_QCC && + if (OPTS_FLAG(ASSIGN_FUNCTION_TYPES) && field->expression.next->expression.vtype == TYPE_FUNCTION && exprs[1]->expression.vtype == TYPE_FUNCTION) {