public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] better warning for section conflict
@ 2011-06-08 10:11 Andi Kleen
  2011-06-08 10:36 ` Richard Guenther
  2011-06-09 13:16 ` H.J. Lu
  0 siblings, 2 replies; 3+ messages in thread
From: Andi Kleen @ 2011-06-08 10:11 UTC (permalink / raw)
  To: gcc-patches

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(-)

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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] better warning for section conflict
  2011-06-08 10:11 [PATCH] better warning for section conflict Andi Kleen
@ 2011-06-08 10:36 ` Richard Guenther
  2011-06-09 13:16 ` H.J. Lu
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Guenther @ 2011-06-08 10:36 UTC (permalink / raw)
  To: Andi Kleen; +Cc: gcc-patches

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.
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] better warning for section conflict
  2011-06-08 10:11 [PATCH] better warning for section conflict Andi Kleen
  2011-06-08 10:36 ` Richard Guenther
@ 2011-06-09 13:16 ` H.J. Lu
  1 sibling, 0 replies; 3+ messages in thread
From: H.J. Lu @ 2011-06-09 13:16 UTC (permalink / raw)
  To: Andi Kleen; +Cc: gcc-patches

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


-- 
H.J.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-06-09 13:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-08 10:11 [PATCH] better warning for section conflict Andi Kleen
2011-06-08 10:36 ` Richard Guenther
2011-06-09 13:16 ` H.J. Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).