From: Davide Italiano Date: Wed, 9 Nov 2016 21:30:33 +0000 (+0000) Subject: [tools] Unbreak the GCC build (workaround a GCC bug). X-Git-Tag: android-x86-7.1-r4~24751 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=003472894d20b1ab835da88416149590c93de2b4;p=android-x86%2Fexternal-llvm.git [tools] Unbreak the GCC build (workaround a GCC bug). ../tools/llvm-extract/llvm-extract.cpp: In function ‘int main(int, char**)’: warning: ISO C++ forbids zero-size array ‘argv’ [-Wpedantic] GCC reference bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61259 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286396 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/tools/lli/lli.cpp b/tools/lli/lli.cpp index 7923e8fe42d..605893e0ba2 100644 --- a/tools/lli/lli.cpp +++ b/tools/lli/lli.cpp @@ -418,7 +418,8 @@ int main(int argc, char **argv, char * const *envp) { // If not jitting lazily, load the whole bitcode file eagerly too. if (NoLazyCompilation) { - ExitOnError ExitOnErr(std::string(argv[0]) + + // Use *argv instead of argv[0] to work around a wrong GCC warning. + ExitOnError ExitOnErr(std::string(*argv) + ": bitcode didn't read correctly: "); ExitOnErr(Mod->materializeAll()); } diff --git a/tools/llvm-extract/llvm-extract.cpp b/tools/llvm-extract/llvm-extract.cpp index e576d0893bf..aa1eda2f094 100644 --- a/tools/llvm-extract/llvm-extract.cpp +++ b/tools/llvm-extract/llvm-extract.cpp @@ -223,7 +223,8 @@ int main(int argc, char **argv) { } } - ExitOnError ExitOnErr(std::string(argv[0]) + ": error reading input: "); + // Use *argv instead of argv[0] to work around a wrong GCC warning. + ExitOnError ExitOnErr(std::string(*argv) + ": error reading input: "); auto Materialize = [&](GlobalValue &GV) { ExitOnErr(GV.materialize()); };