summaryrefslogtreecommitdiff
path: root/cpp/src/slice2cpp/Main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/slice2cpp/Main.cpp')
-rw-r--r--cpp/src/slice2cpp/Main.cpp34
1 files changed, 30 insertions, 4 deletions
diff --git a/cpp/src/slice2cpp/Main.cpp b/cpp/src/slice2cpp/Main.cpp
index 3e6a9ee3584..c0da52fdaec 100644
--- a/cpp/src/slice2cpp/Main.cpp
+++ b/cpp/src/slice2cpp/Main.cpp
@@ -61,6 +61,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"
"--header-ext EXT Use EXT instead of the default `h' extension.\n"
"--source-ext EXT Use EXT instead of the default `cpp' extension.\n"
"--add-header HDR[,GUARD] Add #include for HDR (with guard GUARD) to generated source file.\n"
@@ -90,6 +91,7 @@ compile(int argc, char* argv[])
IceUtilInternal::Options opts;
opts.addOpt("h", "help");
opts.addOpt("v", "version");
+ opts.addOpt("", "validate");
opts.addOpt("", "header-ext", IceUtilInternal::Options::NeedArg, "h");
opts.addOpt("", "source-ext", IceUtilInternal::Options::NeedArg, "cpp");
opts.addOpt("", "add-header", IceUtilInternal::Options::NeedArg, "", IceUtilInternal::Options::Repeat);
@@ -110,6 +112,16 @@ compile(int argc, char* argv[])
opts.addOpt("", "checksum");
opts.addOpt("", "stream");
+ bool validate = false;
+ for(int i = 0; i < argc; ++i)
+ {
+ if(string(argv[i]) == "--validate")
+ {
+ validate = true;
+ break;
+ }
+ }
+
vector<string> args;
try
{
@@ -118,7 +130,10 @@ compile(int argc, char* argv[])
catch(const IceUtilInternal::BadOptException& e)
{
getErrorStream() << argv[0] << ": " << e.reason << endl;
- usage(argv[0]);
+ if(!validate)
+ {
+ usage(argv[0]);
+ }
return EXIT_FAILURE;
}
@@ -188,17 +203,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 --dependxml" << endl;
- usage(argv[0]);
+ 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;