diff options
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/slice2confluence/Main.cpp | 37 | ||||
-rw-r--r-- | cpp/src/slice2cpp/Main.cpp | 34 | ||||
-rw-r--r-- | cpp/src/slice2cs/Main.cpp | 39 | ||||
-rw-r--r-- | cpp/src/slice2freeze/Main.cpp | 107 | ||||
-rw-r--r-- | cpp/src/slice2freezej/Main.cpp | 87 | ||||
-rw-r--r-- | cpp/src/slice2html/Main.cpp | 37 | ||||
-rw-r--r-- | cpp/src/slice2java/Main.cpp | 42 | ||||
-rw-r--r-- | cpp/src/slice2js/Main.cpp | 46 | ||||
-rw-r--r-- | cpp/src/slice2objc/Main.cpp | 34 | ||||
-rw-r--r-- | cpp/src/slice2php/Main.cpp | 37 |
10 files changed, 439 insertions, 61 deletions
diff --git a/cpp/src/slice2confluence/Main.cpp b/cpp/src/slice2confluence/Main.cpp index a3885d1ea8a..ca03ee4e829 100644 --- a/cpp/src/slice2confluence/Main.cpp +++ b/cpp/src/slice2confluence/Main.cpp @@ -85,6 +85,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" @@ -113,6 +114,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); @@ -132,6 +134,16 @@ compile(int argc, char* argv[]) opts.addOpt("", "ice"); opts.addOpt("", "underscore"); + bool validate = false; + for(int i = 0; i < argc; ++i) + { + if(string(argv[i]) == "--validate") + { + validate = true; + break; + } + } + vector<string> args; try { @@ -140,7 +152,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; } @@ -201,7 +216,10 @@ compile(int argc, char* argv[]) { getErrorStream() << argv[0] << ": error: the --index operation requires a positive integer argument" << endl; - usage(argv[0]); + if(!validate) + { + usage(argv[0]); + } return EXIT_FAILURE; } } @@ -222,7 +240,10 @@ compile(int argc, char* argv[]) { getErrorStream() << argv[0] << ": error: the --summary operation requires a positive integer argument" << endl; - usage(argv[0]); + if(!validate) + { + usage(argv[0]); + } return EXIT_FAILURE; } } @@ -236,10 +257,18 @@ 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(validate) + { + return EXIT_SUCCESS; + } + UnitPtr p = Unit::createUnit(true, false, ice, underscore); int status = EXIT_SUCCESS; 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; 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; diff --git a/cpp/src/slice2freeze/Main.cpp b/cpp/src/slice2freeze/Main.cpp index 5011c7a2662..487707d2e6d 100644 --- a/cpp/src/slice2freeze/Main.cpp +++ b/cpp/src/slice2freeze/Main.cpp @@ -197,6 +197,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]\n" @@ -1434,6 +1435,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); @@ -1454,6 +1456,16 @@ compile(int argc, char* argv[]) opts.addOpt("", "ice"); opts.addOpt("", "underscore"); + bool validate = false; + for(int i = 0; i < argc; ++i) + { + if(string(argv[i]) == "--validate") + { + validate = true; + break; + } + } + vector<string> args; try { @@ -1462,7 +1474,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; } @@ -1601,7 +1616,10 @@ compile(int argc, char* argv[]) { getErrorStream() << argv[0] << ": error: " << *i << ": nothing or ',sort' expected after value-type" << endl; - usage(argv[0]); + if(!validate) + { + usage(argv[0]); + } return EXIT_FAILURE; } dict.sort = true; @@ -1614,7 +1632,10 @@ compile(int argc, char* argv[]) { getErrorStream() << argv[0] << ": error: " << *i << ": nothing or ',sort' expected after value-type" << endl; - usage(argv[0]); + if(!validate) + { + usage(argv[0]); + } return EXIT_FAILURE; } dict.sort = true; @@ -1625,21 +1646,30 @@ compile(int argc, char* argv[]) if(dict.name.empty()) { getErrorStream() << argv[0] << ": error: " << *i << ": no name specified" << endl; - usage(argv[0]); + if(!validate) + { + usage(argv[0]); + } return EXIT_FAILURE; } if(dict.key.empty()) { getErrorStream() << argv[0] << ": error: " << *i << ": no key specified" << endl; - usage(argv[0]); + if(!validate) + { + usage(argv[0]); + } return EXIT_FAILURE; } if(dict.value.empty()) { getErrorStream() << argv[0] << ": error: " << *i << ": no value specified" << endl; - usage(argv[0]); + if(!validate) + { + usage(argv[0]); + } return EXIT_FAILURE; } @@ -1684,21 +1714,30 @@ compile(int argc, char* argv[]) if(index.name.empty()) { getErrorStream() << argv[0] << ": error: " << *i << ": no name specified" << endl; - usage(argv[0]); + if(!validate) + { + usage(argv[0]); + } return EXIT_FAILURE; } if(index.type.empty()) { getErrorStream() << argv[0] << ": error: " << *i << ": no type specified" << endl; - usage(argv[0]); + if(!validate) + { + usage(argv[0]); + } return EXIT_FAILURE; } if(index.member.empty()) { getErrorStream() << argv[0] << ": error: " << *i << ": no member specified" << endl; - usage(argv[0]); + if(!validate) + { + usage(argv[0]); + } return EXIT_FAILURE; } @@ -1706,7 +1745,10 @@ compile(int argc, char* argv[]) { getErrorStream() << argv[0] << ": error: " << *i << ": the case can be `case-sensitive' or " << "`case-insensitive'" << endl; - usage(argv[0]); + if(!validate) + { + usage(argv[0]); + } return EXIT_FAILURE; } index.caseSensitive = (caseString == "case-sensitive"); @@ -1766,7 +1808,10 @@ compile(int argc, char* argv[]) else { getErrorStream() << argv[0] << ": error: " << *i << ": syntax error" << endl; - usage(argv[0]); + if(!validate) + { + usage(argv[0]); + } return EXIT_FAILURE; } done = true; @@ -1804,7 +1849,10 @@ compile(int argc, char* argv[]) else { getErrorStream() << argv[0] << ": error: " << *i << ": syntax error" << endl; - usage(argv[0]); + if(!validate) + { + usage(argv[0]); + } return EXIT_FAILURE; } } @@ -1814,7 +1862,10 @@ compile(int argc, char* argv[]) if(dictName.empty()) { getErrorStream() << argv[0] << ": error: " << *i << ": no dictionary specified" << endl; - usage(argv[0]); + if(!validate) + { + usage(argv[0]); + } return EXIT_FAILURE; } @@ -1837,7 +1888,10 @@ compile(int argc, char* argv[]) if(!found) { getErrorStream() << argv[0] << ": error: " << *i << ": unknown dictionary" << endl; - usage(argv[0]); + if(!validate) + { + usage(argv[0]); + } return EXIT_FAILURE; } } @@ -1858,17 +1912,38 @@ compile(int argc, char* argv[]) if(dicts.empty() && indices.empty() && !(depend || dependxml)) { getErrorStream() << argv[0] << ": error: no Freeze types specified" << endl; - usage(argv[0]); + if(!validate) + { + usage(argv[0]); + } return EXIT_FAILURE; } if(args.empty()) { getErrorStream() << argv[0] << ": error: no file name base specified" << 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; + } + UnitPtr u = Unit::createUnit(true, false, ice, underscore); StringList includes; diff --git a/cpp/src/slice2freezej/Main.cpp b/cpp/src/slice2freezej/Main.cpp index 02543702fe6..bcfcccbb095 100644 --- a/cpp/src/slice2freezej/Main.cpp +++ b/cpp/src/slice2freezej/Main.cpp @@ -1417,6 +1417,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" @@ -1459,6 +1460,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); @@ -1476,6 +1478,16 @@ compile(int argc, char* argv[]) opts.addOpt("", "underscore"); opts.addOpt("", "meta", IceUtilInternal::Options::NeedArg, "", IceUtilInternal::Options::Repeat); + bool validate = false; + for(int i = 0; i < argc; ++i) + { + if(string(argv[i]) == "--validate") + { + validate = true; + break; + } + } + vector<string> args; try { @@ -1484,7 +1496,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; } @@ -1549,21 +1564,30 @@ compile(int argc, char* argv[]) if(dict.name.empty()) { getErrorStream() << argv[0] << ": error: " << *i << ": no name specified" << endl; - usage(argv[0]); + if(!validate) + { + usage(argv[0]); + } return EXIT_FAILURE; } if(dict.key.empty()) { getErrorStream() << argv[0] << ": error: " << *i << ": no key specified" << endl; - usage(argv[0]); + if(!validate) + { + usage(argv[0]); + } return EXIT_FAILURE; } if(dict.value.empty()) { getErrorStream() << argv[0] << ": error: " << *i << ": no value specified" << endl; - usage(argv[0]); + if(!validate) + { + usage(argv[0]); + } return EXIT_FAILURE; } @@ -1608,21 +1632,30 @@ compile(int argc, char* argv[]) if(index.name.empty()) { getErrorStream() << argv[0] << ": error: " << *i << ": no name specified" << endl; - usage(argv[0]); + if(!validate) + { + usage(argv[0]); + } return EXIT_FAILURE; } if(index.type.empty()) { getErrorStream() << argv[0] << ": error: " << *i << ": no type specified" << endl; - usage(argv[0]); + if(!validate) + { + usage(argv[0]); + } return EXIT_FAILURE; } if(index.member.empty()) { getErrorStream() << argv[0] << ": error: " << *i << ": no member specified" << endl; - usage(argv[0]); + if(!validate) + { + usage(argv[0]); + } return EXIT_FAILURE; } @@ -1630,7 +1663,10 @@ compile(int argc, char* argv[]) { getErrorStream() << argv[0] << ": error: " << *i << ": the case can be `case-sensitive' or " << "`case-insensitive'" << endl; - usage(argv[0]); + if(!validate) + { + usage(argv[0]); + } return EXIT_FAILURE; } index.caseSensitive = (caseString == "case-sensitive"); @@ -1683,7 +1719,10 @@ compile(int argc, char* argv[]) if(dictName.empty()) { getErrorStream() << argv[0] << ": error: " << *i << ": no dictionary specified" << endl; - usage(argv[0]); + if(!validate) + { + usage(argv[0]); + } return EXIT_FAILURE; } @@ -1691,7 +1730,10 @@ compile(int argc, char* argv[]) { getErrorStream() << argv[0] << ": error: " << *i << ": the case can be `case-sensitive' or " << "`case-insensitive'" << endl; - usage(argv[0]); + if(!validate) + { + usage(argv[0]); + } return EXIT_FAILURE; } index.caseSensitive = (caseString == "case-sensitive"); @@ -1716,7 +1758,10 @@ compile(int argc, char* argv[]) if(!found) { getErrorStream() << argv[0] << ": error: " << *i << ": unknown dictionary" << endl; - usage(argv[0]); + if(!validate) + { + usage(argv[0]); + } return EXIT_FAILURE; } } @@ -1742,10 +1787,28 @@ compile(int argc, char* argv[]) if(dicts.empty() && indices.empty() && !(depend || dependxml)) { getErrorStream() << argv[0] << ": error: no Freeze types specified" << 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; + } + UnitPtr u = Unit::createUnit(true, false, ice, underscore, globalMetadata); int status = EXIT_SUCCESS; diff --git a/cpp/src/slice2html/Main.cpp b/cpp/src/slice2html/Main.cpp index 3b03ff9493c..905bb773a0c 100644 --- a/cpp/src/slice2html/Main.cpp +++ b/cpp/src/slice2html/Main.cpp @@ -63,6 +63,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" @@ -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("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); @@ -108,6 +110,16 @@ compile(int argc, char* argv[]) opts.addOpt("", "ice"); opts.addOpt("", "underscore"); + bool validate = false; + for(int i = 0; i < argc; ++i) + { + if(string(argv[i]) == "--validate") + { + validate = true; + break; + } + } + vector<string> args; try { @@ -116,7 +128,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; } @@ -173,7 +188,10 @@ compile(int argc, char* argv[]) { getErrorStream() << argv[0] << ": error: the --index operation requires a positive integer argument" << endl; - usage(argv[0]); + if(!validate) + { + usage(argv[0]); + } return EXIT_FAILURE; } } @@ -194,7 +212,10 @@ compile(int argc, char* argv[]) { getErrorStream() << argv[0] << ": error: the --summary operation requires a positive integer argument" << endl; - usage(argv[0]); + if(!validate) + { + usage(argv[0]); + } return EXIT_FAILURE; } } @@ -208,10 +229,18 @@ 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(validate) + { + return EXIT_SUCCESS; + } + UnitPtr p = Unit::createUnit(true, false, ice, underscore); int status = EXIT_SUCCESS; diff --git a/cpp/src/slice2java/Main.cpp b/cpp/src/slice2java/Main.cpp index 08260523a77..de53ef640da 100644 --- a/cpp/src/slice2java/Main.cpp +++ b/cpp/src/slice2java/Main.cpp @@ -62,6 +62,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" @@ -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("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); @@ -109,6 +111,16 @@ compile(int argc, char* argv[]) opts.addOpt("", "stream"); opts.addOpt("", "meta", IceUtilInternal::Options::NeedArg, "", IceUtilInternal::Options::Repeat); + + bool validate = false; + for(int i = 0; i < argc; ++i) + { + if(string(argv[i]) == "--validate") + { + validate = true; + break; + } + } vector<string>args; try { @@ -117,7 +129,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; } @@ -185,17 +200,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 --depend-xml" << endl; + if(!validate) + { + usage(argv[0]); + } return EXIT_FAILURE; } + if(validate) + { + return EXIT_SUCCESS; + } + int status = EXIT_SUCCESS; ChecksumMap checksums; diff --git a/cpp/src/slice2js/Main.cpp b/cpp/src/slice2js/Main.cpp index 19131901d7c..24ef47ef325 100644 --- a/cpp/src/slice2js/Main.cpp +++ b/cpp/src/slice2js/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" @@ -84,6 +85,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); @@ -98,6 +100,16 @@ compile(int argc, char* argv[]) opts.addOpt("", "ice"); opts.addOpt("", "underscore"); + bool validate = false; + for(int i = 0; i < argc; ++i) + { + if(string(argv[i]) == "--validate") + { + validate = true; + break; + } + } + vector<string> args; try { @@ -106,7 +118,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; } @@ -164,31 +179,48 @@ 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 && dependJSON) { getErrorStream() << argv[0] << ": error: cannot specify both --depend and --depend-json" << 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(dependxml && dependJSON) { - getErrorStream() << argv[0] << ": error: cannot specify both --dependxml and --depend-json" << endl; - usage(argv[0]); + getErrorStream() << argv[0] << ": error: cannot specify both --depend-xml and --depend-json" << endl; + if(!validate) + { + usage(argv[0]); + } return EXIT_FAILURE; } + if(validate) + { + return EXIT_SUCCESS; + } + int status = EXIT_SUCCESS; IceUtil::CtrlCHandler ctrlCHandler; diff --git a/cpp/src/slice2objc/Main.cpp b/cpp/src/slice2objc/Main.cpp index 4dc9a2d042e..cd84a4bf6a6 100644 --- a/cpp/src/slice2objc/Main.cpp +++ b/cpp/src/slice2objc/Main.cpp @@ -60,6 +60,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" @@ -84,6 +85,7 @@ main(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); @@ -99,6 +101,16 @@ main(int argc, char* argv[]) opts.addOpt("", "underscore"); opts.addOpt("", "case-sensitive"); + bool validate = false; + for(int i = 0; i < argc; ++i) + { + if(string(argv[i]) == "--validate") + { + validate = true; + break; + } + } + vector<string> args; try { @@ -107,7 +119,10 @@ main(int argc, char* argv[]) catch(const IceUtilInternal::BadOptException& e) { cerr << argv[0] << ": " << e.reason << endl; - usage(argv[0]); + if(!validate) + { + usage(argv[0]); + } return EXIT_FAILURE; } @@ -164,17 +179,28 @@ main(int argc, char* argv[]) if(args.empty()) { getErrorStream() << argv[0] << ": 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; DependOutputUtil out(dependFile); 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; |