diff options
author | Bernard Normier <bernard@zeroc.com> | 2016-10-31 15:54:21 -0400 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2016-10-31 15:54:21 -0400 |
commit | 107e03ea13e0eba9c33f120f0d95ac9fefc7dcad (patch) | |
tree | 00191b7ccb83fe436ad61bdbb43b523f431c6698 /cpp/src/Slice | |
parent | Update 3.7 changelog (diff) | |
download | ice-107e03ea13e0eba9c33f120f0d95ac9fefc7dcad.tar.bz2 ice-107e03ea13e0eba9c33f120f0d95ac9fefc7dcad.tar.xz ice-107e03ea13e0eba9c33f120f0d95ac9fefc7dcad.zip |
Replaced slice compiler options --ice, --underscore and --dll-export by
global metadata directives (ice-prefix, underscore, cpp:dll-export:SYMBOL and objc:dll-export:SYMBOL)
Added new cs:tie and java:tie metadata
Diffstat (limited to 'cpp/src/Slice')
-rw-r--r-- | cpp/src/Slice/JavaUtil.cpp | 13 | ||||
-rw-r--r-- | cpp/src/Slice/Parser.cpp | 33 | ||||
-rw-r--r-- | cpp/src/Slice/Python.cpp | 6 | ||||
-rw-r--r-- | cpp/src/Slice/Ruby.cpp | 6 |
4 files changed, 42 insertions, 16 deletions
diff --git a/cpp/src/Slice/JavaUtil.cpp b/cpp/src/Slice/JavaUtil.cpp index ad8d3628d65..0a20815d592 100644 --- a/cpp/src/Slice/JavaUtil.cpp +++ b/cpp/src/Slice/JavaUtil.cpp @@ -164,10 +164,15 @@ public: bool ok = false; static const string packagePrefix = "java:package:"; + static const string checksumPrefix = "java:checksum:"; if(s.find(packagePrefix) == 0 && s.size() > packagePrefix.size()) { ok = true; } + else if(s.find(checksumPrefix) == 0 && s.size() > checksumPrefix.size()) + { + ok = true; + } if(!ok) { @@ -369,12 +374,18 @@ private: if(rest == "getset") { result.push_back(s); + continue; } else if(rest == "buffer") { result.push_back(s); + continue; + } + else if(rest == "tie") + { + result.push_back(s); + continue; } - continue; } } else if(s.substr(prefix.size(), pos - prefix.size()) == "type") diff --git a/cpp/src/Slice/Parser.cpp b/cpp/src/Slice/Parser.cpp index e1a88c3f559..e6e8fb768a6 100644 --- a/cpp/src/Slice/Parser.cpp +++ b/cpp/src/Slice/Parser.cpp @@ -2426,23 +2426,34 @@ Slice::Container::checkIdentifier(const string& name) const // // For rules controlled by a translator option, we don't complain about included files. // - _unit->error("illegal underscore in identifier `" + name + "'"); + + DefinitionContextPtr dc = _unit->currentDefinitionContext(); + assert(dc); + if(dc->findMetaData("underscore") != "underscore") // no "underscore" global metadata + { + _unit->error("illegal underscore in identifier `" + name + "'"); + } } + // + // For rules controlled by a translator option, we don't complain about included files. + // if(_unit->currentIncludeLevel() == 0 && !_unit->allowIcePrefix()) { - // - // For rules controlled by a translator option, we don't complain about included files. - // - if(name.size() >= 3) + DefinitionContextPtr dc = _unit->currentDefinitionContext(); + assert(dc); + if(dc->findMetaData("ice-prefix") != "ice-prefix") // no "ice-prefix" global metadata { - string prefix3; - prefix3 += ::tolower(static_cast<unsigned char>(name[0])); - prefix3 += ::tolower(static_cast<unsigned char>(name[1])); - prefix3 += ::tolower(static_cast<unsigned char>(name[2])); - if(prefix3 == "ice") + if(name.size() >= 3) { - _unit->error("illegal identifier `" + name + "': `" + name.substr(0, 3) + "' prefix is reserved"); + string prefix3; + prefix3 += ::tolower(static_cast<unsigned char>(name[0])); + prefix3 += ::tolower(static_cast<unsigned char>(name[1])); + prefix3 += ::tolower(static_cast<unsigned char>(name[2])); + if(prefix3 == "ice") + { + _unit->error("illegal identifier `" + name + "': `" + name.substr(0, 3) + "' prefix is reserved"); + } } } } diff --git a/cpp/src/Slice/Python.cpp b/cpp/src/Slice/Python.cpp index 73a470260c4..cf46117d345 100644 --- a/cpp/src/Slice/Python.cpp +++ b/cpp/src/Slice/Python.cpp @@ -398,11 +398,13 @@ usage(const string& n) "--depend-xml Generate dependencies in XML format.\n" "--depend-file FILE Write dependencies to FILE instead of standard output.\n" "-d, --debug Print debug messages.\n" - "--ice Permit `Ice' prefix (for building Ice source code only).\n" - "--underscore Permit underscores in Slice identifiers.\n" "--all Generate code for Slice definitions in included files.\n" "--checksum Generate checksums for Slice definitions.\n" "--prefix PREFIX Prepend filenames of Python modules with PREFIX.\n" + "--ice Allow reserved Ice prefix in Slice identifiers\n" + " deprecated: use instead [[\"ice-prefix\"]] metadata.\n" + "--underscore Allow underscores in Slice identifiers\n" + " deprecated: use instead [[\"underscore\"]] metadata.\n" ; } diff --git a/cpp/src/Slice/Ruby.cpp b/cpp/src/Slice/Ruby.cpp index 799e72c264b..fe0a05ad0e2 100644 --- a/cpp/src/Slice/Ruby.cpp +++ b/cpp/src/Slice/Ruby.cpp @@ -73,10 +73,12 @@ usage(const string& n) "--depend-xml Generate dependencies in XML format.\n" "--depend-file FILE Write dependencies to FILE instead of standard output.\n" "-d, --debug Print debug messages.\n" - "--ice Permit `Ice' prefix (for building Ice source code only).\n" - "--underscore Permit underscores in Slice identifiers.\n" "--all Generate code for Slice definitions in included files.\n" "--checksum Generate checksums for Slice definitions.\n" + "--ice Allow reserved Ice prefix in Slice identifiers\n" + " deprecated: use instead [[\"ice-prefix\"]] metadata.\n" + "--underscore Allow underscores in Slice identifiers\n" + " deprecated: use instead [[\"underscore\"]] metadata.\n" ; } |