[llvm] r218048 - Alternative (to r216344) fix of gcc -Wpedantic.

Patrik Hagglund patrik.h.hagglund at ericsson.com
Thu Sep 18 04:52:57 PDT 2014


Author: patha
Date: Thu Sep 18 06:52:57 2014
New Revision: 218048

URL: http://llvm.org/viewvc/llvm-project?rev=218048&view=rev
Log:
Alternative (to r216344) fix of gcc -Wpedantic.

As suggested by David Blaikie, this may be easier to read.

The original warning was:

../tools/llvm-cov/llvm-cov.cpp:53:49: error: ISO C++ forbids zero-size array 'argv' [-Werror=pedantic]
       std::string Invocation(std::string(argv[0]) + " " + argv[1]);

It seems to be the case that GCC's warning gets confused and thinks
'argv' is a declaration here. GCC bugzilla issue #61259.

Modified:
    llvm/trunk/tools/llvm-cov/llvm-cov.cpp

Modified: llvm/trunk/tools/llvm-cov/llvm-cov.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cov/llvm-cov.cpp?rev=218048&r1=218047&r2=218048&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-cov/llvm-cov.cpp (original)
+++ llvm/trunk/tools/llvm-cov/llvm-cov.cpp Thu Sep 18 06:52:57 2014
@@ -50,7 +50,7 @@ int main(int argc, const char **argv) {
       func = gcov_main;
 
     if (func) {
-      std::string Invocation(std::string() + argv[0] + " " + argv[1]);
+      std::string Invocation = std::string(argv[0]) + " " + argv[1];
       argv[1] = Invocation.c_str();
       return func(argc - 1, argv + 1);
     }





More information about the llvm-commits mailing list