temporarily disable FORTIFY in header-abi-dumper
Bionic's FORTIFY implementation expects clang >= r285906, but header-abi-dumper uses external/clang, which is a clone of clang at r275480. This causes header-abi-dumper to emit errors in cases where clang-3688880 doesn't (e.g. unsigned char c[2]; // error: no matching function, since clang r275480 doesn't like // unsigned char * -> char * casts snprintf(c, sizeof(c), "a");). Bug: 36076947 Test: Ran header-abi-dumper on external/e2fsprogs/lib/blkid/probe.c (which previously gave us errors). It now only emits a few warnings. Change-Id: I9460853b7f94aeb154a4d921a852954d82394055
This commit is contained in:
@@ -61,13 +61,23 @@ static void HideIrrelevantCommandLineOptions() {
|
||||
int main(int argc, const char **argv) {
|
||||
HideIrrelevantCommandLineOptions();
|
||||
|
||||
// FIXME: Clang FORTIFY requires a version of clang at least as new as
|
||||
// clang-3688880 (r285906). Since external/clang is currently r275480, we need
|
||||
// to disable FORTIFY for this tool to function correctly.
|
||||
std::vector<const char *> fixedArgv(argv, argv + argc);
|
||||
fixedArgv.push_back("-U_FORTIFY_SOURCE");
|
||||
int fixedArgc = fixedArgv.size();
|
||||
|
||||
// Create compilation database from command line arguments after "--".
|
||||
std::unique_ptr<clang::tooling::CompilationDatabase> compilations(
|
||||
clang::tooling::FixedCompilationDatabase::loadFromCommandLine(
|
||||
argc, argv));
|
||||
fixedArgc, fixedArgv.data()));
|
||||
|
||||
// Parse the command line options.
|
||||
llvm::cl::ParseCommandLineOptions(argc, argv, "header-checker");
|
||||
// Note that loadFromCommandLine may alter fixedArgc, so we can't use
|
||||
// fixedArgv.size() here.
|
||||
llvm::cl::ParseCommandLineOptions(fixedArgc, fixedArgv.data(),
|
||||
"header-checker");
|
||||
|
||||
// Input header file existential check.
|
||||
if (!llvm::sys::fs::exists(header_file)) {
|
||||
|
||||
Reference in New Issue
Block a user