public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "dangelog at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/100796] New: [11 Regression] GCC does not honor #pragma diagnostic ignored when using the integrated preprocessor
Date: Thu, 27 May 2021 10:35:09 +0000	[thread overview]
Message-ID: <bug-100796-4@http.gcc.gnu.org/bugzilla/> (raw)

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

             reply	other threads:[~2021-05-27 10:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-27 10:35 dangelog at gmail dot com [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-100796-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).