mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-28 04:33:05 +00:00
Add support for programs with a null argv[0]
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25379 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
42ef0bc6fb
commit
79959d21c7
@ -448,8 +448,11 @@ void cl::ParseCommandLineOptions(int &argc, char **argv,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Handler == 0) {
|
if (Handler == 0) {
|
||||||
std::cerr << ProgramName << ": Unknown command line argument '" << argv[i]
|
if (ProgramName)
|
||||||
<< "'. Try: '" << argv[0] << " --help'\n";
|
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;
|
ErrorParsing = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -485,17 +488,28 @@ void cl::ParseCommandLineOptions(int &argc, char **argv,
|
|||||||
|
|
||||||
// Check and handle positional arguments now...
|
// Check and handle positional arguments now...
|
||||||
if (NumPositionalRequired > PositionalVals.size()) {
|
if (NumPositionalRequired > PositionalVals.size()) {
|
||||||
std::cerr << ProgramName
|
if (ProgramName)
|
||||||
<< ": Not enough positional command line arguments specified!\n"
|
std::cerr << ProgramName
|
||||||
<< "Must specify at least " << NumPositionalRequired
|
<< ": Not enough positional command line arguments specified!\n"
|
||||||
<< " positional arguments: See: " << argv[0] << " --help\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;
|
ErrorParsing = true;
|
||||||
} else if (!HasUnlimitedPositionals
|
} else if (!HasUnlimitedPositionals
|
||||||
&& PositionalVals.size() > PositionalOpts.size()) {
|
&& PositionalVals.size() > PositionalOpts.size()) {
|
||||||
std::cerr << ProgramName
|
if (ProgramName)
|
||||||
<< ": Too many positional arguments specified!\n"
|
std::cerr << ProgramName
|
||||||
<< "Can specify at most " << PositionalOpts.size()
|
<< ": Too many positional arguments specified!\n"
|
||||||
<< " positional arguments: See: " << argv[0] << " --help\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;
|
ErrorParsing = true;
|
||||||
|
|
||||||
} else if (ConsumeAfterOpt == 0) {
|
} else if (ConsumeAfterOpt == 0) {
|
||||||
|
@ -394,7 +394,15 @@ int GCC::ExecuteProgram(const std::string &ProgramFile,
|
|||||||
sys::Path OutputBinary (ProgramFile+".gcc.exe");
|
sys::Path OutputBinary (ProgramFile+".gcc.exe");
|
||||||
OutputBinary.makeUnique();
|
OutputBinary.makeUnique();
|
||||||
GCCArgs.push_back(OutputBinary.c_str()); // Output to the right file...
|
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("-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...
|
GCCArgs.push_back("-O2"); // Optimize the program a bit...
|
||||||
#if defined (HAVE_LINK_R)
|
#if defined (HAVE_LINK_R)
|
||||||
GCCArgs.push_back("-Wl,-R."); // Search this dir for .so files
|
GCCArgs.push_back("-Wl,-R."); // Search this dir for .so files
|
||||||
|
@ -394,7 +394,15 @@ int GCC::ExecuteProgram(const std::string &ProgramFile,
|
|||||||
sys::Path OutputBinary (ProgramFile+".gcc.exe");
|
sys::Path OutputBinary (ProgramFile+".gcc.exe");
|
||||||
OutputBinary.makeUnique();
|
OutputBinary.makeUnique();
|
||||||
GCCArgs.push_back(OutputBinary.c_str()); // Output to the right file...
|
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("-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...
|
GCCArgs.push_back("-O2"); // Optimize the program a bit...
|
||||||
#if defined (HAVE_LINK_R)
|
#if defined (HAVE_LINK_R)
|
||||||
GCCArgs.push_back("-Wl,-R."); // Search this dir for .so files
|
GCCArgs.push_back("-Wl,-R."); // Search this dir for .so files
|
||||||
|
Loading…
Reference in New Issue
Block a user