aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRafael Avila de Espindola <espindola@google.com>2008-07-16 09:14:27 +0000
committerRafael Espindola <espindola@gcc.gnu.org>2008-07-16 09:14:27 +0000
commit238fe3c54bfc0cabfca41322ad09f21bfdbced3c (patch)
tree128c129ddee6f1d8e9344eed3b207fa7e6c83982 /gcc
parent20d85a99604c39fd8ff01946ed418506957aa30b (diff)
downloadgcc-238fe3c54bfc0cabfca41322ad09f21bfdbced3c.zip
gcc-238fe3c54bfc0cabfca41322ad09f21bfdbced3c.tar.gz
gcc-238fe3c54bfc0cabfca41322ad09f21bfdbced3c.tar.bz2
c-decl.c (merge_decls): Keep DECL_SOURCE_LOCATION and DECL_IN_SYSTEM_HEADER in sync.
2007-07-16 Rafael Avila de Espindola <espindola@google.com> * c-decl.c (merge_decls): Keep DECL_SOURCE_LOCATION and DECL_IN_SYSTEM_HEADER in sync. From-SVN: r137873
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/c-decl.c33
2 files changed, 26 insertions, 12 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 4c7a776..a6788fb 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2007-07-16 Rafael Avila de Espindola <espindola@google.com>
+
+ * c-decl.c (merge_decls): Keep DECL_SOURCE_LOCATION and
+ DECL_IN_SYSTEM_HEADER in sync.
+
2008-07-15 Daniel Berlin <dberlin@dberlin.org>
* tree-ssa-sccvn.c (expressions_equal_p): Check type equality.
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 89430cb..4815797 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