diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2019-09-20 09:11:20 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2019-09-20 09:11:20 +0000 |
commit | 522da4c233cb626f66e413dabb86a0a78adaafce (patch) | |
tree | a0abe9960690bcc01823bad777578966aa454173 /gcc/c | |
parent | 6e222b2a3aede20f3093802d1649e75848e3bd2b (diff) | |
download | gcc-522da4c233cb626f66e413dabb86a0a78adaafce.zip gcc-522da4c233cb626f66e413dabb86a0a78adaafce.tar.gz gcc-522da4c233cb626f66e413dabb86a0a78adaafce.tar.bz2 |
re PR c/91815 (questionable error on type definition at file scope)
PR c/91815
* c-decl.c (pushdecl): In C detect duplicate declarations across scopes
of identifiers in the external scope only for variables and functions.
From-SVN: r275992
Diffstat (limited to 'gcc/c')
-rw-r--r-- | gcc/c/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/c/c-decl.c | 7 |
2 files changed, 11 insertions, 2 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 285ea18..9665549 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,9 @@ +2019-09-20 Eric Botcazou <ebotcazou@adacore.com> + + PR c/91815 + * c-decl.c (pushdecl): In C detect duplicate declarations across scopes + of identifiers in the external scope only for variables and functions. + 2019-09-04 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org> PR c/78736 diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index 31116b2..132fa3e 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -3130,8 +3130,11 @@ pushdecl (tree x) detecting duplicate declarations of the same object, no matter what scope they are in; this is what we do here. (C99 6.2.7p2: All declarations that refer to the same object or function shall - have compatible type; otherwise, the behavior is undefined.) */ - if (DECL_EXTERNAL (x) || scope == file_scope) + have compatible type; otherwise, the behavior is undefined.) + However, in Objective-C, we also want to detect declarations + conflicting with those of the basic types. */ + if ((DECL_EXTERNAL (x) || scope == file_scope) + && (VAR_OR_FUNCTION_DECL_P (x) || c_dialect_objc ())) { tree type = TREE_TYPE (x); tree vistype = NULL_TREE; |