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

This commit is contained in:
Wolfgang (Blub) Bumiller 2012-11-25 23:27:48 +01:00
parent b4a5517851
commit 0d3896ca54
3 changed files with 4 additions and 1 deletions

2
main.c
View file

@ -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);

View file

@ -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 */

View file

@ -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)
{