diff options
Diffstat (limited to 'cpp/src/slice2php/Main.cpp')
-rw-r--r-- | cpp/src/slice2php/Main.cpp | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/cpp/src/slice2php/Main.cpp b/cpp/src/slice2php/Main.cpp index 2fe7a62701b..82a3dc40635 100644 --- a/cpp/src/slice2php/Main.cpp +++ b/cpp/src/slice2php/Main.cpp @@ -1577,6 +1577,7 @@ usage(const char* n) "Options:\n" "-h, --help Show this message.\n" "-v, --version Display the Ice version.\n" + "--validate Validate command line options.\n" "-DNAME Define NAME as 1.\n" "-DNAME=DEF Define NAME as DEF.\n" "-UNAME Remove any definition for NAME.\n" @@ -1601,6 +1602,7 @@ compile(int argc, char* argv[]) IceUtilInternal::Options opts; opts.addOpt("h", "help"); opts.addOpt("v", "version"); + opts.addOpt("", "validate"); opts.addOpt("D", "", IceUtilInternal::Options::NeedArg, "", IceUtilInternal::Options::Repeat); opts.addOpt("U", "", IceUtilInternal::Options::NeedArg, "", IceUtilInternal::Options::Repeat); opts.addOpt("I", "", IceUtilInternal::Options::NeedArg, "", IceUtilInternal::Options::Repeat); @@ -1616,6 +1618,16 @@ compile(int argc, char* argv[]) opts.addOpt("", "checksum"); opts.addOpt("n", "namespace"); + bool validate = false; + for(int i = 0; i < argc; ++i) + { + if(string(argv[i]) == "--validate") + { + validate = true; + break; + } + } + vector<string> args; try { @@ -1624,7 +1636,10 @@ compile(int argc, char* argv[]) catch(const IceUtilInternal::BadOptException& e) { getErrorStream() << argv[0] << ": error: " << e.reason << endl; - usage(argv[0]); + if(!validate) + { + usage(argv[0]); + } return EXIT_FAILURE; } @@ -1684,10 +1699,28 @@ compile(int argc, char* argv[]) if(args.empty()) { getErrorStream() << argv[0] << ": error: no input file" << endl; - usage(argv[0]); + if(!validate) + { + usage(argv[0]); + } return EXIT_FAILURE; } + if(depend && dependxml) + { + getErrorStream() << argv[0] << ": error: cannot specify both --depend and --depend-xml" << endl; + if(!validate) + { + usage(argv[0]); + } + return EXIT_FAILURE; + } + + if(validate) + { + return EXIT_SUCCESS; + } + int status = EXIT_SUCCESS; IceUtil::CtrlCHandler ctrlCHandler; |