public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/57241] New: GCC still issues -Wmultichar warnings despite a #pragma diagnostic ignored -Wmultichar directive
@ 2013-05-10 16:41 scottbaldwin at gmail dot com
  2013-05-10 16:49 ` [Bug c++/57241] " paolo.carlini at oracle dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: scottbaldwin at gmail dot com @ 2013-05-10 16:41 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 57241
           Summary: GCC still issues -Wmultichar warnings despite a
                    #pragma diagnostic ignored -Wmultichar directive
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: scottbaldwin at gmail dot com

In GCC 4.7.2 and 4.8.x, the #pragma ignore directive for -Wmultichar has no
effect. The code below demonstrates a -Wmultichar which is still emitted as a
warning despite the #pragma directive to ignore it. Specifying -Wno-multichar
on the command line works fine, so this is just an issue with trying to
suppress it with a #pragma directive (which I need for finer-grained control).

Note: I didn't test the other diagnostic options to see if there are others
besides -Wmultichar that have the same issue, so you might want to do a full
check on all diagnostic options.

Here's the demo code and unsuppressed compiler warnings:

int main() {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmultichar"
    typedef boost::mpl::string<'0123', '4567', '89ab', 'cdef'> hex_chars; //
-Wmultichar (gcc still issues warnings, despite #pragma ignore directive)
#pragma GCC diagnostic pop
    return 0;
}

warnings in gcc 4.7.2:
    sandbox_cpp11.cpp:148:29: warning: multi-character character constant
[-Wmultichar]
    sandbox_cpp11.cpp:148:37: warning: multi-character character constant
[-Wmultichar]
    sandbox_cpp11.cpp:148:45: warning: multi-character character constant
[-Wmultichar]
    sandbox_cpp11.cpp:148:53: warning: multi-character character constant
[-Wmultichar]

warnings in gcc 4.8.x:
    sandbox_cpp11.cpp:148:29: warning: multi-character character constant
[-Wmultichar]
      typedef boost::mpl::string<'0123', '4567', '89ab', 'cdef'> hex_chars;
                                 ^
    sandbox_cpp11.cpp:148:37: warning: multi-character character constant
[-Wmultichar]
      typedef boost::mpl::string<'0123', '4567', '89ab', 'cdef'> hex_chars;
                                         ^
    sandbox_cpp11.cpp:148:45: warning: multi-character character constant
[-Wmultichar]
      typedef boost::mpl::string<'0123', '4567', '89ab', 'cdef'> hex_chars;
                                                 ^
    sandbox_cpp11.cpp:148:53: warning: multi-character character constant
[-Wmultichar]
      typedef boost::mpl::string<'0123', '4567', '89ab', 'cdef'> hex_chars;


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

* [Bug c++/57241] GCC still issues -Wmultichar warnings despite a #pragma diagnostic ignored -Wmultichar directive
  2013-05-10 16:41 [Bug c++/57241] New: GCC still issues -Wmultichar warnings despite a #pragma diagnostic ignored -Wmultichar directive scottbaldwin at gmail dot com
@ 2013-05-10 16:49 ` paolo.carlini at oracle dot com
  2013-05-10 16:57 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-05-10 16:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> ---
In general, it's safe to say that #pragma diagnostic ignored is very buggy (in
C++ at least), we have got many long standing PRs.


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

* [Bug c++/57241] GCC still issues -Wmultichar warnings despite a #pragma diagnostic ignored -Wmultichar directive
  2013-05-10 16:41 [Bug c++/57241] New: GCC still issues -Wmultichar warnings despite a #pragma diagnostic ignored -Wmultichar directive scottbaldwin at gmail dot com
  2013-05-10 16:49 ` [Bug c++/57241] " paolo.carlini at oracle dot com
@ 2013-05-10 16:57 ` pinskia at gcc dot gnu.org
  2013-05-10 17:23 ` scottbaldwin at gmail dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2013-05-10 16:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Paolo Carlini from comment #1)
> In general, it's safe to say that #pragma diagnostic ignored is very buggy
> (in C++ at least), we have got many long standing PRs.

Well the whole token ahead of time for C++ front-end causes this and another
issue with respect of #pragma's.


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

* [Bug c++/57241] GCC still issues -Wmultichar warnings despite a #pragma diagnostic ignored -Wmultichar directive
  2013-05-10 16:41 [Bug c++/57241] New: GCC still issues -Wmultichar warnings despite a #pragma diagnostic ignored -Wmultichar directive scottbaldwin at gmail dot com
  2013-05-10 16:49 ` [Bug c++/57241] " paolo.carlini at oracle dot com
  2013-05-10 16:57 ` pinskia at gcc dot gnu.org
@ 2013-05-10 17:23 ` scottbaldwin at gmail dot com
  2013-05-12 20:08 ` [Bug c++/57241] " manu at gcc dot gnu.org
  2013-11-16 20:23 ` manu at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: scottbaldwin at gmail dot com @ 2013-05-10 17:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from etherice <scottbaldwin at gmail dot com> ---
(In reply to Andrew Pinski from comment #2)
> (In reply to Paolo Carlini from comment #1)
> > In general, it's safe to say that #pragma diagnostic ignored is very buggy
> > (in C++ at least), we have got many long standing PRs.
> 
> Well the whole token ahead of time for C++ front-end causes this and another
> issue with respect of #pragma's.

Fixing it would certainly help those of us using -Wall and -Werror and wanting
fine-grained control of when to allow specific cases (such as -Wmultichar when
defining a boost::mpl::string, or making a signed/unsigned comparison, etc.).


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

* [Bug c++/57241] -Wmultichar warnings despite a #pragma diagnostic ignored -Wmultichar directive
  2013-05-10 16:41 [Bug c++/57241] New: GCC still issues -Wmultichar warnings despite a #pragma diagnostic ignored -Wmultichar directive scottbaldwin at gmail dot com
                   ` (2 preceding siblings ...)
  2013-05-10 17:23 ` scottbaldwin at gmail dot com
@ 2013-05-12 20:08 ` manu at gcc dot gnu.org
  2013-11-16 20:23 ` manu at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: manu at gcc dot gnu.org @ 2013-05-12 20:08 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #4 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #2)
> (In reply to Paolo Carlini from comment #1)
> > In general, it's safe to say that #pragma diagnostic ignored is very buggy
> > (in C++ at least), we have got many long standing PRs.
> 
> Well the whole token ahead of time for C++ front-end causes this and another
> issue with respect of #pragma's.

Doesn't CPP diagnostics pass through the pragma classify code in diagnostic.c
even when tokenizing ahead of time? If so, I don't understand why the warning
is not suppressed. I don't have time to investigate it myself, but I don't see
why that would be the problem here.
>From gcc-bugs-return-422109-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sun May 12 20:32:05 2013
Return-Path: <gcc-bugs-return-422109-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 21664 invoked by alias); 12 May 2013 20:32:05 -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 21610 invoked by uid 48); 12 May 2013 20:31:53 -0000
From: "nszabolcs at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/57258] New: unused variable warning is emitted for volatile variables
Date: Sun, 12 May 2013 20:32:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c
X-Bugzilla-Version: 4.8.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: nszabolcs at gmail dot com
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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter
Message-ID: <bug-57258-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: 2013-05/txt/msg00782.txt.bz2
Content-length: 977

http://gcc.gnu.org/bugzilla/show_bug.cgi?idW258

            Bug ID: 57258
           Summary: unused variable warning is emitted for volatile
                    variables
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nszabolcs at gmail dot com

unused variable warnings are incorrectly issued for
volatile variables

a volatile variable is only unused if it is not
accessed, otherwise code will be generated for
using it following the semantics of the abstract
machine

in the following example the compiler gives a
warning eventhough the generated code uses x:

$ cat example.c
void f()
{
        volatile int x = 0;
}

$ gcc-4.8 -c -Wunused-variable example.c
example.c: In function 'f':
example.c:3:15: warning: unused variable 'x' [-Wunused-variable]
  volatile int x = 0;
               ^


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

* [Bug c++/57241] -Wmultichar warnings despite a #pragma diagnostic ignored -Wmultichar directive
  2013-05-10 16:41 [Bug c++/57241] New: GCC still issues -Wmultichar warnings despite a #pragma diagnostic ignored -Wmultichar directive scottbaldwin at gmail dot com
                   ` (3 preceding siblings ...)
  2013-05-12 20:08 ` [Bug c++/57241] " manu at gcc dot gnu.org
@ 2013-11-16 20:23 ` manu at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: manu at gcc dot gnu.org @ 2013-11-16 20:23 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #5 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Manuel López-Ibáñez from comment #4)
> 
> Doesn't CPP diagnostics pass through the pragma classify code in
> diagnostic.c even when tokenizing ahead of time? If so, I don't understand
> why the warning is not suppressed. I don't have time to investigate it
> myself, but I don't see why that would be the problem here.

So answering to myself: No, it doesn't (see PR53431). I think it must.

This affects all the controllable warnings from CPP when using g++.

*** This bug has been marked as a duplicate of bug 53431 ***
>From gcc-bugs-return-434771-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sat Nov 16 20:32:50 2013
Return-Path: <gcc-bugs-return-434771-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 31297 invoked by alias); 16 Nov 2013 20:32:50 -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 31273 invoked by uid 48); 16 Nov 2013 20:32:47 -0000
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/59156] code miscompiled with -O2 -fpeel-loops
Date: Sat, 16 Nov 2013 20:32: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.2
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: pinskia 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:
Message-ID: <bug-59156-4-ta1xMRsyV3@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-59156-4@http.gcc.gnu.org/bugzilla/>
References: <bug-59156-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: 2013-11/txt/msg01548.txt.bz2
Content-length: 150

http://gcc.gnu.org/bugzilla/show_bug.cgi?idY156

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
-fno-strict-aliasing fixes it.


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

end of thread, other threads:[~2013-11-16 20:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-10 16:41 [Bug c++/57241] New: GCC still issues -Wmultichar warnings despite a #pragma diagnostic ignored -Wmultichar directive scottbaldwin at gmail dot com
2013-05-10 16:49 ` [Bug c++/57241] " paolo.carlini at oracle dot com
2013-05-10 16:57 ` pinskia at gcc dot gnu.org
2013-05-10 17:23 ` scottbaldwin at gmail dot com
2013-05-12 20:08 ` [Bug c++/57241] " manu at gcc dot gnu.org
2013-11-16 20:23 ` manu at gcc dot gnu.org

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