diff options
author | Michi Henning <michi@zeroc.com> | 2009-01-28 06:55:36 +1000 |
---|---|---|
committer | Michi Henning <michi@zeroc.com> | 2009-01-28 06:55:36 +1000 |
commit | 09b4a1830989b33d06e7a421dbf197d2aa335b91 (patch) | |
tree | 61a84913028a1d08a3dfa83f5b519ccda3fd1e9b /cpp/src/slice2cpp/Main.cpp | |
parent | http://bugzilla/bugzilla/show_bug.cgi?id=3483 - Move Freeze to separate Jar file (diff) | |
parent | Squashed commit of the following: (diff) | |
download | ice-09b4a1830989b33d06e7a421dbf197d2aa335b91.tar.bz2 ice-09b4a1830989b33d06e7a421dbf197d2aa335b91.tar.xz ice-09b4a1830989b33d06e7a421dbf197d2aa335b91.zip |
Merge branch 'R3_3_branch'
Diffstat (limited to 'cpp/src/slice2cpp/Main.cpp')
-rw-r--r-- | cpp/src/slice2cpp/Main.cpp | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/cpp/src/slice2cpp/Main.cpp b/cpp/src/slice2cpp/Main.cpp index 1cd6604766f..86eafe9e64f 100644 --- a/cpp/src/slice2cpp/Main.cpp +++ b/cpp/src/slice2cpp/Main.cpp @@ -11,6 +11,7 @@ #include <IceUtil/CtrlCHandler.h> #include <IceUtil/StaticMutex.h> #include <Slice/Preprocessor.h> +#include <Slice/FileTracker.h> #include <Gen.h> using namespace std; @@ -100,7 +101,7 @@ main(int argc, char* argv[]) if(opts.isSet("version")) { - cout << ICE_STRING_VERSION << endl; + cerr << ICE_STRING_VERSION << endl; return EXIT_SUCCESS; } @@ -168,12 +169,15 @@ main(int argc, char* argv[]) { if(depend) { - Preprocessor icecpp(argv[0], *i, cppArgs); - icecpp.printMakefileDependencies(Preprocessor::CPlusPlus, includePaths); + Preprocessor icecpp(argv[0], *i, cppArgs, sourceExtension); + if(!icecpp.printMakefileDependencies(Preprocessor::CPlusPlus, includePaths)) + { + return EXIT_FAILURE; + } } else { - Preprocessor icecpp(argv[0], *i, cppArgs); + Preprocessor icecpp(argv[0], *i, cppArgs, sourceExtension); FILE* cppHandle = icecpp.preprocess(false); if(cppHandle == 0) @@ -213,14 +217,21 @@ main(int argc, char* argv[]) } else { - Gen gen(argv[0], icecpp.getBaseName(), headerExtension, sourceExtension, extraHeaders, include, - includePaths, dllExport, output, impl, checksum, stream, ice); - if(!gen) + try + { + Gen gen(icecpp.getBaseName(), headerExtension, sourceExtension, extraHeaders, include, + includePaths, dllExport, output, impl, checksum, stream, ice); + gen.generate(u); + } + catch(const Slice::FileException& ex) { + // If a file could not be created, then + // cleanup any created files. + FileTracker::instance()->cleanup(); u->destroy(); + cerr << argv[0] << ": " << ex.reason() << endl; return EXIT_FAILURE; } - gen.generate(u); } u->destroy(); @@ -232,6 +243,7 @@ main(int argc, char* argv[]) if(_interrupted) { + FileTracker::instance()->cleanup(); return EXIT_FAILURE; } } |