diff options
author | Michi Henning <michi@zeroc.com> | 2002-07-05 05:51:09 +0000 |
---|---|---|
committer | Michi Henning <michi@zeroc.com> | 2002-07-05 05:51:09 +0000 |
commit | fb87cc511bc90bb3ba0a07846ae77a72075a9900 (patch) | |
tree | 0d81a0723444710f564da26c55870993d61b23d4 /cpp/src | |
parent | Added enumerator for ConstDef::contained() (ContainedTypeConstant) to (diff) | |
download | ice-fb87cc511bc90bb3ba0a07846ae77a72075a9900.tar.bz2 ice-fb87cc511bc90bb3ba0a07846ae77a72075a9900.tar.xz ice-fb87cc511bc90bb3ba0a07846ae77a72075a9900.zip |
Move the ICE_INT64_LITERAL macro into its own header file (Ice/Const.h).
That was cleaner than polluting the generated files with the macro
definition over and over...
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/Slice/CPlusPlusUtil.cpp | 20 | ||||
-rw-r--r-- | cpp/src/Slice/Parser.cpp | 18 | ||||
-rw-r--r-- | cpp/src/slice2cpp/Gen.cpp | 11 |
3 files changed, 24 insertions, 25 deletions
diff --git a/cpp/src/Slice/CPlusPlusUtil.cpp b/cpp/src/Slice/CPlusPlusUtil.cpp index 79725c6f4b4..0c800c87ac4 100644 --- a/cpp/src/Slice/CPlusPlusUtil.cpp +++ b/cpp/src/Slice/CPlusPlusUtil.cpp @@ -88,26 +88,6 @@ Slice::printVersionCheck(Output& out) } void -Slice::printDefInt64Macro(Output& out) -{ - out << "\n"; - out << "\n#if defined(_WIN32)"; - out << "\n# define INT64LITERAL(n) n##i64"; - out << "\n#elif defined(__linux__) && defined(i386)"; - out << "\n# define INT64LITERAL(n) n##LL"; - out << "\n#else"; - out << "\n# error \"Unsupported operating system or platform!\""; - out << "\n#endif"; -} - -void -Slice::printUndefInt64Macro(Output& out) -{ - out << "\n"; - out << "\n#undef INT64LITERAL"; -} - -void Slice::printDllExportStuff(Output& out, const string& dllExport) { if(dllExport.size()) diff --git a/cpp/src/Slice/Parser.cpp b/cpp/src/Slice/Parser.cpp index 99239c6a191..0b5393ea03d 100644 --- a/cpp/src/Slice/Parser.cpp +++ b/cpp/src/Slice/Parser.cpp @@ -3392,6 +3392,24 @@ Slice::Unit::usesNonLocals() const return false; } +bool +Slice::Unit::usesConsts() const +{ + for(map<string, ContainedList>::const_iterator p = _contentMap.begin(); p != _contentMap.end(); ++p) + { + for(ContainedList::const_iterator q = p->second.begin(); q != p->second.end(); ++q) + { + ConstDefPtr cd = ConstDefPtr::dynamicCast(*q); + if(cd) + { + return true; + } + } + } + + return false; +} + StringList Slice::Unit::includeFiles() const { diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index 06bec36200c..eda491f8fb6 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -199,6 +199,11 @@ Slice::Gen::generate(const UnitPtr& unit) H << "\n#include <Ice/LocalObject.h>"; } + if(unit->usesConsts()) + { + H << "\n#include <Ice/Const.h>"; + } + StringList includes = unit->includeFiles(); for(StringList::const_iterator q = includes.begin(); q != includes.end(); ++q) { @@ -214,8 +219,6 @@ Slice::Gen::generate(const UnitPtr& unit) _dllExport += " "; } - printDefInt64Macro(H); - ProxyDeclVisitor proxyDeclVisitor(H, C, _dllExport); unit->visit(&proxyDeclVisitor); @@ -265,8 +268,6 @@ Slice::Gen::generate(const UnitPtr& unit) ImplVisitor implVisitor(implH, implC, _dllExport); unit->visit(&implVisitor); } - - printUndefInt64Macro(H); } Slice::Gen::TypesVisitor::TypesVisitor(Output& h, Output& c, const string& dllExport) : @@ -983,7 +984,7 @@ Slice::Gen::TypesVisitor::visitConstDef(const ConstDefPtr& p) } else if(bp && bp->kind() == Builtin::KindLong) { - H << "INT64LITERAL(" << p->value() << ")"; + H << "ICE_INT64_LITERAL(" << p->value() << ")"; } else { |