diff options
Diffstat (limited to 'cpp/src/slice2objc')
-rw-r--r-- | cpp/src/slice2objc/Gen.cpp | 15 | ||||
-rw-r--r-- | cpp/src/slice2objc/Main.cpp | 9 | ||||
-rw-r--r-- | cpp/src/slice2objc/ObjCUtil.cpp | 15 |
3 files changed, 36 insertions, 3 deletions
diff --git a/cpp/src/slice2objc/Gen.cpp b/cpp/src/slice2objc/Gen.cpp index 9d51de398e4..794570bc4d0 100644 --- a/cpp/src/slice2objc/Gen.cpp +++ b/cpp/src/slice2objc/Gen.cpp @@ -690,6 +690,21 @@ Slice::Gen::generate(const UnitPtr& p) { ObjCGenerator::validateMetaData(p); + // + // Give precedence to --dll-export command-line option + // + if(_dllExport.empty()) + { + DefinitionContextPtr dc = p->findDefinitionContext(p->topLevelFile()); + assert(dc); + static const string dllExportPrefix = "objc:dll-export:"; + string meta = dc->findMetaData(dllExportPrefix); + if(meta.size() > dllExportPrefix.size()) + { + _dllExport = meta.substr(dllExportPrefix.size()); + } + } + _H << sp << nl << "#import <objc/Ice/Config.h>"; if(p->hasNonLocalClassDecls()) { diff --git a/cpp/src/slice2objc/Main.cpp b/cpp/src/slice2objc/Main.cpp index c8d68d39bf1..4d0df1c8a59 100644 --- a/cpp/src/slice2objc/Main.cpp +++ b/cpp/src/slice2objc/Main.cpp @@ -68,13 +68,16 @@ usage(const string& n) "-E Print preprocessor output on stdout.\n" "--include-dir DIR Use DIR as the header include directory in source files.\n" "--output-dir DIR Create files in the directory DIR.\n" - "--dll-export SYMBOL Use SYMBOL for DLL exports.\n" "--depend Generate Makefile dependencies.\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 Allow reserved Ice prefix in Slice identifiers.\n" - "--underscore Allow underscores in Slice identifiers.\n" + "--dll-export SYMBOL Use SYMBOL for DLL exports\n" + " deprecated: use instead [[\"objc:dll-export:SYMBOL\"]] metadata.\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" ; // Note: --case-sensitive is intentionally not shown here! } diff --git a/cpp/src/slice2objc/ObjCUtil.cpp b/cpp/src/slice2objc/ObjCUtil.cpp index 8247915d841..852af9ba2af 100644 --- a/cpp/src/slice2objc/ObjCUtil.cpp +++ b/cpp/src/slice2objc/ObjCUtil.cpp @@ -1058,6 +1058,7 @@ Slice::ObjCGenerator::MetaDataVisitor::visitUnitStart(const UnitPtr& p) assert(dc); StringList globalMetaData = dc->getMetaData(); int headerDir = 0; + int dllExport = 0; for(StringList::const_iterator r = globalMetaData.begin(); r != globalMetaData.end(); ++r) { string s = *r; @@ -1066,6 +1067,7 @@ Slice::ObjCGenerator::MetaDataVisitor::visitUnitStart(const UnitPtr& p) if(s.find(_objcPrefix) == 0) { static const string objcHeaderDirPrefix = "objc:header-dir:"; + static const string objcDllExportPrefix = "objc:dll-export:"; if(s.find(objcHeaderDirPrefix) == 0 && s.size() > objcHeaderDirPrefix.size()) { headerDir++; @@ -1079,6 +1081,19 @@ Slice::ObjCGenerator::MetaDataVisitor::visitUnitStart(const UnitPtr& p) } continue; } + else if(s.find(objcDllExportPrefix) == 0 && s.size() > objcDllExportPrefix.size()) + { + dllExport++; + if(dllExport > 1) + { + ostringstream ostr; + ostr << "ignoring invalid global metadata `" << s + << "': directive can appear only once per file"; + emitWarning(file, -1, ostr.str()); + _history.insert(s); + } + continue; + } ostringstream ostr; ostr << "ignoring invalid global metadata `" << s << "'"; emitWarning(file, -1, ostr.str()); |