]> granicus.if.org Git - clang/commit
Start breaking -Wunreachable-code up into different diagnostic groups.
authorTed Kremenek <kremenek@apple.com>
Sat, 15 Mar 2014 01:26:32 +0000 (01:26 +0000)
committerTed Kremenek <kremenek@apple.com>
Sat, 15 Mar 2014 01:26:32 +0000 (01:26 +0000)
commit5f5ef97906ab54fd9f60f8b30894af4af9394b5e
tree19ad92daaa83fbff22c74722720063fab46d3df8
parent6112f1ff83ebbc4706ea2d1609e85501ff8f2f2a
Start breaking -Wunreachable-code up into different diagnostic groups.

Recent work on -Wunreachable-code has focused on suppressing uninteresting
unreachable code that center around "configuration values", but
there are still some set of cases that are sometimes interesting
or uninteresting depending on the codebase.  For example, a dead
"break" statement may not be interesting for a particular codebase,
potentially because it is auto-generated or simply because code
is written defensively.

To address these workflow differences, -Wunreachable-code is now
broken into several diagnostic groups:

-Wunreachable-code: intended to be a reasonable "default" for
most users.

and then other groups that turn on more aggressive checking:

-Wunreachable-code-break: warn about dead break statements

-Wunreachable-code-trivial-return: warn about dead return statements
that return "trivial" values (e.g., return 0).  Other return
statements that return non-trivial values are still reported
under -Wunreachable-code (this is an area subject to more refinement).

-Wunreachable-code-aggressive: supergroup that enables all these
groups.

The goal is to eventually make -Wunreachable-code good enough to
either be in -Wall or on-by-default, thus finessing these warnings
into different groups helps achieve maximum signal for more users.

TODO: the tests need to be updated to reflect this extra control
via diagnostic flags.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203994 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Analysis/Analyses/ReachableCode.h
include/clang/Basic/DiagnosticGroups.td
include/clang/Basic/DiagnosticSemaKinds.td
lib/Analysis/ReachableCode.cpp
lib/Sema/AnalysisBasedWarnings.cpp
test/Sema/warn-unreachable.c
test/SemaCXX/unreachable-code.cpp
test/SemaCXX/warn-unreachable.cpp
test/SemaObjC/warn-unreachable.m