From e1605c7fc18ef05c35d8abbc7f538b66205ebade Mon Sep 17 00:00:00 2001 From: Marc Laukien Date: Thu, 19 Jul 2001 18:03:12 +0000 Subject: error checking --- cpp/src/slice2cpp/Main.cpp | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'cpp/src/slice2cpp/Main.cpp') diff --git a/cpp/src/slice2cpp/Main.cpp b/cpp/src/slice2cpp/Main.cpp index 98c21ca0058..5ca04edff48 100644 --- a/cpp/src/slice2cpp/Main.cpp +++ b/cpp/src/slice2cpp/Main.cpp @@ -128,6 +128,8 @@ main(int argc, char* argv[]) return EXIT_FAILURE; } + int status = EXIT_SUCCESS; + for(idx = 1 ; idx < argc ; ++idx) { string base(argv[idx]); @@ -169,7 +171,7 @@ main(int argc, char* argv[]) } Unit_ptr unit = Unit::createUnit(false, false); - int status = unit -> parse(cppHandle, debug); + int parseStatus = unit -> parse(cppHandle, debug); #ifdef WIN32 _pclose(cppHandle); @@ -177,16 +179,20 @@ main(int argc, char* argv[]) pclose(cppHandle); #endif - if(status == EXIT_FAILURE) - return status; - - Gen gen(argv[0], base, include, includePaths, dllExport); - if(!gen) - return EXIT_FAILURE; - gen.generate(unit); + if(parseStatus == EXIT_FAILURE) + { + status = EXIT_FAILURE; + } + else + { + Gen gen(argv[0], base, include, includePaths, dllExport); + if(!gen) + status = EXIT_FAILURE; + gen.generate(unit); + } unit -> destroy(); } - return EXIT_SUCCESS; + return status; } -- cgit v1.2.3