[lld] r218197 - Silence these C4715 warnings from Visual C++ (NFC)
Yaron Keren
yaron.keren at gmail.com
Sat Sep 20 21:13:46 PDT 2014
Author: yrnkrn
Date: Sat Sep 20 23:13:45 2014
New Revision: 218197
URL: http://llvm.org/viewvc/llvm-project?rev=218197&view=rev
Log:
Silence these C4715 warnings from Visual C++ (NFC)
llvm\tools\lld\lib\readerwriter\macho\macholinkingcontext.cpp(647):
warning C4715: 'lld::MachOLinkingContext::exportSymbolNamed' :
not all control paths return a value
llvm\tools\lld\lib\readerwriter\macho\machonormalizedfilefromatoms.cpp(723):
warning C4715: '`anonymous namespace'::Util::getSymbolTableRegion' :
not all control paths return a value
While all enum values do appear in the switch, an uninitialized or corrupted
enum variable would not be caught without the default: case in the switch.
Modified:
lld/trunk/lib/ReaderWriter/MachO/MachOLinkingContext.cpp
lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp
Modified: lld/trunk/lib/ReaderWriter/MachO/MachOLinkingContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/MachOLinkingContext.cpp?rev=218197&r1=218196&r2=218197&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/MachO/MachOLinkingContext.cpp (original)
+++ lld/trunk/lib/ReaderWriter/MachO/MachOLinkingContext.cpp Sat Sep 20 23:13:45 2014
@@ -643,6 +643,8 @@ bool MachOLinkingContext::exportSymbolNa
return _exportedSymbols.count(sym);
case ExportMode::blackList:
return !_exportedSymbols.count(sym);
+ default:
+ llvm_unreachable("_exportMode unknown enum value");
}
}
Modified: lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp?rev=218197&r1=218196&r2=218197&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp (original)
+++ lld/trunk/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp Sat Sep 20 23:13:45 2014
@@ -719,6 +719,9 @@ std::error_code Util::getSymbolTableRegi
return std::error_code();
}
break;
+ default:
+ llvm_unreachable("atom->scope() unknown enum value");
+ return std::error_code();
}
}
More information about the llvm-commits
mailing list