Patchwork better warning for section conflict

login
register
mail settings
Submitter Andi Kleen
Date June 8, 2011, 10:07 a.m.
Message ID <20110608100754.GK27166@one.firstfloor.org>
Download mbox | patch
Permalink /patch/99393/
State New
Headers show

Comments

Andi Kleen - June 8, 2011, 10:07 a.m.
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  <ak@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(-)
Richard Guenther - June 8, 2011, 10:22 a.m.
On Wed, Jun 8, 2011 at 12:07 PM, Andi Kleen <andi@firstfloor.org> wrote:
> 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?

Ok.

Thanks,
Richard.

> 2011-06-06  Andi Kleen  <ak@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
>
> --
> ak@linux.intel.com -- Speaking for myself only.
>
H.J. Lu - June 9, 2011, 1:06 p.m.
On Wed, Jun 8, 2011 at 3:07 AM, Andi Kleen <andi@firstfloor.org> wrote:
> 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  <ak@linux.intel.com>
>
>        * varasm.c (get_section): Print location of other conflict
>        for section conflicts.

Hi Andi,

You need to update 2 testcases due to extra message:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49341

Patch

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;
 	}