Reid Spencer | 5c56dc1 | 2004-08-13 20:22:43 +0000 | [diff] [blame] | 1 | //===--- llvmc.cpp - The LLVM Compiler Driver -------------------*- C++ -*-===// |
Reid Spencer | 034a544 | 2004-08-10 16:26:01 +0000 | [diff] [blame] | 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Reid Spencer | 5c56dc1 | 2004-08-13 20:22:43 +0000 | [diff] [blame] | 5 | // This file was developed by Reid Spencer and is distributed under the |
Reid Spencer | 034a544 | 2004-08-10 16:26:01 +0000 | [diff] [blame] | 6 | // University of Illinois Open Source License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This tool provides a single point of access to the LLVM compilation tools. |
| 11 | // It has many options. To discover the options supported please refer to the |
| 12 | // tools' manual page (docs/CommandGuide/html/llvmc.html) or run the tool with |
| 13 | // the --help option. |
| 14 | // |
| 15 | //===------------------------------------------------------------------------=== |
| 16 | |
Reid Spencer | abf1ce3 | 2004-08-10 16:29:18 +0000 | [diff] [blame] | 17 | #include "CompilerDriver.h" |
Reid Spencer | f51a87c | 2004-08-19 21:52:49 +0000 | [diff] [blame^] | 18 | #include "Configuration.h" |
Reid Spencer | 034a544 | 2004-08-10 16:26:01 +0000 | [diff] [blame] | 19 | #include "llvm/System/Signals.h" |
| 20 | #include "Support/CommandLine.h" |
| 21 | #include <iostream> |
| 22 | |
| 23 | using namespace llvm; |
| 24 | |
Reid Spencer | 5c56dc1 | 2004-08-13 20:22:43 +0000 | [diff] [blame] | 25 | namespace { |
Reid Spencer | 034a544 | 2004-08-10 16:26:01 +0000 | [diff] [blame] | 26 | //===------------------------------------------------------------------------=== |
| 27 | //=== PHASE OPTIONS |
| 28 | //===------------------------------------------------------------------------=== |
Reid Spencer | bae6825 | 2004-08-19 04:49:47 +0000 | [diff] [blame] | 29 | cl::opt<CompilerDriver::Phases> FinalPhase( |
Reid Spencer | 034a544 | 2004-08-10 16:26:01 +0000 | [diff] [blame] | 30 | cl::desc("Choose final phase of compilation:"), |
Reid Spencer | 5c56dc1 | 2004-08-13 20:22:43 +0000 | [diff] [blame] | 31 | cl::init(CompilerDriver::LINKING), |
Reid Spencer | 034a544 | 2004-08-10 16:26:01 +0000 | [diff] [blame] | 32 | cl::values( |
| 33 | clEnumValN(CompilerDriver::PREPROCESSING,"E", |
Reid Spencer | 5c56dc1 | 2004-08-13 20:22:43 +0000 | [diff] [blame] | 34 | "Stop compilation after pre-processing phase"), |
| 35 | clEnumValN(CompilerDriver::TRANSLATION, "t", |
| 36 | "Stop compilation after translation phase"), |
Reid Spencer | 034a544 | 2004-08-10 16:26:01 +0000 | [diff] [blame] | 37 | clEnumValN(CompilerDriver::OPTIMIZATION,"c", |
Reid Spencer | 5c56dc1 | 2004-08-13 20:22:43 +0000 | [diff] [blame] | 38 | "Stop compilation after optimization phase"), |
Reid Spencer | 034a544 | 2004-08-10 16:26:01 +0000 | [diff] [blame] | 39 | clEnumValN(CompilerDriver::ASSEMBLY,"S", |
Reid Spencer | 5c56dc1 | 2004-08-13 20:22:43 +0000 | [diff] [blame] | 40 | "Stop compilation after assembly phase"), |
Reid Spencer | 034a544 | 2004-08-10 16:26:01 +0000 | [diff] [blame] | 41 | clEnumValEnd |
| 42 | ) |
| 43 | ); |
| 44 | |
| 45 | //===------------------------------------------------------------------------=== |
| 46 | //=== OPTIMIZATION OPTIONS |
| 47 | //===------------------------------------------------------------------------=== |
Reid Spencer | bae6825 | 2004-08-19 04:49:47 +0000 | [diff] [blame] | 48 | cl::opt<CompilerDriver::OptimizationLevels> OptLevel( |
Reid Spencer | 034a544 | 2004-08-10 16:26:01 +0000 | [diff] [blame] | 49 | cl::desc("Choose level of optimization to apply:"), |
Reid Spencer | 5c56dc1 | 2004-08-13 20:22:43 +0000 | [diff] [blame] | 50 | cl::init(CompilerDriver::OPT_FAST_COMPILE), |
Reid Spencer | 034a544 | 2004-08-10 16:26:01 +0000 | [diff] [blame] | 51 | cl::values( |
| 52 | clEnumValN(CompilerDriver::OPT_FAST_COMPILE,"O0", |
Reid Spencer | 5c56dc1 | 2004-08-13 20:22:43 +0000 | [diff] [blame] | 53 | "An alias for the -O1 option."), |
Reid Spencer | 034a544 | 2004-08-10 16:26:01 +0000 | [diff] [blame] | 54 | clEnumValN(CompilerDriver::OPT_FAST_COMPILE,"O1", |
| 55 | "Optimize for compilation speed, not execution speed."), |
| 56 | clEnumValN(CompilerDriver::OPT_SIMPLE,"O2", |
| 57 | "Perform simple translation time optimizations"), |
| 58 | clEnumValN(CompilerDriver::OPT_AGGRESSIVE,"O3", |
| 59 | "Perform aggressive translation time optimizations"), |
| 60 | clEnumValN(CompilerDriver::OPT_LINK_TIME,"O4", |
| 61 | "Perform link time optimizations"), |
| 62 | clEnumValN(CompilerDriver::OPT_AGGRESSIVE_LINK_TIME,"O5", |
| 63 | "Perform aggressive link time optimizations"), |
| 64 | clEnumValEnd |
| 65 | ) |
| 66 | ); |
| 67 | |
| 68 | //===------------------------------------------------------------------------=== |
| 69 | //=== TOOL OPTIONS |
| 70 | //===------------------------------------------------------------------------=== |
| 71 | |
Reid Spencer | bae6825 | 2004-08-19 04:49:47 +0000 | [diff] [blame] | 72 | cl::list<std::string> PreprocessorToolOpts("Tpre", cl::ZeroOrMore, |
Reid Spencer | 5c56dc1 | 2004-08-13 20:22:43 +0000 | [diff] [blame] | 73 | cl::desc("Pass specific options to the pre-processor"), |
| 74 | cl::value_desc("option")); |
Reid Spencer | 034a544 | 2004-08-10 16:26:01 +0000 | [diff] [blame] | 75 | |
Reid Spencer | bae6825 | 2004-08-19 04:49:47 +0000 | [diff] [blame] | 76 | cl::list<std::string> TranslatorToolOpts("Ttrn", cl::ZeroOrMore, |
Reid Spencer | 5c56dc1 | 2004-08-13 20:22:43 +0000 | [diff] [blame] | 77 | cl::desc("Pass specific options to the assembler"), |
| 78 | cl::value_desc("option")); |
Reid Spencer | 034a544 | 2004-08-10 16:26:01 +0000 | [diff] [blame] | 79 | |
Reid Spencer | bae6825 | 2004-08-19 04:49:47 +0000 | [diff] [blame] | 80 | cl::list<std::string> AssemblerToolOpts("Tasm", cl::ZeroOrMore, |
Reid Spencer | bf43772 | 2004-08-15 08:19:46 +0000 | [diff] [blame] | 81 | cl::desc("Pass specific options to the assembler"), |
| 82 | cl::value_desc("option")); |
| 83 | |
Reid Spencer | bae6825 | 2004-08-19 04:49:47 +0000 | [diff] [blame] | 84 | cl::list<std::string> OptimizerToolOpts("Topt", cl::ZeroOrMore, |
Reid Spencer | 5c56dc1 | 2004-08-13 20:22:43 +0000 | [diff] [blame] | 85 | cl::desc("Pass specific options to the optimizer"), |
| 86 | cl::value_desc("option")); |
Reid Spencer | 034a544 | 2004-08-10 16:26:01 +0000 | [diff] [blame] | 87 | |
Reid Spencer | bae6825 | 2004-08-19 04:49:47 +0000 | [diff] [blame] | 88 | cl::list<std::string> LinkerToolOpts("Tlnk", cl::ZeroOrMore, |
Reid Spencer | 5c56dc1 | 2004-08-13 20:22:43 +0000 | [diff] [blame] | 89 | cl::desc("Pass specific options to the linker"), |
| 90 | cl::value_desc("option")); |
Reid Spencer | 034a544 | 2004-08-10 16:26:01 +0000 | [diff] [blame] | 91 | |
| 92 | //===------------------------------------------------------------------------=== |
| 93 | //=== INPUT OPTIONS |
| 94 | //===------------------------------------------------------------------------=== |
| 95 | |
Reid Spencer | bae6825 | 2004-08-19 04:49:47 +0000 | [diff] [blame] | 96 | cl::list<std::string> LibPaths("L", cl::Prefix, |
Reid Spencer | 034a544 | 2004-08-10 16:26:01 +0000 | [diff] [blame] | 97 | cl::desc("Specify a library search path"), cl::value_desc("directory")); |
| 98 | |
Reid Spencer | bae6825 | 2004-08-19 04:49:47 +0000 | [diff] [blame] | 99 | cl::list<std::string> Libraries("l", cl::Prefix, |
Reid Spencer | 034a544 | 2004-08-10 16:26:01 +0000 | [diff] [blame] | 100 | cl::desc("Specify libraries to link to"), cl::value_desc("library prefix")); |
| 101 | |
| 102 | |
| 103 | //===------------------------------------------------------------------------=== |
| 104 | //=== OUTPUT OPTIONS |
| 105 | //===------------------------------------------------------------------------=== |
| 106 | |
Reid Spencer | bae6825 | 2004-08-19 04:49:47 +0000 | [diff] [blame] | 107 | cl::opt<std::string> OutputFilename("o", |
Reid Spencer | 034a544 | 2004-08-10 16:26:01 +0000 | [diff] [blame] | 108 | cl::desc("Override output filename"), cl::value_desc("filename")); |
| 109 | |
Reid Spencer | bae6825 | 2004-08-19 04:49:47 +0000 | [diff] [blame] | 110 | cl::opt<std::string> OutputMachine("m", cl::Prefix, |
Reid Spencer | 034a544 | 2004-08-10 16:26:01 +0000 | [diff] [blame] | 111 | cl::desc("Specify a target machine"), cl::value_desc("machine")); |
| 112 | |
Reid Spencer | bae6825 | 2004-08-19 04:49:47 +0000 | [diff] [blame] | 113 | cl::opt<bool> Native("native", cl::init(false), |
Reid Spencer | 034a544 | 2004-08-10 16:26:01 +0000 | [diff] [blame] | 114 | cl::desc("Generative native object and executables instead of bytecode")); |
| 115 | |
| 116 | //===------------------------------------------------------------------------=== |
| 117 | //=== INFORMATION OPTIONS |
| 118 | //===------------------------------------------------------------------------=== |
| 119 | |
Reid Spencer | bae6825 | 2004-08-19 04:49:47 +0000 | [diff] [blame] | 120 | cl::opt<bool> DryRun("dry-run", cl::Optional, cl::init(false), |
Reid Spencer | 5c56dc1 | 2004-08-13 20:22:43 +0000 | [diff] [blame] | 121 | cl::desc("Do everything but perform the compilation actions")); |
Reid Spencer | 034a544 | 2004-08-10 16:26:01 +0000 | [diff] [blame] | 122 | |
Reid Spencer | bae6825 | 2004-08-19 04:49:47 +0000 | [diff] [blame] | 123 | cl::alias DryRunAlias("y", cl::Optional, |
Reid Spencer | 5c56dc1 | 2004-08-13 20:22:43 +0000 | [diff] [blame] | 124 | cl::desc("Alias for -dry-run"), cl::aliasopt(DryRun)); |
Reid Spencer | 034a544 | 2004-08-10 16:26:01 +0000 | [diff] [blame] | 125 | |
Reid Spencer | bae6825 | 2004-08-19 04:49:47 +0000 | [diff] [blame] | 126 | cl::opt<bool> Verbose("verbose", cl::Optional, cl::init(false), |
Reid Spencer | 034a544 | 2004-08-10 16:26:01 +0000 | [diff] [blame] | 127 | cl::desc("Print out each action taken")); |
| 128 | |
Reid Spencer | bae6825 | 2004-08-19 04:49:47 +0000 | [diff] [blame] | 129 | cl::alias VerboseAlias("v", cl::Optional, |
Reid Spencer | 034a544 | 2004-08-10 16:26:01 +0000 | [diff] [blame] | 130 | cl::desc("Alias for -verbose"), cl::aliasopt(Verbose)); |
| 131 | |
Reid Spencer | bae6825 | 2004-08-19 04:49:47 +0000 | [diff] [blame] | 132 | cl::opt<bool> Debug("debug", cl::Optional, cl::init(false), |
Reid Spencer | 5c56dc1 | 2004-08-13 20:22:43 +0000 | [diff] [blame] | 133 | cl::Hidden, cl::desc("Print out debugging information")); |
| 134 | |
Reid Spencer | bae6825 | 2004-08-19 04:49:47 +0000 | [diff] [blame] | 135 | cl::alias DebugAlias("d", cl::Optional, |
Reid Spencer | 5c56dc1 | 2004-08-13 20:22:43 +0000 | [diff] [blame] | 136 | cl::desc("Alias for -debug"), cl::aliasopt(Debug)); |
| 137 | |
Reid Spencer | bae6825 | 2004-08-19 04:49:47 +0000 | [diff] [blame] | 138 | cl::opt<bool> TimeActions("time-actions", cl::Optional, cl::init(false), |
Reid Spencer | 034a544 | 2004-08-10 16:26:01 +0000 | [diff] [blame] | 139 | cl::desc("Print execution time for each action taken")); |
| 140 | |
Reid Spencer | bae6825 | 2004-08-19 04:49:47 +0000 | [diff] [blame] | 141 | cl::opt<bool> TimePasses("time-passes", cl::Optional, cl::init(false), |
| 142 | cl::desc("Print execution time for each optimization pass")); |
| 143 | |
| 144 | cl::opt<bool> ShowStats("stats", cl::Optional, cl::init(false), |
| 145 | cl::desc("Print statistics accumulated during optimization")); |
| 146 | |
Reid Spencer | 034a544 | 2004-08-10 16:26:01 +0000 | [diff] [blame] | 147 | //===------------------------------------------------------------------------=== |
| 148 | //=== ADVANCED OPTIONS |
| 149 | //===------------------------------------------------------------------------=== |
| 150 | |
Reid Spencer | 5c56dc1 | 2004-08-13 20:22:43 +0000 | [diff] [blame] | 151 | static cl::opt<std::string> ConfigDir("config-dir", cl::Optional, |
| 152 | cl::desc("Specify a configuration directory to override defaults"), |
| 153 | cl::value_desc("directory")); |
Reid Spencer | 034a544 | 2004-08-10 16:26:01 +0000 | [diff] [blame] | 154 | |
Reid Spencer | bf43772 | 2004-08-15 08:19:46 +0000 | [diff] [blame] | 155 | static cl::opt<bool> EmitRawCode("emit-raw-code", cl::Hidden, cl::Optional, |
Reid Spencer | 034a544 | 2004-08-10 16:26:01 +0000 | [diff] [blame] | 156 | cl::desc("Emit raw, unoptimized code")); |
| 157 | |
Reid Spencer | bf43772 | 2004-08-15 08:19:46 +0000 | [diff] [blame] | 158 | static cl::opt<bool> PipeCommands("pipe", cl::Optional, |
| 159 | cl::desc("Invoke sub-commands by linking input/output with pipes")); |
| 160 | |
Reid Spencer | bae6825 | 2004-08-19 04:49:47 +0000 | [diff] [blame] | 161 | static cl::opt<bool> KeepTemporaries("keep-temps", cl::Optional, |
| 162 | cl::desc("Don't delete the temporary files created during compilation")); |
| 163 | |
Reid Spencer | 034a544 | 2004-08-10 16:26:01 +0000 | [diff] [blame] | 164 | //===------------------------------------------------------------------------=== |
| 165 | //=== POSITIONAL OPTIONS |
| 166 | //===------------------------------------------------------------------------=== |
| 167 | |
| 168 | static cl::list<std::string> Files(cl::Positional, cl::OneOrMore, |
Reid Spencer | 5c56dc1 | 2004-08-13 20:22:43 +0000 | [diff] [blame] | 169 | cl::desc("[Sources/objects/libraries]")); |
| 170 | |
| 171 | static cl::list<std::string> Languages("x", cl::ZeroOrMore, |
| 172 | cl::desc("Specify the source language for subsequent files"), |
| 173 | cl::value_desc("language")); |
| 174 | |
| 175 | //===------------------------------------------------------------------------=== |
| 176 | //=== GetFileType - determine type of a file |
| 177 | //===------------------------------------------------------------------------=== |
| 178 | const std::string GetFileType(const std::string& fname, unsigned pos ) { |
| 179 | static std::vector<std::string>::iterator langIt = Languages.begin(); |
| 180 | static std::string CurrLang = ""; |
| 181 | |
| 182 | // If a -x LANG option has been specified .. |
| 183 | if ( langIt != Languages.end() ) |
| 184 | // If the -x LANG option came before the current file on command line |
| 185 | if ( Languages.getPosition( langIt - Languages.begin() ) < pos ) { |
| 186 | // use that language |
| 187 | CurrLang = *langIt++; |
| 188 | return CurrLang; |
| 189 | } |
| 190 | |
| 191 | // If there's a current language in effect |
| 192 | if (!CurrLang.empty()) |
| 193 | return CurrLang; // use that language |
| 194 | |
| 195 | // otherwise just determine lang from the filename's suffix |
| 196 | return fname.substr( fname.rfind('.',fname.size()) + 1 ); |
| 197 | } |
| 198 | |
| 199 | } // end anonymous namespace |
Reid Spencer | 034a544 | 2004-08-10 16:26:01 +0000 | [diff] [blame] | 200 | |
| 201 | |
| 202 | /// @brief The main program for llvmc |
| 203 | int main(int argc, char **argv) { |
Reid Spencer | bae6825 | 2004-08-19 04:49:47 +0000 | [diff] [blame] | 204 | try { |
| 205 | // Make sure we print stack trace if we get bad signals |
| 206 | PrintStackTraceOnErrorSignal(); |
Reid Spencer | 034a544 | 2004-08-10 16:26:01 +0000 | [diff] [blame] | 207 | |
Reid Spencer | bae6825 | 2004-08-19 04:49:47 +0000 | [diff] [blame] | 208 | // Parse the command line options |
| 209 | cl::ParseCommandLineOptions(argc, argv, |
| 210 | " LLVM Compilation Driver (llvmc)\n\n" |
| 211 | " This program provides easy invocation of the LLVM tool set\n" |
| 212 | " and source language compiler tools.\n" |
| 213 | ); |
Reid Spencer | 034a544 | 2004-08-10 16:26:01 +0000 | [diff] [blame] | 214 | |
Reid Spencer | bae6825 | 2004-08-19 04:49:47 +0000 | [diff] [blame] | 215 | // Deal with unimplemented options. |
| 216 | if (PipeCommands) |
| 217 | std::cerr << argv[0] << ": Not implemented yet: -pipe"; |
Reid Spencer | 034a544 | 2004-08-10 16:26:01 +0000 | [diff] [blame] | 218 | |
Reid Spencer | bae6825 | 2004-08-19 04:49:47 +0000 | [diff] [blame] | 219 | // Default the output file, only if we're going to try to link |
| 220 | if (OutputFilename.empty() && OptLevel == CompilerDriver::LINKING) |
| 221 | OutputFilename = "a.out"; |
Reid Spencer | 5c56dc1 | 2004-08-13 20:22:43 +0000 | [diff] [blame] | 222 | |
Reid Spencer | bae6825 | 2004-08-19 04:49:47 +0000 | [diff] [blame] | 223 | // Construct the ConfigDataProvider object |
| 224 | LLVMC_ConfigDataProvider Provider; |
| 225 | Provider.setConfigDir(ConfigDir); |
Reid Spencer | 5c56dc1 | 2004-08-13 20:22:43 +0000 | [diff] [blame] | 226 | |
Reid Spencer | bae6825 | 2004-08-19 04:49:47 +0000 | [diff] [blame] | 227 | // Construct the CompilerDriver object |
| 228 | CompilerDriver CD(Provider); |
Reid Spencer | 5c56dc1 | 2004-08-13 20:22:43 +0000 | [diff] [blame] | 229 | |
Reid Spencer | bae6825 | 2004-08-19 04:49:47 +0000 | [diff] [blame] | 230 | // Configure the driver based on options |
| 231 | CD.setVerbose(Verbose); |
| 232 | CD.setDebug(Debug); |
| 233 | CD.setDryRun(DryRun); |
| 234 | CD.setFinalPhase(FinalPhase); |
| 235 | CD.setOptimization(OptLevel); |
| 236 | CD.setOutputMachine(OutputMachine); |
| 237 | CD.setEmitNativeCode(Native); |
| 238 | CD.setEmitRawCode(EmitRawCode); |
| 239 | CD.setTimeActions(TimeActions); |
| 240 | CD.setTimePasses(TimePasses); |
| 241 | CD.setShowStats(ShowStats); |
| 242 | CD.setKeepTemporaries(KeepTemporaries); |
| 243 | CD.setLibraryPaths(LibPaths); |
| 244 | if (!PreprocessorToolOpts.empty()) |
| 245 | CD.setPhaseArgs(CompilerDriver::PREPROCESSING, PreprocessorToolOpts); |
| 246 | if (!TranslatorToolOpts.empty()) |
| 247 | CD.setPhaseArgs(CompilerDriver::TRANSLATION, TranslatorToolOpts); |
| 248 | if (!OptimizerToolOpts.empty()) |
| 249 | CD.setPhaseArgs(CompilerDriver::OPTIMIZATION, OptimizerToolOpts); |
| 250 | if (!AssemblerToolOpts.empty()) |
| 251 | CD.setPhaseArgs(CompilerDriver::ASSEMBLY,AssemblerToolOpts); |
| 252 | if (!LinkerToolOpts.empty()) |
| 253 | CD.setPhaseArgs(CompilerDriver::LINKING, LinkerToolOpts); |
Reid Spencer | 5c56dc1 | 2004-08-13 20:22:43 +0000 | [diff] [blame] | 254 | |
Reid Spencer | bae6825 | 2004-08-19 04:49:47 +0000 | [diff] [blame] | 255 | // Prepare the list of files to be compiled by the CompilerDriver. |
| 256 | CompilerDriver::InputList InpList; |
| 257 | std::vector<std::string>::iterator fileIt = Files.begin(); |
| 258 | std::vector<std::string>::iterator libIt = Libraries.begin(); |
| 259 | unsigned libPos = 0, filePos = 0; |
| 260 | while ( 1 ) { |
| 261 | if ( libIt != Libraries.end() ) |
| 262 | libPos = Libraries.getPosition( libIt - Libraries.begin() ); |
| 263 | else |
| 264 | libPos = 0; |
| 265 | if ( fileIt != Files.end() ) |
| 266 | filePos = Files.getPosition( fileIt - Files.begin() ); |
| 267 | else |
| 268 | filePos = 0; |
Reid Spencer | 5c56dc1 | 2004-08-13 20:22:43 +0000 | [diff] [blame] | 269 | |
Reid Spencer | bae6825 | 2004-08-19 04:49:47 +0000 | [diff] [blame] | 270 | if ( filePos != 0 && (libPos == 0 || filePos < libPos) ) { |
| 271 | // Add a source file |
| 272 | InpList.push_back( std::make_pair(*fileIt, GetFileType(*fileIt,filePos))); |
| 273 | ++fileIt; |
| 274 | } |
| 275 | else if ( libPos != 0 && (filePos == 0 || libPos < filePos) ) { |
| 276 | // Add a library |
| 277 | InpList.push_back( std::make_pair(*libIt++,"")); |
| 278 | } |
| 279 | else |
| 280 | break; // we're done with the list |
Reid Spencer | 5c56dc1 | 2004-08-13 20:22:43 +0000 | [diff] [blame] | 281 | } |
Reid Spencer | bae6825 | 2004-08-19 04:49:47 +0000 | [diff] [blame] | 282 | |
| 283 | // Tell the driver to do its thing |
| 284 | int result = CD.execute(InpList,OutputFilename); |
| 285 | if (result != 0) { |
| 286 | std::cerr << argv[0] << ": Error executing actions. Terminated.\n"; |
| 287 | return result; |
Reid Spencer | 5c56dc1 | 2004-08-13 20:22:43 +0000 | [diff] [blame] | 288 | } |
Reid Spencer | 034a544 | 2004-08-10 16:26:01 +0000 | [diff] [blame] | 289 | |
Reid Spencer | bae6825 | 2004-08-19 04:49:47 +0000 | [diff] [blame] | 290 | // All is good, return success |
| 291 | return 0; |
| 292 | } catch (std::string& msg) { |
| 293 | std::cerr << msg << "\n"; |
| 294 | } catch (...) { |
| 295 | std::cerr << "Unexpected unknown exception occurred.\n"; |
Reid Spencer | 034a544 | 2004-08-10 16:26:01 +0000 | [diff] [blame] | 296 | } |
Reid Spencer | 034a544 | 2004-08-10 16:26:01 +0000 | [diff] [blame] | 297 | } |