summaryrefslogtreecommitdiff
path: root/cpp/src/slice2cs
diff options
context:
space:
mode:
authorDwayne Boone <dwayne@zeroc.com>2015-07-07 12:31:56 -0230
committerDwayne Boone <dwayne@zeroc.com>2015-07-07 12:31:56 -0230
commitc81f1710fef57b952e1272f4126407e04c2e2d92 (patch)
tree18ab78f2218cf182b063ba77b4c1a9ffb8675bf8 /cpp/src/slice2cs
parentICE-6641 Removed some uneeded clean rules from Makefiles (diff)
downloadice-c81f1710fef57b952e1272f4126407e04c2e2d92.tar.bz2
ice-c81f1710fef57b952e1272f4126407e04c2e2d92.tar.xz
ice-c81f1710fef57b952e1272f4126407e04c2e2d92.zip
ICE-6469 added --validate option to Slice compilers
Diffstat (limited to 'cpp/src/slice2cs')
-rw-r--r--cpp/src/slice2cs/Main.cpp39
1 files changed, 34 insertions, 5 deletions
diff --git a/cpp/src/slice2cs/Main.cpp b/cpp/src/slice2cs/Main.cpp
index b7de6421c86..39c340d329e 100644
--- a/cpp/src/slice2cs/Main.cpp
+++ b/cpp/src/slice2cs/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"
"-DNAME Define NAME as 1.\n"
"-DNAME=DEF Define NAME as DEF.\n"
"-UNAME Remove any definition for NAME.\n"
@@ -87,6 +88,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);
@@ -104,6 +106,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
{
@@ -112,7 +124,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;
}
@@ -176,24 +191,38 @@ 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(impl && implTie)
{
getErrorStream() << argv[0] << ": error: cannot specify both --impl and --impl-tie" << 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;