public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/55578] New: Disabling warnings inside macro definition doesn't work
@ 2012-12-03 18:41 ruboam at gmail dot com
  2012-12-05 13:07 ` [Bug c++/55578] " paolo.carlini at oracle dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: ruboam at gmail dot com @ 2012-12-03 18:41 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 55578
           Summary: Disabling warnings inside macro definition doesn't
                    work
    Classification: Unclassified
           Product: gcc
           Version: 4.6.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: ruboam@gmail.com


When compiling following code with just -Wall option I'm getting below
mentioned warning.

#define FF() \
_Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Wunused-variable\"") \
{int x;} \
_Pragma("GCC diagnostic pop")

int main()
{
  FF();
  return 0;
}

In function 'int main()':
warning: unused variable 'x' [-Wunused-variable]

But when I also specify -no-integrated-cpp or -save-temps options the warning
doesn't show up.

It looks like when preprocessor and compiler work in one shop the warning
doesn't get disabled. BTW this happens for any warning not just with
unused-variable one.

GCC version is: 4.6.2
Command line is: gcc <file-name> -Wall
System is: Linux  2.6.18-238.el5 #1 SMP Sun Dec 19 14:22:44 EST 2010 x86_64
x86_64 x86_64 GNU/Linux


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

end of thread, other threads:[~2022-10-06  1:58 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-03 18:41 [Bug c++/55578] New: Disabling warnings inside macro definition doesn't work ruboam at gmail dot com
2012-12-05 13:07 ` [Bug c++/55578] " paolo.carlini at oracle dot com
2012-12-09  0:31 ` pinskia at gcc dot gnu.org
2021-04-26  9:34 ` vz-gcc at zeitlins dot org
2022-10-04  0:37 ` lhyatt at gcc dot gnu.org
2022-10-04 16:04 ` vz-gcc at zeitlins dot org
2022-10-05 22:08 ` lhyatt at gcc dot gnu.org
2022-10-06  1:31 ` vz-gcc at zeitlins dot org
2022-10-06  1:58 ` lhyatt 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).