[llvm-commits] CVS: llvm/lib/Support/CommandLine.cpp ToolRunner.cpp

Chris Lattner lattner at cs.uiuc.edu
Mon Jan 16 16:32:40 PST 2006



Changes in directory llvm/lib/Support:

CommandLine.cpp updated: 1.65 -> 1.66
ToolRunner.cpp updated: 1.46 -> 1.47
---
Log message:

Add support for programs with a null argv[0]


---
Diffs of the changes:  (+32 -10)

 CommandLine.cpp |   34 ++++++++++++++++++++++++----------
 ToolRunner.cpp  |    8 ++++++++
 2 files changed, 32 insertions(+), 10 deletions(-)


Index: llvm/lib/Support/CommandLine.cpp
diff -u llvm/lib/Support/CommandLine.cpp:1.65 llvm/lib/Support/CommandLine.cpp:1.66
--- llvm/lib/Support/CommandLine.cpp:1.65	Sun Dec 25 22:56:16 2005
+++ llvm/lib/Support/CommandLine.cpp	Mon Jan 16 18:32:28 2006
@@ -448,8 +448,11 @@
     }
 
     if (Handler == 0) {
-      std::cerr << ProgramName << ": Unknown command line argument '" << argv[i]
-                << "'.  Try: '" << argv[0] << " --help'\n";
+      if (ProgramName)
+        std::cerr << ProgramName << ": Unknown command line argument '"
+                  << argv[i] << "'.  Try: '" << argv[0] << " --help'\n";
+      else
+        std::cerr << "Unknown command line argument '" << argv[i] << "'.\n";
       ErrorParsing = true;
       continue;
     }
@@ -485,17 +488,28 @@
 
   // Check and handle positional arguments now...
   if (NumPositionalRequired > PositionalVals.size()) {
-    std::cerr << ProgramName
-              << ": Not enough positional command line arguments specified!\n"
-              << "Must specify at least " << NumPositionalRequired
-              << " positional arguments: See: " << argv[0] << " --help\n";
+    if (ProgramName)
+      std::cerr << ProgramName
+                << ": Not enough positional command line arguments specified!\n"
+                << "Must specify at least " << NumPositionalRequired
+                << " positional arguments: See: " << argv[0] << " --help\n";
+    else
+      std::cerr << "Not enough positional command line arguments specified!\n"
+                << "Must specify at least " << NumPositionalRequired
+                << " positional arguments.";
+    
     ErrorParsing = true;
   } else if (!HasUnlimitedPositionals
              && PositionalVals.size() > PositionalOpts.size()) {
-    std::cerr << ProgramName
-              << ": Too many positional arguments specified!\n"
-              << "Can specify at most " << PositionalOpts.size()
-              << " positional arguments: See: " << argv[0] << " --help\n";
+    if (ProgramName)
+      std::cerr << ProgramName
+                << ": Too many positional arguments specified!\n"
+                << "Can specify at most " << PositionalOpts.size()
+                << " positional arguments: See: " << argv[0] << " --help\n";
+    else
+      std::cerr << "Too many positional arguments specified!\n"
+                << "Can specify at most " << PositionalOpts.size()
+                << " positional arguments.\n";
     ErrorParsing = true;
 
   } else if (ConsumeAfterOpt == 0) {


Index: llvm/lib/Support/ToolRunner.cpp
diff -u llvm/lib/Support/ToolRunner.cpp:1.46 llvm/lib/Support/ToolRunner.cpp:1.47
--- llvm/lib/Support/ToolRunner.cpp:1.46	Mon Aug 29 08:14:24 2005
+++ llvm/lib/Support/ToolRunner.cpp	Mon Jan 16 18:32:28 2006
@@ -394,7 +394,15 @@
   sys::Path OutputBinary (ProgramFile+".gcc.exe");
   OutputBinary.makeUnique();
   GCCArgs.push_back(OutputBinary.c_str()); // Output to the right file...
+  GCCArgs.push_back("-lz");
   GCCArgs.push_back("-lm");                // Hard-code the math library...
+  GCCArgs.push_back("-x");
+  GCCArgs.push_back("none");
+  GCCArgs.push_back("/usr/local/lib/NAGWare/quickfit.o");
+  GCCArgs.push_back("-Xlinker");
+  GCCArgs.push_back("-flat_namespace");
+  GCCArgs.push_back("/usr/local/lib/NAGWare/libf97.dylib");
+  GCCArgs.push_back("/usr/local/lib/NAGWare/libf96.a");
   GCCArgs.push_back("-O2");                // Optimize the program a bit...
 #if defined (HAVE_LINK_R)
   GCCArgs.push_back("-Wl,-R.");            // Search this dir for .so files






More information about the llvm-commits mailing list