]> granicus.if.org Git - clang/commit
Improve -Wunreachable-code to provide a means to indicate code is intentionally marke...
authorTed Kremenek <kremenek@apple.com>
Sat, 29 Mar 2014 00:35:20 +0000 (00:35 +0000)
committerTed Kremenek <kremenek@apple.com>
Sat, 29 Mar 2014 00:35:20 +0000 (00:35 +0000)
commite1f53884e483c92c497eab5f12f479c136f6ba94
treeab006dbc9f76246f5ffea87564c9da3c28743ff2
parented699a2323ef722d56fa89e6ffcdcfe62308b56d
Improve -Wunreachable-code to provide a means to indicate code is intentionally marked dead via if((0)).

Taking a hint from -Wparentheses, use an extra '()' as a sigil that
a dead condition is intentionally dead.  For example:

  if ((0)) { dead }

When this sigil is found, do not emit a dead code warning.  When the
analysis sees:

  if (0)

it suggests inserting '()' as a Fix-It.

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