Start breaking -Wunreachable-code up into different diagnostic groups.

Press ? to show keyboard shortcuts.
Committed
kremenekMar 14 2014, 6:26 PM
Parents
rL203993: Test cases for stepping out past frames with no debug info if that is turned on.
Branches
Unknown
Tags
Unknown
Subscribers
None
Description

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.

rL203994

cfe/trunk/include/clang/Analysis/Analyses/ReachableCode.h

Loading...

cfe/trunk/include/clang/Basic/DiagnosticGroups.td

Loading...

cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td

Loading...

cfe/trunk/lib/Analysis/ReachableCode.cpp

Loading...

cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp

Loading...

cfe/trunk/test/Sema/warn-unreachable.c

Loading...

cfe/trunk/test/SemaCXX/unreachable-code.cpp

Loading...

cfe/trunk/test/SemaCXX/warn-unreachable.cpp

Loading...

cfe/trunk/test/SemaObjC/warn-unreachable.m

Loading...

Add Comment