summaryrefslogtreecommitdiff
path: root/cpp/src/slice2cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/slice2cpp')
-rw-r--r--cpp/src/slice2cpp/Gen.cpp19
-rw-r--r--cpp/src/slice2cpp/Main.cpp7
2 files changed, 26 insertions, 0 deletions
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp
index 93ff60c61b2..3225095bfa8 100644
--- a/cpp/src/slice2cpp/Gen.cpp
+++ b/cpp/src/slice2cpp/Gen.cpp
@@ -136,6 +136,24 @@ Slice::Gen::generate(const Unit_ptr& unit)
H << "\n#include <" << changeInclude(*q) << ".h>";
}
+ H << sp;
+ H.zeroIndent();
+ H << "\n#ifndef ICE_IGNORE_VERSION";
+ H << "\n# if ICE_INT_VERSION != 0x" << hex << ICE_INT_VERSION;
+ H << "\n# error Ice version mismatch!";
+ H << "\n# endif";
+ H << "\n#endif";
+ H.restoreIndent();
+
+ C << sp;
+ C.zeroIndent();
+ C << "\n#ifndef ICE_IGNORE_VERSION";
+ C << "\n# if ICE_INT_VERSION != 0x" << hex << ICE_INT_VERSION;
+ C << "\n# error Ice version mismatch!";
+ C << "\n# endif";
+ C << "\n#endif";
+ C.restoreIndent();
+
ProxyDeclVisitor proxyDeclVisitor(H, C, dllExport_);
unit -> visit(&proxyDeclVisitor);
@@ -204,6 +222,7 @@ Slice::Gen::printHeader(Output& out)
out << header;
out << "\n// Generated from file `" << changeInclude(base_) << ".ice'";
+ out << "\n// Ice version " << ICE_STRING_VERSION;
out << '\n';
}
diff --git a/cpp/src/slice2cpp/Main.cpp b/cpp/src/slice2cpp/Main.cpp
index 16633aa5531..21575b54eb3 100644
--- a/cpp/src/slice2cpp/Main.cpp
+++ b/cpp/src/slice2cpp/Main.cpp
@@ -21,6 +21,7 @@ usage(const char* n)
cerr <<
"Options:\n"
"-h, --help Show this message.\n"
+"-v, --version Display the Ice version.\n"
"-DNAME Define NAME as 1.\n"
"-DNAME=DEF Define NAME as DEF.\n"
"-UNAME Remove any definition for NAME.\n"
@@ -72,6 +73,12 @@ main(int argc, char* argv[])
usage(argv[0]);
return EXIT_SUCCESS;
}
+ else if(strcmp(argv[idx], "-v") == 0 ||
+ strcmp(argv[idx], "--version") == 0)
+ {
+ cout << ICE_STRING_VERSION << endl;
+ return EXIT_SUCCESS;
+ }
else if(strcmp(argv[idx], "-d") == 0 ||
strcmp(argv[idx], "--debug") == 0)
{