From 003472894d20b1ab835da88416149590c93de2b4 Mon Sep 17 00:00:00 2001 From: Davide Italiano Date: Wed, 9 Nov 2016 21:30:33 +0000 Subject: [PATCH] [tools] Unbreak the GCC build (workaround a GCC bug). MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit ../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 --- tools/lli/lli.cpp | 3 ++- tools/llvm-extract/llvm-extract.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) 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()); }; -- 2.11.0