public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/100796] New: [11 Regression] GCC does not honor #pragma diagnostic ignored when using the integrated preprocessor
@ 2021-05-27 10:35 dangelog at gmail dot com
  2021-05-27 11:33 ` [Bug c++/100796] " redi at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: dangelog at gmail dot com @ 2021-05-27 10:35 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100796
           Summary: [11 Regression] GCC does not honor #pragma diagnostic
                    ignored when using the integrated preprocessor
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dangelog at gmail dot com
  Target Milestone: ---

Hi,

When building the qtbase `dev` branch with GCC 11, a bunch of warnings are
generated even in the presence of a ignoring pragma. 

For a bit of context, in Qt there's a macro called Q_OBJECT that users can add
to their classes; this macro expands to a series of declarations, including a
couple of virtuals. These may raise -Wsuggest-override warnings, in user code,
so such warnings are suppressed via pragmas (as part of the Q_OBJECT macro
itself).

GCC 10 honors the pragmas and doesn't raise warnings, but GCC 11 doesn't honor
them, resulting in warnings like

    include/QtCore/../../../src/corelib/kernel/qtmetamacros.h:159:32: error:
‘virtual const QMetaObject* QTextObject::metaObject() const’ can be marked
override [-Werror=suggest-override]
      159 |     virtual const QMetaObject *metaObject() const; \
          |                                ^~~~~~~~~~
    include/QtGui/../../../src/gui/text/qtextobject.h:62:5: note: in expansion
of macro ‘Q_OBJECT’
       62 |     Q_OBJECT
          |     ^~~~~~~~
    include/QtCore/../../../src/corelib/kernel/qtmetamacros.h:160:19: error:
‘virtual void* QTextObject::qt_metacast(const char*)’ can be marked override
[-Werror=suggest-override]
      160 |     virtual void *qt_metacast(const char *); \
          |                   ^~~~~~~~~~~
    include/QtGui/../../../src/gui/text/qtextobject.h:62:5: note: in expansion
of macro ‘Q_OBJECT’
       62 |     Q_OBJECT
          |     ^~~~~~~~

And so on and so forth.

Now, the peculiarity of this bug is that if you disable the integrated
preprocessor via -no-integrated-cpp then everything works fine. Similarly, if
you take a preprocessed output and compile *that*, then no warnings are raised.
I therefore suspect a regression in the integrated preprocessor.

For this reason I'm actually unable to attach a testcase: a preprocessed output
 compiles just fine. Please advise as of what kind of test I could do / provide
to help you track this one down. 



If you wish to try and compile Qt yourself, then it's relatively easy: 

1) clone git://code.qt.io/qt/qtbase.git , checkout dev
2) get a very recent CMake 
3) mkdir build
4) (with GCC 11 in PATH, or force it via CC/CXX env) cmake -GNinja
-DCMAKE_BUILD_TYPE=Debug -DQT_BUILD_EXAMPLES_BY_DEFAULT=OFF
-DQT_BUILD_TESTS_BY_DEFAULT=OFF -DFEATURE_developer_build=ON ../path/to/qtbase
5) ninja


Upstream bug: https://bugreports.qt.io/browse/QTBUG-93360

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

end of thread, other threads:[~2021-06-21 16:45 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-27 10:35 [Bug c++/100796] New: [11 Regression] GCC does not honor #pragma diagnostic ignored when using the integrated preprocessor dangelog at gmail dot com
2021-05-27 11:33 ` [Bug c++/100796] " redi at gcc dot gnu.org
2021-05-27 11:55 ` dangelog at gmail dot com
2021-05-28 10:40 ` rguenth at gcc dot gnu.org
2021-06-09  0:52 ` jason at gcc dot gnu.org
2021-06-14 19:43 ` dangelog at gmail dot com
2021-06-14 22:04 ` jason at gcc dot gnu.org
2021-06-15 10:59 ` dangelog at gmail dot com
2021-06-16 15:41 ` cvs-commit at gcc dot gnu.org
2021-06-16 18:33 ` cvs-commit at gcc dot gnu.org
2021-06-21 15:43 ` jason at gcc dot gnu.org
2021-06-21 16:45 ` dangelog 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).