summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp')
-rw-r--r--cpp/src/slice2cpp/Gen.cpp38
-rw-r--r--cpp/src/slice2cpp/Gen.h15
-rw-r--r--cpp/src/slice2cppe/Gen.cpp38
-rw-r--r--cpp/src/slice2cppe/Gen.h15
-rw-r--r--cpp/test/Ice/custom/AllTests.cpp3
-rw-r--r--cpp/test/Ice/custom/Client.cpp3
-rw-r--r--cpp/test/Ice/custom/Collocated.cpp3
-rw-r--r--cpp/test/Ice/custom/Makefile2
-rw-r--r--cpp/test/Ice/custom/Server.cpp3
-rw-r--r--cpp/test/Ice/custom/ServerAMD.cpp3
-rw-r--r--cpp/test/Ice/custom/Test.ice2
-rw-r--r--cpp/test/Ice/custom/TestAMD.ice2
-rw-r--r--cpp/test/Ice/custom/TestAMDI.cpp5
-rw-r--r--cpp/test/Ice/custom/TestI.cpp5
-rwxr-xr-xcpp/test/Ice/custom/customAMDS.dsp8
-rw-r--r--cpp/test/Ice/custom/customC.dsp8
-rw-r--r--cpp/test/Ice/custom/customCOL.dsp8
-rw-r--r--cpp/test/Ice/custom/customS.dsp8
18 files changed, 129 insertions, 40 deletions
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp
index 97718dd9328..94c99dc646c 100644
--- a/cpp/src/slice2cpp/Gen.cpp
+++ b/cpp/src/slice2cpp/Gen.cpp
@@ -250,6 +250,9 @@ Slice::Gen::generate(const UnitPtr& p)
H << "\n#include <Ice/UndefSysMacros.h>";
+ GlobalIncludeVisitor globalIncludeVisitor(H);
+ p->visit(&globalIncludeVisitor, false);
+
printVersionCheck(H);
printVersionCheck(C);
@@ -374,6 +377,36 @@ Slice::Gen::writeExtraHeaders(IceUtil::Output& out)
}
}
+Slice::Gen::GlobalIncludeVisitor::GlobalIncludeVisitor(Output& h) :
+ H(h), _finished(false)
+{
+}
+
+bool
+Slice::Gen::GlobalIncludeVisitor::visitModuleStart(const ModulePtr& p)
+{
+ if(!_finished)
+ {
+ DefinitionContextPtr dc = p->definitionContext();
+ assert(dc);
+ StringList globalMetaData = dc->getMetaData();
+
+ static const string includePrefix = "cpp:include:";
+
+ for(StringList::const_iterator q = globalMetaData.begin(); q != globalMetaData.end(); ++q)
+ {
+ string s = *q;
+ if(s.find(includePrefix) == 0)
+ {
+ H << nl << "#include <" << s.substr(includePrefix.size()) << ">";
+ }
+ }
+ _finished = true;
+ }
+
+ return false;
+}
+
Slice::Gen::TypesVisitor::TypesVisitor(Output& h, Output& c, const string& dllExport, bool stream) :
H(h), C(c), _dllExport(dllExport), _stream(stream), _doneStaticSymbol(false)
{
@@ -4702,6 +4735,11 @@ Slice::Gen::MetaDataVisitor::visitModuleStart(const ModulePtr& p)
{
if(s.find(prefix) == 0)
{
+ string ss = s.substr(prefix.size());
+ if(ss.find("include:") == 0)
+ {
+ continue;
+ }
cout << file << ": warning: ignoring invalid global metadata `" << s << "'" << endl;
}
_history.insert(s);
diff --git a/cpp/src/slice2cpp/Gen.h b/cpp/src/slice2cpp/Gen.h
index 3801640f75e..989c839255d 100644
--- a/cpp/src/slice2cpp/Gen.h
+++ b/cpp/src/slice2cpp/Gen.h
@@ -59,6 +59,21 @@ private:
bool _checksum;
bool _stream;
+ class GlobalIncludeVisitor : private ::IceUtil::noncopyable, public ParserVisitor
+ {
+ public:
+
+ GlobalIncludeVisitor(::IceUtil::Output&);
+
+ virtual bool visitModuleStart(const ModulePtr&);
+
+ private:
+
+ ::IceUtil::Output& H;
+
+ bool _finished;
+ };
+
class TypesVisitor : private ::IceUtil::noncopyable, public ParserVisitor
{
public:
diff --git a/cpp/src/slice2cppe/Gen.cpp b/cpp/src/slice2cppe/Gen.cpp
index 52d18fddce3..64507411689 100644
--- a/cpp/src/slice2cppe/Gen.cpp
+++ b/cpp/src/slice2cppe/Gen.cpp
@@ -249,6 +249,9 @@ Slice::Gen::generate(const UnitPtr& p)
H << "\n#include <IceE/UndefSysMacros.h>";
+ GlobalIncludeVisitor globalIncludeVisitor(H);
+ p->visit(&globalIncludeVisitor, false);
+
printVersionCheck(H);
printVersionCheck(C);
@@ -336,6 +339,36 @@ Slice::Gen::writeExtraHeaders(Output& out)
}
}
+Slice::Gen::GlobalIncludeVisitor::GlobalIncludeVisitor(Output& h) :
+ H(h), _finished(false)
+{
+}
+
+bool
+Slice::Gen::GlobalIncludeVisitor::visitModuleStart(const ModulePtr& p)
+{
+ if(!_finished)
+ {
+ DefinitionContextPtr dc = p->definitionContext();
+ assert(dc);
+ StringList globalMetaData = dc->getMetaData();
+
+ static const string includePrefix = "cpp:include:";
+
+ for(StringList::const_iterator q = globalMetaData.begin(); q != globalMetaData.end(); ++q)
+ {
+ string s = *q;
+ if(s.find(includePrefix) == 0)
+ {
+ H << nl << "#include <" << s.substr(includePrefix.size()) << ">";
+ }
+ }
+ _finished = true;
+ }
+
+ return false;
+}
+
Slice::Gen::TypesVisitor::TypesVisitor(Output& h, Output& c, const string& dllExport) :
H(h), C(c), _dllExport(dllExport), _doneStaticSymbol(false)
{
@@ -2980,6 +3013,11 @@ Slice::Gen::MetaDataVisitor::visitModuleStart(const ModulePtr& p)
{
if(s.find(prefix) == 0)
{
+ string ss = s.substr(prefix.size());
+ if(ss.find("include:") == 0)
+ {
+ continue;
+ }
cout << file << ": warning: ignoring invalid global metadata `" << s << "'" << endl;
}
_history.insert(s);
diff --git a/cpp/src/slice2cppe/Gen.h b/cpp/src/slice2cppe/Gen.h
index b1d9406a7ce..4e446743fe1 100644
--- a/cpp/src/slice2cppe/Gen.h
+++ b/cpp/src/slice2cppe/Gen.h
@@ -61,6 +61,21 @@ private:
std::string _dllExport;
bool _impl;
+ class GlobalIncludeVisitor : private ::IceUtil::noncopyable, public ParserVisitor
+ {
+ public:
+
+ GlobalIncludeVisitor(::IceUtil::Output&);
+
+ virtual bool visitModuleStart(const ModulePtr&);
+
+ private:
+
+ ::IceUtil::Output& H;
+
+ bool _finished;
+ };
+
class TypesVisitor : private ::IceUtil::noncopyable, public ParserVisitor
{
public:
diff --git a/cpp/test/Ice/custom/AllTests.cpp b/cpp/test/Ice/custom/AllTests.cpp
index c5a6d2e9d6e..9dd0c219a94 100644
--- a/cpp/test/Ice/custom/AllTests.cpp
+++ b/cpp/test/Ice/custom/AllTests.cpp
@@ -9,9 +9,6 @@
#include <Ice/Ice.h>
#include <TestCommon.h>
-#include <deque>
-#include <list>
-#include <MyByteSeq.h>
#include <Test.h>
using namespace std;
diff --git a/cpp/test/Ice/custom/Client.cpp b/cpp/test/Ice/custom/Client.cpp
index 422611add8a..fb5bdd565f6 100644
--- a/cpp/test/Ice/custom/Client.cpp
+++ b/cpp/test/Ice/custom/Client.cpp
@@ -9,9 +9,6 @@
#include <Ice/Ice.h>
#include <TestCommon.h>
-#include <deque>
-#include <list>
-#include <MyByteSeq.h>
#include <Test.h>
using namespace std;
diff --git a/cpp/test/Ice/custom/Collocated.cpp b/cpp/test/Ice/custom/Collocated.cpp
index 6f85c42876a..6cbd32a7316 100644
--- a/cpp/test/Ice/custom/Collocated.cpp
+++ b/cpp/test/Ice/custom/Collocated.cpp
@@ -9,9 +9,6 @@
#include <Ice/Ice.h>
#include <TestCommon.h>
-#include <deque>
-#include <list>
-#include <MyByteSeq.h>
#include <TestI.h>
using namespace std;
diff --git a/cpp/test/Ice/custom/Makefile b/cpp/test/Ice/custom/Makefile
index 2f6139680d1..a76f600b569 100644
--- a/cpp/test/Ice/custom/Makefile
+++ b/cpp/test/Ice/custom/Makefile
@@ -46,7 +46,7 @@ SLICE_SRCS = Test.ice TestAMD.ice
include $(top_srcdir)/config/Make.rules
CPPFLAGS := -I. -I../../include $(CPPFLAGS)
-SLICE2CPPFLAGS := --stream --add-header MyByteSeq.h --add-header deque --add-header list $(SLICE2CPPFLAGS)
+SLICE2CPPFLAGS := --stream $(SLICE2CPPFLAGS)
$(CLIENT): $(COBJS)
rm -f $@
diff --git a/cpp/test/Ice/custom/Server.cpp b/cpp/test/Ice/custom/Server.cpp
index 412b7d316e7..05d8c9a227e 100644
--- a/cpp/test/Ice/custom/Server.cpp
+++ b/cpp/test/Ice/custom/Server.cpp
@@ -9,9 +9,6 @@
#include <Ice/Ice.h>
#include <TestCommon.h>
-#include <deque>
-#include <list>
-#include <MyByteSeq.h>
#include <TestI.h>
using namespace std;
diff --git a/cpp/test/Ice/custom/ServerAMD.cpp b/cpp/test/Ice/custom/ServerAMD.cpp
index ff130ef3b91..d6fea972523 100644
--- a/cpp/test/Ice/custom/ServerAMD.cpp
+++ b/cpp/test/Ice/custom/ServerAMD.cpp
@@ -9,9 +9,6 @@
#include <Ice/Ice.h>
#include <TestCommon.h>
-#include <deque>
-#include <list>
-#include <MyByteSeq.h>
#include <TestAMDI.h>
using namespace std;
diff --git a/cpp/test/Ice/custom/Test.ice b/cpp/test/Ice/custom/Test.ice
index 18f7f91c88c..bb96b774ae5 100644
--- a/cpp/test/Ice/custom/Test.ice
+++ b/cpp/test/Ice/custom/Test.ice
@@ -10,6 +10,8 @@
#ifndef TEST_ICE
#define TEST_ICE
+[["cpp:include:deque", "cpp:include:list", "cpp:include:MyByteSeq.h"]]
+
module Test
{
diff --git a/cpp/test/Ice/custom/TestAMD.ice b/cpp/test/Ice/custom/TestAMD.ice
index 68b5a53c4c2..42b164224f1 100644
--- a/cpp/test/Ice/custom/TestAMD.ice
+++ b/cpp/test/Ice/custom/TestAMD.ice
@@ -10,6 +10,8 @@
#ifndef TEST_ICE
#define TEST_ICE
+[["cpp:include:deque", "cpp:include:list", "cpp:include:MyByteSeq.h"]]
+
module Test
{
diff --git a/cpp/test/Ice/custom/TestAMDI.cpp b/cpp/test/Ice/custom/TestAMDI.cpp
index 1a00141fb4f..cf0ce022387 100644
--- a/cpp/test/Ice/custom/TestAMDI.cpp
+++ b/cpp/test/Ice/custom/TestAMDI.cpp
@@ -7,10 +7,7 @@
//
// **********************************************************************
-#include <Ice/Ice.h>
-#include <MyByteSeq.h>
-#include <deque>
-#include <list>
+#include <Ice/Communicator.h>
#include <TestAMDI.h>
TestIntfI::TestIntfI(const Ice::CommunicatorPtr& communicator)
diff --git a/cpp/test/Ice/custom/TestI.cpp b/cpp/test/Ice/custom/TestI.cpp
index 1fa5e275c94..6acedc87000 100644
--- a/cpp/test/Ice/custom/TestI.cpp
+++ b/cpp/test/Ice/custom/TestI.cpp
@@ -7,10 +7,7 @@
//
// **********************************************************************
-#include <Ice/Ice.h>
-#include <deque>
-#include <list>
-#include <MyByteSeq.h>
+#include <Ice/Communicator.h>
#include <TestI.h>
TestIntfI::TestIntfI(const Ice::CommunicatorPtr& communicator)
diff --git a/cpp/test/Ice/custom/customAMDS.dsp b/cpp/test/Ice/custom/customAMDS.dsp
index 67065873301..6b9eaf955de 100755
--- a/cpp/test/Ice/custom/customAMDS.dsp
+++ b/cpp/test/Ice/custom/customAMDS.dsp
@@ -193,7 +193,7 @@ SOURCE=.\TestAMD.ice
InputPath=.\TestAMD.ice
BuildCmds= \
- slice2cpp.exe -I. --stream --add-header MyByteSeq.h --add-header deque --add-header list TestAMD.ice
+ slice2cpp.exe -I. --stream TestAMD.ice
"TestAMD.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
@@ -208,7 +208,7 @@ BuildCmds= \
InputPath=.\TestAMD.ice
BuildCmds= \
- slice2cpp.exe -I. --stream --add-header MyByteSeq.h --add-header deque --add-header list TestAMD.ice
+ slice2cpp.exe -I. --stream TestAMD.ice
"TestAMD.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
@@ -223,7 +223,7 @@ BuildCmds= \
InputPath=.\TestAMD.ice
BuildCmds= \
- slice2cpp.exe -I. --stream --add-header MyByteSeq.h --add-header deque --add-header list TestAMD.ice
+ slice2cpp.exe -I. --stream TestAMD.ice
"TestAMD.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
@@ -238,7 +238,7 @@ BuildCmds= \
InputPath=.\TestAMD.ice
BuildCmds= \
- slice2cpp.exe -I. --stream --add-header MyByteSeq.h --add-header deque --add-header list TestAMD.ice
+ slice2cpp.exe -I. --stream TestAMD.ice
"TestAMD.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
diff --git a/cpp/test/Ice/custom/customC.dsp b/cpp/test/Ice/custom/customC.dsp
index 583b6d6cdfd..30415c965d8 100644
--- a/cpp/test/Ice/custom/customC.dsp
+++ b/cpp/test/Ice/custom/customC.dsp
@@ -189,7 +189,7 @@ SOURCE=.\Test.ice
InputPath=.\Test.ice
BuildCmds= \
- slice2cpp.exe -I. --stream --add-header MyByteSeq.h --add-header deque --add-header list Test.ice
+ slice2cpp.exe -I. --stream Test.ice
"Test.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
@@ -204,7 +204,7 @@ BuildCmds= \
InputPath=.\Test.ice
BuildCmds= \
- slice2cpp.exe -I. --stream --add-header MyByteSeq.h --add-header deque --add-header list Test.ice
+ slice2cpp.exe -I. --stream Test.ice
"Test.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
@@ -219,7 +219,7 @@ BuildCmds= \
InputPath=.\Test.ice
BuildCmds= \
- slice2cpp.exe -I. --stream --add-header MyByteSeq.h --add-header deque --add-header list Test.ice
+ slice2cpp.exe -I. --stream Test.ice
"Test.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
@@ -234,7 +234,7 @@ BuildCmds= \
InputPath=.\Test.ice
BuildCmds= \
- slice2cpp.exe -I. --stream --add-header MyByteSeq.h --add-header deque --add-header list Test.ice
+ slice2cpp.exe -I. --stream Test.ice
"Test.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
diff --git a/cpp/test/Ice/custom/customCOL.dsp b/cpp/test/Ice/custom/customCOL.dsp
index 9df67f1d0a1..7bd85b45578 100644
--- a/cpp/test/Ice/custom/customCOL.dsp
+++ b/cpp/test/Ice/custom/customCOL.dsp
@@ -197,7 +197,7 @@ SOURCE=.\Test.ice
InputPath=.\Test.ice
BuildCmds= \
- slice2cpp.exe -I. --stream --add-header MyByteSeq.h --add-header deque --add-header list Test.ice
+ slice2cpp.exe -I. --stream Test.ice
"Test.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
@@ -212,7 +212,7 @@ BuildCmds= \
InputPath=.\Test.ice
BuildCmds= \
- slice2cpp.exe -I. --stream --add-header MyByteSeq.h --add-header deque --add-header list Test.ice
+ slice2cpp.exe -I. --stream Test.ice
"Test.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
@@ -227,7 +227,7 @@ BuildCmds= \
InputPath=.\Test.ice
BuildCmds= \
- slice2cpp.exe -I. --stream --add-header MyByteSeq.h --add-header deque --add-header list Test.ice
+ slice2cpp.exe -I. --stream Test.ice
"Test.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
@@ -242,7 +242,7 @@ BuildCmds= \
InputPath=.\Test.ice
BuildCmds= \
- slice2cpp.exe -I. --stream --add-header MyByteSeq.h --add-header deque --add-header list Test.ice
+ slice2cpp.exe -I. --stream Test.ice
"Test.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
diff --git a/cpp/test/Ice/custom/customS.dsp b/cpp/test/Ice/custom/customS.dsp
index fc9dcd43623..681ec06bcaa 100644
--- a/cpp/test/Ice/custom/customS.dsp
+++ b/cpp/test/Ice/custom/customS.dsp
@@ -193,7 +193,7 @@ SOURCE=.\Test.ice
InputPath=.\Test.ice
BuildCmds= \
- slice2cpp.exe -I. --stream --add-header MyByteSeq.h --add-header deque --add-header list Test.ice
+ slice2cpp.exe -I. --stream Test.ice
"Test.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
@@ -208,7 +208,7 @@ BuildCmds= \
InputPath=.\Test.ice
BuildCmds= \
- slice2cpp.exe -I. --stream --add-header MyByteSeq.h --add-header deque --add-header list Test.ice
+ slice2cpp.exe -I. --stream Test.ice
"Test.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
@@ -223,7 +223,7 @@ BuildCmds= \
InputPath=.\Test.ice
BuildCmds= \
- slice2cpp.exe -I. --stream --add-header MyByteSeq.h --add-header deque --add-header list Test.ice
+ slice2cpp.exe -I. --stream Test.ice
"Test.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
@@ -238,7 +238,7 @@ BuildCmds= \
InputPath=.\Test.ice
BuildCmds= \
- slice2cpp.exe -I. --stream --add-header MyByteSeq.h --add-header deque --add-header list Test.ice
+ slice2cpp.exe -I. --stream Test.ice
"Test.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)