Add -Wimplicit-fallthrough command line option to clang in
authorJason Molenda <jmolenda@apple.com>
Tue, 16 Feb 2016 04:14:33 +0000 (04:14 +0000)
committerJason Molenda <jmolenda@apple.com>
Tue, 16 Feb 2016 04:14:33 +0000 (04:14 +0000)
commit62e0681afb478a4005efb6ba3598c24dc24866ee
treeb527218300ffab6dda546b8914c0e6194ede5123
parent75a18c20b1c9f748a132c920e2f9b6e5dc9cac07
Add -Wimplicit-fallthrough command line option to clang in
the xcode project file to catch switch statements that have a
case that falls through unintentionally.

Define LLVM_FALLTHROUGH to indicate instances where a case has code
and intends to fall through.  This should be in llvm/Support/Compiler.h;
Peter Collingbourne originally checked in there (r237766), then
reverted (r237941) because he didn't have time to mark up all the
'case' statements that were intended to fall through.  I put together
a patch to get this back in llvm http://reviews.llvm.org/D17063 but
it hasn't been approved in the past week.  I added a new
lldb-private-defines.h to hold the definition for now.

Every place in lldb where there is a comment that the fall-through
is intentional, I added LLVM_FALLTHROUGH to silence the warning.
I haven't tried to identify whether the fallthrough is a bug or
not in the other places.

I haven't tried to add this to the cmake option build flags.
This warning will only work for clang.

This build cleanly (with some new warnings) on macosx with clang
under xcodebuild, but if this causes problems for people on other
configurations, I'll back it out.

llvm-svn: 260930
28 files changed:
lldb/include/lldb/lldb-private-defines.h [new file with mode: 0644]
lldb/include/lldb/lldb-private.h
lldb/lldb.xcodeproj/project.pbxproj
lldb/source/Commands/CommandObjectMemory.cpp
lldb/source/Core/Address.cpp
lldb/source/Core/AddressRange.cpp
lldb/source/Core/ArchSpec.cpp
lldb/source/Core/Communication.cpp
lldb/source/Core/CxaDemangle.cpp
lldb/source/Core/FastDemangle.cpp
lldb/source/Core/FormatEntity.cpp
lldb/source/Expression/REPL.cpp
lldb/source/Interpreter/OptionValueArray.cpp
lldb/source/Interpreter/OptionValueFileSpecLIst.cpp
lldb/source/Interpreter/OptionValuePathMappings.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp
lldb/source/Symbol/ClangASTContext.cpp
lldb/source/Target/Process.cpp
lldb/source/Target/StackFrame.cpp