diff options
author | Jose <jose@zeroc.com> | 2013-08-26 20:16:09 +0200 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2013-08-26 20:16:09 +0200 |
commit | d616b7e85ed02f362eb4cbd11063d62dd6c104db (patch) | |
tree | d3d9d043a17ac9fd011a9d35aef8c449fe4cb2f9 /cpp | |
parent | ICE-5404 - IceSSL test failure on SLES11SP3 (diff) | |
download | ice-d616b7e85ed02f362eb4cbd11063d62dd6c104db.tar.bz2 ice-d616b7e85ed02f362eb4cbd11063d62dd6c104db.tar.xz ice-d616b7e85ed02f362eb4cbd11063d62dd6c104db.zip |
Fixed ICE-5402 - VS2010: generated code does not compile if method has more than 10 out parameters
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/src/slice2cpp/Gen.cpp | 84 | ||||
-rw-r--r-- | cpp/test/Ice/ami/Test.ice | 3 | ||||
-rw-r--r-- | cpp/test/Ice/ami/TestI.cpp | 19 | ||||
-rw-r--r-- | cpp/test/Ice/ami/TestI.h | 2 |
4 files changed, 104 insertions, 4 deletions
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index caf5ddcb89f..d4e22e1bcb8 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -1852,9 +1852,24 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) H.zeroIndent(); H << nl << "#ifdef ICE_CPP11"; H.restoreIndent(); - + string retEndArg = getEndArg(ret, p->getMetaData(), "__ret"); - + + // + // COMPILERFIX VC compilers up to VC110 don't support more than 10 parameters with std::function due to + // lack of variadic templates. + // + if(outDecls.size() > 10 || outDecls.size() > 9 && !retInS.empty()) + { + H.zeroIndent(); + H << nl << "#if !defined(_MSC_VER) || _MSC_VER > 1700"; + H.restoreIndent(); + H << nl << "//"; + H << nl << "// COMPILERFIX VC compilers up to VC110 don't support more than 10 parameters with"; + H << nl << "// std::function due to lack of variadic templates."; + H << nl << "//"; + } + H << nl << "::Ice::AsyncResultPtr"; H << nl << "begin_" << name << spar << paramsDeclAMI << "const ::IceInternal::Function<void " << spar; @@ -1866,7 +1881,7 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) << "const ::IceInternal::Function<void (const ::Ice::Exception&)>& __exception = " "::IceInternal::Function<void (const ::Ice::Exception&)>(), " << "const ::IceInternal::Function<void (bool)>& __sent = ::IceInternal::Function<void (bool)>()" << epar; - + H << sb; if(p->returnsData()) { @@ -1879,6 +1894,17 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) } H << eb; + + // + // COMPILERFIX VC compilers up to VC110 don't support more than 10 parameters with std::function due to + // lack of variadic templates. + // + if(outDecls.size() > 10 || outDecls.size() > 9 && !retInS.empty()) + { + H.zeroIndent(); + H << nl << "#endif"; + H.restoreIndent(); + } H << nl << "::Ice::AsyncResultPtr"; H << nl << "begin_" << name << spar << paramsDeclAMI @@ -1889,7 +1915,21 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) H << nl << "return begin_" << name << spar << argsAMI << "0, ::Ice::newCallback(__completed, __sent), 0" << epar << ";"; H << eb; - + // + // COMPILERFIX VC compilers up to VC110 don't support more than 10 parameters with std::function due to + // lack of variadic templates. + // + if(outDecls.size() > 10 || outDecls.size() > 9 && !retInS.empty()) + { + H.zeroIndent(); + H << nl << "#if !defined(_MSC_VER) || _MSC_VER > 1700"; + H.restoreIndent(); + H << nl << "//"; + H << nl << "// COMPILERFIX VC compilers up to VC110 don't support more than 10 parameters with"; + H << nl << "// std::function due to lack of variadic templates."; + H << nl << "//"; + } + H << nl << "::Ice::AsyncResultPtr"; H << nl << "begin_" << name << spar << paramsDeclAMI << "const ::Ice::Context& __ctx" << "const ::IceInternal::Function<void " << spar; @@ -1914,6 +1954,17 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) } H << eb; + // + // COMPILERFIX VC compilers up to VC110 don't support more than 10 parameters with std::function due to + // lack of variadic templates. + // + if(outDecls.size() > 10 || outDecls.size() > 9 && !retInS.empty()) + { + H.zeroIndent(); + H << nl << "#endif"; + H.restoreIndent(); + } + H << nl << "::Ice::AsyncResultPtr"; H << nl << "begin_" << name << spar << paramsDeclAMI << "const ::Ice::Context& __ctx" @@ -1926,6 +1977,21 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) if(p->returnsData()) { + // + // COMPILERFIX VC compilers up to VC110 don't support more than 10 parameters with std::function due to + // lack of variadic templates. + // + if(outDecls.size() > 10 || outDecls.size() > 9 && !retInS.empty()) + { + H.zeroIndent(); + H << nl << "#if !defined(_MSC_VER) || _MSC_VER > 1700"; + H.restoreIndent(); + H << nl << "//"; + H << nl << "// COMPILERFIX VC compilers up to VC110 don't support more than 10 parameters with"; + H << nl << "// std::function due to lack of variadic templates."; + H << nl << "//"; + } + H << nl; H.dec(); H << nl << "private:"; @@ -2038,6 +2104,16 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) H.dec(); H << nl << "public:"; H.inc(); + // + // COMPILERFIX VC compilers up to VC110 don't support more than 10 parameters with std::function due to + // lack of variadic templates. + // + if(outDecls.size() > 10 || outDecls.size() > 9 && !retInS.empty()) + { + H.zeroIndent(); + H << nl << "#endif"; + H.restoreIndent(); + } } H.zeroIndent(); diff --git a/cpp/test/Ice/ami/Test.ice b/cpp/test/Ice/ami/Test.ice index ef2fb34d133..fc56c5b3660 100644 --- a/cpp/test/Ice/ami/Test.ice +++ b/cpp/test/Ice/ami/Test.ice @@ -27,6 +27,9 @@ interface TestIntf void opWithUE() throws TestIntfException; void opBatch(); + + void opWitArgs(out int one, out int two, out int three, out int four, out int five, out int six, out int seven, + out int eight, out int nine, out int ten, out int eleven); int opBatchCount(); bool waitForBatch(int count); void close(bool force); diff --git a/cpp/test/Ice/ami/TestI.cpp b/cpp/test/Ice/ami/TestI.cpp index e4b4b59a1a4..cc59376d94e 100644 --- a/cpp/test/Ice/ami/TestI.cpp +++ b/cpp/test/Ice/ami/TestI.cpp @@ -55,6 +55,24 @@ TestIntfI::opBatchCount(const Ice::Current&) return _batchCount; } +void +TestIntfI::opWitArgs(Ice::Int& one, Ice::Int& two, Ice::Int& three, Ice::Int& four, Ice::Int& five, Ice::Int& six, + Ice::Int& seven, Ice::Int& eight, Ice::Int& nine, Ice::Int& ten, Ice::Int& eleven, + const Ice::Current&) +{ + one = 1; + two = 2; + three = 3; + four = 4; + five = 5; + six = 6; + seven = 7; + eight = 8; + nine = 9; + ten = 10; + eleven = 11; +} + bool TestIntfI::waitForBatch(Ice::Int count, const Ice::Current&) { @@ -95,3 +113,4 @@ TestIntfControllerI::resumeAdapter(const Ice::Current&) TestIntfControllerI::TestIntfControllerI(const Ice::ObjectAdapterPtr& adapter) : _adapter(adapter) { } + diff --git a/cpp/test/Ice/ami/TestI.h b/cpp/test/Ice/ami/TestI.h index 8e5ed7b1fa3..e1a66c302d3 100644 --- a/cpp/test/Ice/ami/TestI.h +++ b/cpp/test/Ice/ami/TestI.h @@ -27,6 +27,8 @@ public: virtual void opWithPayload(const Ice::ByteSeq&, const Ice::Current&); virtual void opBatch(const Ice::Current&); virtual Ice::Int opBatchCount(const Ice::Current&); + virtual void opWitArgs(Ice::Int&, Ice::Int&, Ice::Int&, Ice::Int&, Ice::Int&, Ice::Int&, Ice::Int&, + Ice::Int&, Ice::Int&, Ice::Int&, Ice::Int&, const Ice::Current&); virtual bool waitForBatch(Ice::Int, const Ice::Current&); virtual void close(bool, const Ice::Current&); virtual void shutdown(const Ice::Current&); |