]> granicus.if.org Git - clang/commitdiff
Add a workaround to silence a bogus g++-4.4 -pedantic warning.
authorBenjamin Kramer <benny.kra@googlemail.com>
Fri, 20 Nov 2009 11:49:06 +0000 (11:49 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Fri, 20 Nov 2009 11:49:06 +0000 (11:49 +0000)
driver.cpp:211: warning: ISO C++ forbids zero-size array 'argv'

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89455 91177308-0d34-0410-b5e6-96231b3b80d8

tools/driver/driver.cpp

index dbfc29365561f39b5c982cdc2392d00e717fbc05..c69b29c1ed5cdbba897af25bd98eec29951a2c25 100644 (file)
@@ -208,7 +208,9 @@ int main(int argc, const char **argv) {
   //
   // Note that we intentionally want to use argv[0] here, to support "clang++"
   // being a symlink.
-  std::string ProgName(llvm::sys::Path(argv[0]).getBasename());
+  //
+  // We use *argv instead of argv[0] to work around a bogus g++ warning.
+  std::string ProgName(llvm::sys::Path(*argv).getBasename());
   if (llvm::StringRef(ProgName).endswith("++") ||
       llvm::StringRef(ProgName).rsplit('-').first.endswith("++"))
     TheDriver.CCCIsCXX = true;