diff options
author | Richard Kenner <kenner@gcc.gnu.org> | 1995-02-21 17:56:58 -0500 |
---|---|---|
committer | Richard Kenner <kenner@gcc.gnu.org> | 1995-02-21 17:56:58 -0500 |
commit | 4b4e3407104f39db5e654c96925d60e7b03dab7c (patch) | |
tree | 9226148f65a38be7322e61d5ebaef858a395815c | |
parent | 1228e2a6b2d93ce5cc00c933b44fcf534f844bb3 (diff) | |
download | gcc-4b4e3407104f39db5e654c96925d60e7b03dab7c.zip gcc-4b4e3407104f39db5e654c96925d60e7b03dab7c.tar.gz gcc-4b4e3407104f39db5e654c96925d60e7b03dab7c.tar.bz2 |
(grokdeclarator): Added code to support machine attributes.
(duplicate_decls): Pass DECL_MACHINE_ATTRIBUTES to descendent typedef;
make duplicate typedefs that are identical generate a warning if they
are both in system header files.
(redeclaration_error_message): Make duplicate typedefs that are
identical not an error if they are both in system header files.
From-SVN: r8994
-rw-r--r-- | gcc/c-decl.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 9d6a453..e4316ce 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -1316,6 +1316,9 @@ duplicate_decls (newdecl, olddecl) tree newtype = TREE_TYPE (newdecl); char *errmsg = 0; + if (TREE_CODE_CLASS (TREE_CODE (olddecl)) == 'd') + DECL_MACHINE_ATTRIBUTES (newdecl) = DECL_MACHINE_ATTRIBUTES (olddecl); + if (TREE_CODE (newtype) == ERROR_MARK || TREE_CODE (oldtype) == ERROR_MARK) types_match = 0; @@ -1564,6 +1567,18 @@ duplicate_decls (newdecl, olddecl) ? "`%s' previously defined here" : "`%s' previously declared here")); } + else if (TREE_CODE (newdecl) == TYPE_DECL + && (DECL_IN_SYSTEM_HEADER (olddecl) + || DECL_IN_SYSTEM_HEADER (newdecl))) + { + warning_with_decl (newdecl, "redefinition of `%s'"); + warning_with_decl + (olddecl, + ((DECL_INITIAL (olddecl) + && current_binding_level == global_binding_level) + ? "`%s' previously defined here" + : "`%s' previously declared here")); + } else if (TREE_CODE (olddecl) == FUNCTION_DECL && DECL_INITIAL (olddecl) != 0 && TYPE_ARG_TYPES (oldtype) == 0 @@ -2364,6 +2379,8 @@ redeclaration_error_message (newdecl, olddecl) { if (flag_traditional && TREE_TYPE (newdecl) == TREE_TYPE (olddecl)) return 0; + if (DECL_IN_SYSTEM_HEADER (olddecl) || DECL_IN_SYSTEM_HEADER (newdecl)) + return 0; return "redefinition of `%s'"; } else if (TREE_CODE (newdecl) == FUNCTION_DECL) @@ -4010,6 +4027,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized) enum tree_code innermost_code = ERROR_MARK; int bitfield = 0; int size_varies = 0; + tree decl_machine_attr = NULL_TREE; if (decl_context == BITFIELD) bitfield = 1, decl_context = FIELD; @@ -4119,6 +4137,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized) else if (TREE_CODE (id) == TYPE_DECL) { type = TREE_TYPE (id); + decl_machine_attr = DECL_MACHINE_ATTRIBUTES (id); typedef_decl = id; } /* Built-in types come as identifiers. */ @@ -4853,6 +4872,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized) end_temporary_allocation (); decl = build_decl (FUNCTION_DECL, declarator, type); + decl = build_decl_attribute_variant (decl, decl_machine_attr); if (pedantic && (constp || volatilep) && ! DECL_IN_SYSTEM_HEADER (decl)) |