public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/64079] New: pragma GCC diagnostic ignored "-Wunused-function" has incorrect scope
@ 2014-11-26  6:38 woodroof at gmail dot com
  2015-07-23 13:15 ` [Bug c++/64079] %+D in diagnostics breaks pragma GCC diagnostic manu at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: woodroof at gmail dot com @ 2014-11-26  6:38 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64079

            Bug ID: 64079
           Summary: pragma GCC diagnostic ignored "-Wunused-function" has
                    incorrect scope
           Product: gcc
           Version: 4.9.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: woodroof at gmail dot com

Created attachment 34121
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34121&action=edit
preprocessed file

Regression from 4.8.x

Warning "-Wunused-function" is generated even if 
#pragma GCC diagnostic ignored "-Wunused-function"
is defined in place where function is declared/defined.

If there is no "pragma GCC diagnostic push/pop", no warning is generated, even
if "pragma GCC diagnostic ignored" is located at the end of a compilation unit.

*Command line*: g++ -Wall bug.cpp

*Compiler output*:
bug.cpp:11:13: warning: ‘void bar()’ defined but not used [-Wunused-function]
 static void bar() {}
             ^
bug.cpp:7:6: warning: ‘void {anonymous}::foo()’ defined but not used
[-Wunused-function]
 void foo() {}
      ^

*Version*:
g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.9/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu
4.9.2-0ubuntu1~14.04' --with-bugurl=file:///usr/share/doc/gcc-4.9/README.Bugs
--enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.9 --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.9 --libdir=/usr/lib --enable-nls
--with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-vtable-verify
--enable-plugin --with-system-zlib --disable-browser-plugin
--enable-java-awt=gtk --enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.9-amd64/jre --enable-java-home
--with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.9-amd64
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.9-amd64
--with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar
--enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686
--with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib
--with-tune=generic --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.9.2 (Ubuntu 4.9.2-0ubuntu1~14.04)
>From gcc-bugs-return-468597-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Nov 26 07:17:53 2014
Return-Path: <gcc-bugs-return-468597-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 27614 invoked by alias); 26 Nov 2014 07:17:53 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 27564 invoked by uid 48); 26 Nov 2014 07:17:49 -0000
From: "mpolacek at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug sanitizer/64078] FAIL: c-c++-common/ubsan/object-size-9.c
Date: Wed, 26 Nov 2014 07:17:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: sanitizer
X-Bugzilla-Version: 5.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: mpolacek at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: cc
Message-ID: <bug-64078-4-BQx01PnbID@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-64078-4@http.gcc.gnu.org/bugzilla/>
References: <bug-64078-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-11/txt/msg03069.txt.bz2
Content-length: 2088

https://gcc.gnu.org/bugzilla/show_bug.cgi?idd078

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mpolacek at gcc dot gnu.org

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
I haven't seen that yet, though presumably it's about how a struct is padded,
so the following might help

diff --git a/gcc/testsuite/c-c++-common/ubsan/object-size-9.c
b/gcc/testsuite/c-c++-common/ubsan/object-size-9.c
index 829c822..97ef1d9 100644
--- a/gcc/testsuite/c-c++-common/ubsan/object-size-9.c
+++ b/gcc/testsuite/c-c++-common/ubsan/object-size-9.c
@@ -35,7 +35,7 @@ f2 (int i)
   return x;
 }

-/* { dg-output "\[^\n\r]*index 12 out of bounds for type 'char
\\\[8\\\]'\[^\n\r]*(\n|\r\n|\r)" { target { c++ } } } */
+/* { dg-output "\[^\n\r]*index 17 out of bounds for type 'char
\\\[8\\\]'\[^\n\r]*(\n|\r\n|\r)" { target { c++ } } } */
 /* { dg-output "\[^\n\r]*store to address \[^\n\r]* with insufficient space
for an object of type 'char'\[^\n\r]*(\n|\r\n|\r)" { target
 /* { dg-output "\[^\n\r]*note: pointer points here\[^\n\r]*(\n|\r\n|\r)" {
target { c++ } } } */
 /* { dg-output "\[^\n\r]*\[^\n\r]*(\n|\r\n|\r)" { target { c++ } } } */
@@ -64,7 +64,7 @@ f4 (int i)
   return s.d[i].b;
 }

-/* { dg-output "\[^\n\r]*index 12 out of bounds for type 'U
\\\[10\\\]'\[^\n\r]*(\n|\r\n|\r)" } */
+/* { dg-output "\[^\n\r]*index 17 out of bounds for type 'U
\\\[10\\\]'\[^\n\r]*(\n|\r\n|\r)" } */
 /* { dg-output "\[^\n\r]*load of address \[^\n\r]* with insufficient space for
an object of type 'unsigned int'\[^\n\r]*(\n|\r\n|\r)" }
 /* { dg-output "\[^\n\r]*note: pointer points here\[^\n\r]*(\n|\r\n|\r)" } */
 /* { dg-output "\[^\n\r]*\[^\n\r]*(\n|\r\n|\r)" } */
@@ -86,12 +86,12 @@ f5 (int i)
 int
 main (void)
 {
-  f1 (t, 12);
+  f1 (t, 17);
 #ifdef __cplusplus
-  f2 (12);
-  f3 (12);
+  f2 (17);
+  f3 (17);
 #endif
-  f4 (12);
-  f5 (12);
+  f4 (17);
+  f5 (17);
   return 0;
 }


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

* [Bug c++/64079] %+D in diagnostics breaks pragma GCC diagnostic
  2014-11-26  6:38 [Bug c++/64079] New: pragma GCC diagnostic ignored "-Wunused-function" has incorrect scope woodroof at gmail dot com
@ 2015-07-23 13:15 ` manu at gcc dot gnu.org
  2015-07-23 20:25 ` jason at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: manu at gcc dot gnu.org @ 2015-07-23 13:15 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64079

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic

--- Comment #2 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
Another example of this: https://gcc.gnu.org/ml/gcc-help/2015-07/msg00070.html
>From gcc-bugs-return-493104-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Jul 23 13:18:27 2015
Return-Path: <gcc-bugs-return-493104-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 19951 invoked by alias); 23 Jul 2015 13:18:27 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 19906 invoked by uid 48); 23 Jul 2015 13:18:21 -0000
From: "manu at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/64079] %+D in diagnostics breaks pragma GCC diagnostic
Date: Thu, 23 Jul 2015 13:18:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 4.9.2
X-Bugzilla-Keywords: diagnostic
X-Bugzilla-Severity: normal
X-Bugzilla-Who: manu at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: cc
Message-ID: <bug-64079-4-pE4gKWBcX3@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-64079-4@http.gcc.gnu.org/bugzilla/>
References: <bug-64079-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-07/txt/msg01994.txt.bz2
Content-length: 1694

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64079

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org,
                   |                            |paolo.carlini at oracle dot com

--- Comment #3 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
Trivial patch, but the issue remains that any use of '+' is potentially a bug.

Index: toplev.c
===================================================================
--- toplev.c    (revision 225868)
+++ toplev.c    (working copy)
@@ -522,14 +522,15 @@ check_global_declaration (tree decl)
       && (TREE_CODE (decl) != FUNCTION_DECL
          || (!DECL_STATIC_CONSTRUCTOR (decl)
              && !DECL_STATIC_DESTRUCTOR (decl)))
       /* Otherwise, ask the language.  */
       && lang_hooks.decls.warn_unused_global (decl))
-    warning ((TREE_CODE (decl) == FUNCTION_DECL)
-            ? OPT_Wunused_function
-             : OPT_Wunused_variable,
-            "%q+D defined but not used", decl);
+    warning_at (DECL_SOURCE_LOCATION (decl),
+               (TREE_CODE (decl) == FUNCTION_DECL)
+               ? OPT_Wunused_function
+               : OPT_Wunused_variable,
+               "%qD defined but not used", decl);
 }

 /* Compile an entire translation unit.  Write a file of assembly
    output and various debugging dumps.  */
>From gcc-bugs-return-493105-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Jul 23 13:19:32 2015
Return-Path: <gcc-bugs-return-493105-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 22543 invoked by alias); 23 Jul 2015 13:19:32 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 22504 invoked by uid 48); 23 Jul 2015 13:19:29 -0000
From: "manu at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/53431] C++ preprocessor ignores #pragma GCC diagnostic
Date: Thu, 23 Jul 2015 13:19:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 4.7.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: minor
X-Bugzilla-Who: manu at gcc dot gnu.org
X-Bugzilla-Status: NEW
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-53431-4-5HC2fNS8ns@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-53431-4@http.gcc.gnu.org/bugzilla/>
References: <bug-53431-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-07/txt/msg01995.txt.bz2
Content-length: 774

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53431

--- Comment #21 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Manuel López-Ibáñez from comment #14)
> (In reply to Jeffrey Walton from comment #13)
> > #if GCC_DIAGNOSTIC_AWARE
> > # pragma GCC diagnostic push
> > # pragma GCC diagnostic ignored "-Wunused-value"
> > # pragma GCC diagnostic ignored "-Wunused-variable"
> > #endif
> 
> As far as I understand, the #pragma should work as expected for those two
> warnings. Only those warnings given during preprocessing and lexing are
> affected by this bug.

Now that you posted a complete example here:
https://gcc.gnu.org/ml/gcc-help/2015-07/msg00070.html you seem to actually be
hitting PR66290, not this one.
>From gcc-bugs-return-493106-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Jul 23 13:20:04 2015
Return-Path: <gcc-bugs-return-493106-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 24512 invoked by alias); 23 Jul 2015 13:20:03 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 24441 invoked by uid 48); 23 Jul 2015 13:19:58 -0000
From: "noloader at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/53431] C++ preprocessor ignores #pragma GCC diagnostic
Date: Thu, 23 Jul 2015 13:20:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 4.7.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: minor
X-Bugzilla-Who: noloader at gmail dot com
X-Bugzilla-Status: NEW
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-53431-4-BDihR4xEJT@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-53431-4@http.gcc.gnu.org/bugzilla/>
References: <bug-53431-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-07/txt/msg01996.txt.bz2
Content-length: 935

https://gcc.gnu.org/bugzilla/show_bug.cgi?idS431

--- Comment #22 from Jeffrey Walton <noloader at gmail dot com> ---
(In reply to Jonathan Wakely from comment #18)
> ...
> Or you could just change the code causing the warnings.

Fair enough.

There are two warnings that are big offenders. First is the "unused variable"
warning due to a static assert. I asked for help with it at
https://gcc.gnu.org/ml/gcc-help/2015-07/msg00070.html.

Second is the "unknown pragma" warning. Here's part of the problem, but I don't
expect much to come of it: https://gcc.gnu.org/bugzilla/show_bug.cgi?idS431.
Here's another piece of the same problem:
https://gcc.gnu.org/bugzilla/show_bug.cgi?idf943.

I really don't understand the 66942 warning since GCC is an OpenMP conforming
compiler. '#pragma omp' is known to it in all configurations. The only thing
that changes is OMP is "active" when '-fopenmp' is passed on the command line.

Jeff


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

* [Bug c++/64079] %+D in diagnostics breaks pragma GCC diagnostic
  2014-11-26  6:38 [Bug c++/64079] New: pragma GCC diagnostic ignored "-Wunused-function" has incorrect scope woodroof at gmail dot com
  2015-07-23 13:15 ` [Bug c++/64079] %+D in diagnostics breaks pragma GCC diagnostic manu at gcc dot gnu.org
@ 2015-07-23 20:25 ` jason at gcc dot gnu.org
  2015-07-24  9:06 ` paolo.carlini at oracle dot com
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jason at gcc dot gnu.org @ 2015-07-23 20:25 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64079

--- Comment #6 from Jason Merrill <jason at gcc dot gnu.org> ---
(In reply to Paolo Carlini from comment #5)
> Thanks Manu. I'm going to take care of this specific issue. I will also ask
> if patches proactively replacing those +D and +#D in the C++ front-end are
> welcome at this time.

Such changes are pre-approved.


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

* [Bug c++/64079] %+D in diagnostics breaks pragma GCC diagnostic
  2014-11-26  6:38 [Bug c++/64079] New: pragma GCC diagnostic ignored "-Wunused-function" has incorrect scope woodroof at gmail dot com
  2015-07-23 13:15 ` [Bug c++/64079] %+D in diagnostics breaks pragma GCC diagnostic manu at gcc dot gnu.org
  2015-07-23 20:25 ` jason at gcc dot gnu.org
@ 2015-07-24  9:06 ` paolo.carlini at oracle dot com
  2015-07-24 12:46 ` manu at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2015-07-24  9:06 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64079

--- Comment #7 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Thanks Jason.

Note that '+' eventually boils down to location_of, which does quite a bit more
than DECL_SOURCE_LOCATION. Thus either we should be very, very careful in this
work or in some cases use location_of to be safe, at least ad interim.


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

* [Bug c++/64079] %+D in diagnostics breaks pragma GCC diagnostic
  2014-11-26  6:38 [Bug c++/64079] New: pragma GCC diagnostic ignored "-Wunused-function" has incorrect scope woodroof at gmail dot com
                   ` (2 preceding siblings ...)
  2015-07-24  9:06 ` paolo.carlini at oracle dot com
@ 2015-07-24 12:46 ` manu at gcc dot gnu.org
  2015-07-24 20:20 ` paolo at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: manu at gcc dot gnu.org @ 2015-07-24 12:46 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64079

--- Comment #8 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Paolo Carlini from comment #7)
> Thanks Jason.
> 
> Note that '+' eventually boils down to location_of, which does quite a bit
> more than DECL_SOURCE_LOCATION. Thus either we should be very, very careful
> in this work or in some cases use location_of to be safe, at least ad
> interim.

Indeed. And there are other cases that pass an explicit location and use '+',
thus simply removing '+' may regress the location info:

      error_at (type_start_token->location, "redefinition of %q#T",
                type);
      error_at (type_start_token->location, "previous definition of %q+#T",
                type);
>From gcc-bugs-return-493215-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Jul 24 13:05:54 2015
Return-Path: <gcc-bugs-return-493215-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 26278 invoked by alias); 24 Jul 2015 13:05:53 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 26161 invoked by uid 48); 24 Jul 2015 13:05:46 -0000
From: "paolo.carlini at oracle dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/64079] %+D in diagnostics breaks pragma GCC diagnostic
Date: Fri, 24 Jul 2015 13:05:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 4.9.2
X-Bugzilla-Keywords: diagnostic, easyhack
X-Bugzilla-Severity: normal
X-Bugzilla-Who: paolo.carlini at oracle dot com
X-Bugzilla-Status: ASSIGNED
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: paolo.carlini at oracle dot com
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-64079-4-bCdfV1LL2j@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-64079-4@http.gcc.gnu.org/bugzilla/>
References: <bug-64079-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-07/txt/msg02105.txt.bz2
Content-length: 252

https://gcc.gnu.org/bugzilla/show_bug.cgi?idd079

--- Comment #9 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Agreed. For now I mean to do a first pass on the warnings, no errors, seems
more urgent given the issue involving the pragmas.


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

* [Bug c++/64079] %+D in diagnostics breaks pragma GCC diagnostic
  2014-11-26  6:38 [Bug c++/64079] New: pragma GCC diagnostic ignored "-Wunused-function" has incorrect scope woodroof at gmail dot com
                   ` (3 preceding siblings ...)
  2015-07-24 12:46 ` manu at gcc dot gnu.org
@ 2015-07-24 20:20 ` paolo at gcc dot gnu.org
  2015-07-24 22:57 ` manu at gcc dot gnu.org
  2015-07-25  6:38 ` woodroof at gmail dot com
  6 siblings, 0 replies; 8+ messages in thread
From: paolo at gcc dot gnu.org @ 2015-07-24 20:20 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64079

--- Comment #10 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> ---
Author: paolo
Date: Fri Jul 24 20:20:13 2015
New Revision: 226191

URL: https://gcc.gnu.org/viewcvs?rev=226191&root=gcc&view=rev
Log:
2015-07-24  Manuel López-Ibáñez  <manu@gcc.gnu.org>

        PR c++/64079
        * toplev.c (check_global_declaration): Use DECL_SOURCE_LOCATION
        and "%qD" in warning_at instead of "%q+D" in warning.

/testsuite
2015-07-24  Manuel López-Ibáñez  <manu@gcc.gnu.org>

        PR c++/64079
        * c-c++-common/Wunused-function-1.c: New.

Added:
    trunk/gcc/testsuite/c-c++-common/Wunused-function-1.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/toplev.c
>From gcc-bugs-return-493278-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Jul 24 20:21:21 2015
Return-Path: <gcc-bugs-return-493278-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 115905 invoked by alias); 24 Jul 2015 20:21:21 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 115864 invoked by uid 48); 24 Jul 2015 20:21:16 -0000
From: "paolo.carlini at oracle dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/64079] %+D in diagnostics breaks pragma GCC diagnostic
Date: Fri, 24 Jul 2015 20:21:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 4.9.2
X-Bugzilla-Keywords: diagnostic, easyhack
X-Bugzilla-Severity: normal
X-Bugzilla-Who: paolo.carlini at oracle dot com
X-Bugzilla-Status: RESOLVED
X-Bugzilla-Resolution: FIXED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: paolo.carlini at oracle dot com
X-Bugzilla-Target-Milestone: 6.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status cc resolution target_milestone
Message-ID: <bug-64079-4-kCv6noFTcK@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-64079-4@http.gcc.gnu.org/bugzilla/>
References: <bug-64079-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-07/txt/msg02168.txt.bz2
Content-length: 547

https://gcc.gnu.org/bugzilla/show_bug.cgi?idd079

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
                 CC|paolo.carlini at oracle dot com    |
         Resolution|---                         |FIXED
   Target Milestone|---                         |6.0

--- Comment #11 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Fixed.


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

* [Bug c++/64079] %+D in diagnostics breaks pragma GCC diagnostic
  2014-11-26  6:38 [Bug c++/64079] New: pragma GCC diagnostic ignored "-Wunused-function" has incorrect scope woodroof at gmail dot com
                   ` (4 preceding siblings ...)
  2015-07-24 20:20 ` paolo at gcc dot gnu.org
@ 2015-07-24 22:57 ` manu at gcc dot gnu.org
  2015-07-25  6:38 ` woodroof at gmail dot com
  6 siblings, 0 replies; 8+ messages in thread
From: manu at gcc dot gnu.org @ 2015-07-24 22:57 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64079

--- Comment #12 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Paolo Carlini from comment #11)
> Fixed.

Should we have a meta-bug for all uses of %+ that can potentially cause
problems or should we leave open this one as a catch all case? Removing even
one case would be an easy entry-level patch for new contributors, this is why I
marked it as a easy-hack.

I have also updated https://gcc.gnu.org/wiki/DiagnosticsGuidelines following
Jason's comments.
>From gcc-bugs-return-493290-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Jul 24 23:34:15 2015
Return-Path: <gcc-bugs-return-493290-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 41142 invoked by alias); 24 Jul 2015 23:34:15 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 33097 invoked by uid 48); 24 Jul 2015 23:34:12 -0000
From: "doko at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/66868] [5/6 Regression] wrong code generated with -O3 (dead code removal?)
Date: Fri, 24 Jul 2015 23:34:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: tree-optimization
X-Bugzilla-Version: 5.1.1
X-Bugzilla-Keywords: wrong-code
X-Bugzilla-Severity: normal
X-Bugzilla-Who: doko at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 5.3
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-66868-4-HDIHEtJPSw@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-66868-4@http.gcc.gnu.org/bugzilla/>
References: <bug-66868-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-07/txt/msg02180.txt.bz2
Content-length: 174

https://gcc.gnu.org/bugzilla/show_bug.cgi?idf868

--- Comment #10 from Matthias Klose <doko at gcc dot gnu.org> ---
rechecked with a 5.2.0 release tarball, fails with -O3


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

* [Bug c++/64079] %+D in diagnostics breaks pragma GCC diagnostic
  2014-11-26  6:38 [Bug c++/64079] New: pragma GCC diagnostic ignored "-Wunused-function" has incorrect scope woodroof at gmail dot com
                   ` (5 preceding siblings ...)
  2015-07-24 22:57 ` manu at gcc dot gnu.org
@ 2015-07-25  6:38 ` woodroof at gmail dot com
  6 siblings, 0 replies; 8+ messages in thread
From: woodroof at gmail dot com @ 2015-07-25  6:38 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64079

--- Comment #13 from Danil Ilinykh <woodroof at gmail dot com> ---
Thanks!


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

end of thread, other threads:[~2015-07-25  6:38 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-26  6:38 [Bug c++/64079] New: pragma GCC diagnostic ignored "-Wunused-function" has incorrect scope woodroof at gmail dot com
2015-07-23 13:15 ` [Bug c++/64079] %+D in diagnostics breaks pragma GCC diagnostic manu at gcc dot gnu.org
2015-07-23 20:25 ` jason at gcc dot gnu.org
2015-07-24  9:06 ` paolo.carlini at oracle dot com
2015-07-24 12:46 ` manu at gcc dot gnu.org
2015-07-24 20:20 ` paolo at gcc dot gnu.org
2015-07-24 22:57 ` manu at gcc dot gnu.org
2015-07-25  6:38 ` woodroof at gmail dot com

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