aboutsummaryrefslogtreecommitdiff
path: root/gcc/c/c-objc-common.h
diff options
context:
space:
mode:
authorMartin Uecker <uecker@tugraz.at>2023-02-15 10:54:00 +0100
committerMartin Uecker <uecker@tugraz.at>2023-02-18 10:39:01 +0100
commit47821ba07a19b672d3cba351a03af2b122e02213 (patch)
tree51bd978038361d057159355eacc58f4561f4e852 /gcc/c/c-objc-common.h
parent3057d7928c0dbc78dbf748c9621ccd102e06beee (diff)
downloadgcc-47821ba07a19b672d3cba351a03af2b122e02213.zip
gcc-47821ba07a19b672d3cba351a03af2b122e02213.tar.gz
gcc-47821ba07a19b672d3cba351a03af2b122e02213.tar.bz2
C: Detect all variably modified types [PR108375]
Some variably modified types were not detected correctly. Define C_TYPE_VARIABLY_MODIFIED via TYPE_LANG_FLAG 6 in the CFE. This flag records whether a type is variably modified and is set for all such types including arrays with variably modified element type or structures and unions with variably modified members. This is then used to detect such types in the C FE and middle-end (via the existing language hook). gcc/c/ChangeLog: PR c/108375 * c-decl.cc (decl_jump_unsafe): Use c_type_variably_modified_p. (diagnose_mismatched_decl): Dito. (warn_about_goto): Dito: (c_check_switch_jump_warnings): Dito. (finish_decl): Dito. (finish_struct): Dito. (grokdeclarator): Set C_TYPE_VARIABLY_MODIFIED. (finish_struct): Set C_TYPE_VARIABLY_MODIFIED. * c-objc-common.cc (c_var_mod_p): New function. (c_var_unspec_p): Remove. * c-objc-common.h: Set lang hook. * c-parser.cc (c_parser_declararion_or_fndef): Use c_type_variably_modified_p. (c_parser_typeof_specifier): Dito. (c_parser_has_attribute_expression): Dito. (c_parser_generic_selection): Dito. * c-tree.h: Define C_TYPE_VARIABLY_MODIFIED and define c_var_mode_p. * c-typeck.cc: Remove c_vla_mod_p and use C_TYPE_VARIABLY_MODIFIED. gcc/testsuite/ChangeLog: PR c/108375 * gcc.dg/pr108375-1.c: New test. * gcc.dg/pr108375-2.c: New test.
Diffstat (limited to 'gcc/c/c-objc-common.h')
-rw-r--r--gcc/c/c-objc-common.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/c/c-objc-common.h b/gcc/c/c-objc-common.h
index 3861093..d31dacb 100644
--- a/gcc/c/c-objc-common.h
+++ b/gcc/c/c-objc-common.h
@@ -123,5 +123,5 @@ along with GCC; see the file COPYING3. If not see
#define LANG_HOOKS_OMP_CLAUSE_ASSIGN_OP c_omp_clause_copy_ctor
#undef LANG_HOOKS_TREE_INLINING_VAR_MOD_TYPE_P
-#define LANG_HOOKS_TREE_INLINING_VAR_MOD_TYPE_P c_vla_unspec_p
+#define LANG_HOOKS_TREE_INLINING_VAR_MOD_TYPE_P c_var_mod_p
#endif /* GCC_C_OBJC_COMMON */