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
* [Bug c++/100796] [11 Regression] GCC does not honor #pragma diagnostic ignored when using the integrated preprocessor
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 ` redi at gcc dot gnu.org
2021-05-27 11:55 ` dangelog at gmail dot com
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: redi at gcc dot gnu.org @ 2021-05-27 11:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100796
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This is not a 11 Regression, since it's exactly the same as previous releases,
isn't it?
I think it's a dup of PR 53431
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/100796] [11 Regression] GCC does not honor #pragma diagnostic ignored when using the integrated preprocessor
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
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: dangelog at gmail dot com @ 2021-05-27 11:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100796
--- Comment #2 from Giuseppe D'Angelo <dangelog at gmail dot com> ---
Well, GCC 8-9-10 don't have this problem at all for us. This appeared only when
upgrading to 11.
Anyways, I'm not sure if it's the same issue. PR 53431 seems to be about the
preprocessor itself ignoring the pragmas -- like raising -Wundef even under a
pragma.
Here is not quite about the preprocessor (in fact, the not-honored pragma can
only be honored by the compiler, it's about -Wsuggest-override). The compiler
seems to ignore that pragma in _random_ places (it's very inconsistent; the
majority of code is not flagged, except for a few occurrences).
If I run the preprocessor manually, the pragma is still correctly present in
the preprocessed output. However: running the compiler over that preprocessed
output does NOT raise the warning. That leads to the fact that adding
-no-integrated-cpp is a successful workaround; this makes me think something
broke in there...?
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/100796] [11 Regression] GCC does not honor #pragma diagnostic ignored when using the integrated preprocessor
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
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-05-28 10:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100796
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |diagnostic
Version|unknown |11.1.1
Target Milestone|--- |11.2
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/100796] [11 Regression] GCC does not honor #pragma diagnostic ignored when using the integrated preprocessor
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
` (2 preceding siblings ...)
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
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jason at gcc dot gnu.org @ 2021-06-09 0:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100796
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason at gcc dot gnu.org
--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> ---
(In reply to Giuseppe D'Angelo from comment #0)
> Please advise as of what kind of test I could do
> / provide to help you track this one down.
The testcase doesn't really need to be reduced, just separated from the Qt
build system: some source files and a compiler command line would be fine.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/100796] [11 Regression] GCC does not honor #pragma diagnostic ignored when using the integrated preprocessor
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
` (3 preceding siblings ...)
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
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: dangelog at gmail dot com @ 2021-06-14 19:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100796
--- Comment #4 from Giuseppe D'Angelo <dangelog at gmail dot com> ---
Created attachment 51011
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51011&action=edit
testcase
Hi,
I've tried to "carve" a subset of files that show the problem. Apologies for
not really being minimal.
How to reproduce:
1) uncompress
2) cd $dir/home/peppe/projects/src/qt5/qtbase/build
3) (with c++ = GCC 11) run
c++ -DQT_CONCURRENT_LIB -DQT_CORE_LIB
-DQT_TESTCASE_BUILDDIR=\"/home/peppe/projects/src/qt5/qtbase/build/tests/auto/corelib/io/qurl\"
-DQT_TESTCASE_SOURCEDIR=\"/home/peppe/projects/src/qt5/qtbase/tests/auto/corelib/io/qurl\"
-D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE
-Itests/auto/corelib/io/qurl/tst_qurl_autogen/include
-I../tests/auto/corelib/io/qurl -Itests/auto/corelib/io/qurl -Iinclude
-Iinclude/QtCore -I../mkspecs/linux-g++ -Iinclude/QtTest -Iinclude/QtConcurrent
-Isrc/testlib -Iinclude/QtTest/6.2.0 -Iinclude/QtTest/6.2.0/QtTest
-Isrc/corelib -Iinclude/QtCore/6.2.0 -Iinclude/QtCore/6.2.0/QtCore -g -fPIE
-fvisibility=hidden -fvisibility-inlines-hidden -Wall -Wextra -fPIC -pthread
-Wsuggest-override -std=gnu++2a -o /dev/null -c
../tests/auto/corelib/io/qurl/tst_qurl.cpp
That for me generates a bunch of false warnings such as
> include/QtCore/../../../src/corelib/kernel/qtmetamacros.h:159:32: warning: ‘virtual const QMetaObject* QSocketNotifier::metaObject() const’ can be marked override [-Wsuggest-override]
> 159 | virtual const QMetaObject *metaObject() const; \
> | ^~~~~~~~~~
> include/QtCore/../../../src/corelib/kernel/qsocketnotifier.h:51:5: note: in expansion of macro ‘Q_OBJECT’
> 51 | Q_OBJECT
> | ^~~~~~~~
and many more.
As mentioned before: adding -no-integrated-cpp to the command line, and/or
splitting the compilation in explicit preprocessing+compilation, makes the
warnings disappear.
Please let me know if the testcase works or if I forgot to add something
(hoping that system headers don't make a difference, anyways, I'm testing under
Ubuntu 20.04).
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/100796] [11 Regression] GCC does not honor #pragma diagnostic ignored when using the integrated preprocessor
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
` (4 preceding siblings ...)
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
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jason at gcc dot gnu.org @ 2021-06-14 22:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100796
--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> ---
Created attachment 51012
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51012&action=edit
fix
Testing this fix now. Making a suitable testcase for the testsuite will be a
bit tricky...
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/100796] [11 Regression] GCC does not honor #pragma diagnostic ignored when using the integrated preprocessor
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
` (5 preceding siblings ...)
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
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: dangelog at gmail dot com @ 2021-06-15 10:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100796
--- Comment #6 from Giuseppe D'Angelo <dangelog at gmail dot com> ---
Hi,
Wow, that was quick!
I can't really judge the merit of the patch, but I've picked it on top of the
GCC 11.1.0 tarball and can confirm that it seems to fix all the warnings for
us. Thank you very much!
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/100796] [11 Regression] GCC does not honor #pragma diagnostic ignored when using the integrated preprocessor
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
` (6 preceding siblings ...)
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
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-06-16 15:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100796
--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>:
https://gcc.gnu.org/g:9e64426dae129cca5b62355ef6c5a3bd6137e830
commit r12-1538-g9e64426dae129cca5b62355ef6c5a3bd6137e830
Author: Jason Merrill <jason@redhat.com>
Date: Mon Jun 14 17:37:43 2021 -0400
libcpp: location comparison within macro [PR100796]
The patch for 96391 changed linemap_compare_locations to give up on
comparing locations from macro expansions if we don't have column
information. But in this testcase, the BOILERPLATE macro is multiple lines
long, so we do want to compare locations within the macro. So this patch
moves the LINE_MAP_MAX_LOCATION_WITH_COLS check inside the block, to use it
for failing gracefully.
PR c++/100796
PR preprocessor/96391
libcpp/ChangeLog:
* line-map.c (linemap_compare_locations): Only use comparison with
LINE_MAP_MAX_LOCATION_WITH_COLS to avoid abort.
gcc/testsuite/ChangeLog:
* g++.dg/plugin/location-overflow-test-pr100796.c: New test.
* g++.dg/plugin/plugin.exp: Run it.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/100796] [11 Regression] GCC does not honor #pragma diagnostic ignored when using the integrated preprocessor
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
` (7 preceding siblings ...)
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
10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-06-16 18:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100796
--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Jason Merrill
<jason@gcc.gnu.org>:
https://gcc.gnu.org/g:bb2e908638758097e261bca1a4825d171a18af9c
commit r11-8583-gbb2e908638758097e261bca1a4825d171a18af9c
Author: Jason Merrill <jason@redhat.com>
Date: Mon Jun 14 17:37:43 2021 -0400
libcpp: location comparison within macro [PR100796]
The patch for 96391 changed linemap_compare_locations to give up on
comparing locations from macro expansions if we don't have column
information. But in this testcase, the BOILERPLATE macro is multiple lines
long, so we do want to compare locations within the macro. So this patch
moves the LINE_MAP_MAX_LOCATION_WITH_COLS check inside the block, to use it
for failing gracefully.
PR c++/100796
PR preprocessor/96391
libcpp/ChangeLog:
* line-map.c (linemap_compare_locations): Only use comparison with
LINE_MAP_MAX_LOCATION_WITH_COLS to avoid abort.
gcc/testsuite/ChangeLog:
* g++.dg/plugin/location-overflow-test-pr100796.c: New test.
* g++.dg/plugin/plugin.exp: Run it.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/100796] [11 Regression] GCC does not honor #pragma diagnostic ignored when using the integrated preprocessor
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
` (8 preceding siblings ...)
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
10 siblings, 0 replies; 12+ messages in thread
From: jason at gcc dot gnu.org @ 2021-06-21 15:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100796
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|UNCONFIRMED |RESOLVED
--- Comment #9 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed for 11.2
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/100796] [11 Regression] GCC does not honor #pragma diagnostic ignored when using the integrated preprocessor
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
` (9 preceding siblings ...)
2021-06-21 15:43 ` jason at gcc dot gnu.org
@ 2021-06-21 16:45 ` dangelog at gmail dot com
10 siblings, 0 replies; 12+ messages in thread
From: dangelog at gmail dot com @ 2021-06-21 16:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100796
--- Comment #10 from Giuseppe D'Angelo <dangelog at gmail dot com> ---
Thank you very much.
^ 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).