When erroring on a section type conflict print both locations.
This makes it a lot easier to track them down, especially in LTO.

This is still not quite good before it prints only one
conflict pair currently instead of all, but at least all
the problems can be fixed iteratively now.

Better would be likely to have a majority vote and print
everyone disagreeing.

Passes bootstrap & test suite on x86_64-linux. Ok to commit?

2011-06-06  Andi Kleen  <a...@linux.intel.com>

        * varasm.c (get_section): Print location of other conflict
        for section conflicts.
---
 gcc/varasm.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/gcc/varasm.c b/gcc/varasm.c
index f46c21b..5f4f796 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -313,7 +313,11 @@ get_section (const char *name, unsigned int flags, tree 
decl)
          if (decl == 0)
            decl = sect->named.decl;
          gcc_assert (decl);
-         error ("%+D causes a section type conflict", decl);
+         error ("%+D causes a section type conflict with %D", 
+                       decl, sect->named.decl);
+         if (decl != sect->named.decl)
+            inform (DECL_SOURCE_LOCATION (sect->named.decl), 
+                   "%qD was declared here", sect->named.decl);
          /* Make sure we don't error about one section multiple times.  */
          sect->common.flags |= SECTION_OVERRIDE;
        }
-- 
1.7.5.3

-- 
a...@linux.intel.com -- Speaking for myself only.

Reply via email to