llvm-project/clang/utils
Ted Kremenek 9877f689f2 Implement -Wpedantic and --no-pedantic to complement -Weverything.
This patch introduces some magic in tablegen to create a "Pedantic" diagnostic
group which automagically includes all warnings that are extensions.  This
allows a user to suppress specific warnings traditionally under -pedantic used
an ordinary warning flag.  This also allows users to use #pragma to silence
specific -pedantic warnings, or promote them to errors, within blocks of text
(just like any other warning).

-Wpedantic is NOT an alias for -pedantic.  Instead, it provides another way
to (a) activate -pedantic warnings and (b) disable them.  Where they differ
is that -pedantic changes the behavior of the preprocessor slightly, whereas
-Wpedantic does not (it just turns on the warnings).

The magic in the tablegen diagnostic emitter has to do with computing the minimal
set of diagnostic groups and diagnostics that should go into -Wpedantic, as those
diagnostics that already members of groups that themselves are (transitively) members
of -Wpedantic do not need to be included in the Pedantic group directly.  I went
back and forth on whether or not to magically generate this group, and the invariant
was that we always wanted extension warnings to be included in -Wpedantic "some how",
but the bookkeeping would be very onerous to manage by hand.

-no-pedantic (and --no-pedantic) is included for completeness, and matches many of the
same kind of flags the compiler already supports.  It does what it says: cancels out
-pedantic.  One discrepancy is that if one specifies --no-pedantic and -Weverything or
-Wpedantic the pedantic warnings are still enabled (essentially the -W flags win).  We
can debate the correct behavior here.

Along the way, this patch nukes some code in TextDiagnosticPrinter.cpp and CXStoredDiagnostic.cpp
that determine whether to include the "-pedantic" flag in the warning output.  This is
no longer needed, as all extensions now have a -W flag.

This patch also significantly reduces the number of warnings not under flags from 229
to 158 (all extension warnings).  That's a 31% reduction.

llvm-svn: 159875
2012-07-06 23:07:31 +00:00
..
ABITest utils/ABITest: Factor out type naming code slightly. 2010-09-27 20:13:24 +00:00
C++Tests Remove the vestiges of the C backend. 2012-03-23 05:51:52 +00:00
CIndex Wrap 'data' key in quotes. 2010-04-17 00:37:35 +00:00
OptionalTests fix a bunch of comment typos found by codespell. Patch by 2011-04-15 05:22:18 +00:00
TableGen Implement -Wpedantic and --no-pedantic to complement -Weverything. 2012-07-06 23:07:31 +00:00
TestUtils Fix typo in test program 2010-07-14 00:09:17 +00:00
VtableTest More magic. 2010-03-29 03:26:49 +00:00
analyzer [analyzer] Add a statistic for maximum CFG size and a script to summarize analyzer stats from scan-build output. 2012-07-05 20:44:02 +00:00
valgrind Add a valgrind suppressions file for x86_64-pc-linux-gnu and gcc-4.3.3 which 2009-09-04 02:53:57 +00:00
CaptureCmd
CmpDriver fix a bunch of comment typos found by codespell. Patch by 2011-04-15 05:22:18 +00:00
FindSpecRefs
FuzzTest [utils/FuzzTest] Add '--stop-on-fail' to stop the script on the first failure 2012-03-08 20:29:39 +00:00
SummarizeErrors
builtin-defines.c
clang-completion-mode.el Minor comments and changes to clang-completion-mode.el, from David Wood! 2012-06-07 22:33:29 +00:00
clangVisualizers.txt Updating the visualizers to include more datatypes. Patch thanks to Jay Blanchard. 2012-05-31 19:27:30 +00:00
find-unused-diagnostics.sh Add a script that produces a list of all diagnostics that are defined in 2012-02-13 20:21:52 +00:00
token-delta.py