[Bug c++/61412] Warnings incorrectly suppressed when compiling previously preprocessed file
matt at godbolt dot org
gcc-bugzilla@gcc.gnu.org
Wed Jun 4 15:51:00 GMT 2014
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61412
--- Comment #5 from Matt Godbolt <matt at godbolt dot org> ---
I produced the file by preprocessing an existing file with g++ -E on an
existing file that exhibited the file (250k+ lines).
The full line I used to create the original preprocessed file is:
$ g++ -c -std=gnu++1y -ggdb3 -Wall -Wextra -Werror -fdiagnostics-show-option
-Wno-unused-local-typedefs -DBOOST_ASIO_DISABLE_EVENTFD -DBOOST_OKAY
-march=core2 -Isrc -isystem include -O3 -DNDEBUG -DBOOST_ASIO_DISABLE_ASSERTS
-DBOOST_DISABLE_ASSERTS -MMD -MP -MFout/main/helix/HelixRegressionModule.d -MT
out/main/helix/HelixRegressionModule.o
-MTout/main/helix/HelixRegressionModule.d -E
src/helix/HelixRegressionModule.cpp
That 250K+ file also exhibits the problem: that is, the warning is suppressed
even within the main body of the file. I then whittled down the preprocessed
file to just those two lines. In the original file the "# ..." line came from
the middle of a macro expansion defined by a header included via an -isystem
path. The filename in the "# " line refers to the C++ file though in both
cases.
The macro is a LOG4CPLUS macro and it expands in the original file to:
if (numSkipped)
do { if((L).isEnabledFor(log4cplus::WARN_LOG_LEVEL)) {
log4cplus::tostringstream _log4cplus_buf; _log4cplus_buf << "Skipped " <<
numSkipped << " orders due to juncture mismatches, erf target=" << juncture <<
" hdf5 epoch now=" << (row < numRows? records[row].epoch:0);
(L).forcedLog(log4cplus::WARN_LOG_LEVEL, _log4cplus_buf.str(),
"src/helix/HelixRegressionModule.cpp"
# 88 "src/helix/HelixRegressionModule.cpp" 3 4
,
91
# 88 "src/helix/HelixRegressionModule.cpp" 3 4
); } } while (0)
;
where line 88 of the original file is:
if (numSkipped)
LOG4CPLUS_WARN(L, "Skipped " << numSkipped
<< " orders due to juncture mismatches, erf target="
<< juncture << " hdf5 epoch now="
<< (row < numRows? records[row].epoch:0));
I had not previously encountered the "#" directive with trailing numbers so it
aroused my suspicion. That made me hone in on it and discover that just the "#"
directive alone is enough to seemingly convince GCC that what follows is a
system header.
More information about the Gcc-bugs
mailing list