diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-07-17 10:37:37 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-07-17 10:37:37 +0000 |
commit | fad150a1dd9a382bfe3bce39c1dab51191042d47 (patch) | |
tree | 8b477801e1b185a3dcb0662585b186128991f6fe /gcc/c-decl.c | |
parent | 568aa6455bee169296c908fe07e629f3db0748b8 (diff) | |
download | gcc-fad150a1dd9a382bfe3bce39c1dab51191042d47.tar.gz |
2008-07-17 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk r137918
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@137920 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r-- | gcc/c-decl.c | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 89430cbf3e1..4815797e564 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -1679,12 +1679,27 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype) if (TREE_DEPRECATED (newdecl)) TREE_DEPRECATED (olddecl) = 1; - /* Keep source location of definition rather than declaration and of - prototype rather than non-prototype unless that prototype is - built-in. */ - if ((DECL_INITIAL (newdecl) == 0 && DECL_INITIAL (olddecl) != 0) - || (old_is_prototype && !new_is_prototype - && !C_DECL_BUILTIN_PROTOTYPE (olddecl))) + /* If a decl is in a system header and the other isn't, keep the one on the + system header. Otherwise, keep source location of definition rather than + declaration and of prototype rather than non-prototype unless that + prototype is built-in. */ + if (CODE_CONTAINS_STRUCT (TREE_CODE (olddecl), TS_DECL_WITH_VIS) + && DECL_IN_SYSTEM_HEADER (olddecl) + && !DECL_IN_SYSTEM_HEADER (newdecl) ) + { + DECL_IN_SYSTEM_HEADER (newdecl) = 1; + DECL_SOURCE_LOCATION (newdecl) = DECL_SOURCE_LOCATION (olddecl); + } + else if (CODE_CONTAINS_STRUCT (TREE_CODE (olddecl), TS_DECL_WITH_VIS) + && DECL_IN_SYSTEM_HEADER (newdecl) + && !DECL_IN_SYSTEM_HEADER (olddecl)) + { + DECL_IN_SYSTEM_HEADER (olddecl) = 1; + DECL_SOURCE_LOCATION (olddecl) = DECL_SOURCE_LOCATION (newdecl); + } + else if ((DECL_INITIAL (newdecl) == 0 && DECL_INITIAL (olddecl) != 0) + || (old_is_prototype && !new_is_prototype + && !C_DECL_BUILTIN_PROTOTYPE (olddecl))) DECL_SOURCE_LOCATION (newdecl) = DECL_SOURCE_LOCATION (olddecl); /* Merge the initialization information. */ @@ -1700,12 +1715,6 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype) if (CODE_CONTAINS_STRUCT (TREE_CODE (olddecl), TS_DECL_WITH_VIS)) { - /* Merge the unused-warning information. */ - if (DECL_IN_SYSTEM_HEADER (olddecl)) - DECL_IN_SYSTEM_HEADER (newdecl) = 1; - else if (DECL_IN_SYSTEM_HEADER (newdecl)) - DECL_IN_SYSTEM_HEADER (olddecl) = 1; - /* Merge the section attribute. We want to issue an error if the sections conflict but that must be done later in decl_attributes since we are called |