summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2015-07-21 21:14:52 +0000
committerJose <jose@zeroc.com>2015-07-22 14:43:42 +0000
commit1a3686f58a756569157788526e405d149e76a651 (patch)
treee14a838af4b119bb8fa590fe7b1093a6a40830e6 /cpp
parentFix Ice::Log string format used with Visual Studio (diff)
downloadice-1a3686f58a756569157788526e405d149e76a651.tar.bz2
ice-1a3686f58a756569157788526e405d149e76a651.tar.xz
ice-1a3686f58a756569157788526e405d149e76a651.zip
Fix for Visual Studio 2015 bogus warning
Visual Studio 2015 generates a bogus warning for ice_clone implementation of GCObject derived classes.
Diffstat (limited to 'cpp')
-rw-r--r--cpp/src/slice2cpp/Gen.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp
index 918e29097a3..73bff267ba7 100644
--- a/cpp/src/slice2cpp/Gen.cpp
+++ b/cpp/src/slice2cpp/Gen.cpp
@@ -2608,6 +2608,7 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
bool hasBaseClass = !bases.empty() && !bases.front()->isInterface();
bool override = p->canBeCyclic() && (!hasBaseClass || !bases.front()->canBeCyclic());
+ bool hasGCObjectBaseClass = basePreserved || override || preserved;
if(!basePreserved && (override || preserved))
{
H << ", public ::IceInternal::GCObject";
@@ -2800,11 +2801,23 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
{
H << nl << "virtual ::Ice::ObjectPtr ice_clone() const;";
+ if(hasGCObjectBaseClass)
+ {
+ C.zeroIndent();
+ C << sp;
+ C << nl << "#if defined(_MSC_VER) && (_MSC_VER >= 1900)";
+ C << nl << "# pragma warning(push)";
+ C << nl << "# pragma warning(disable:4589)";
+ C << nl << "#endif";
+ C.restoreIndent();
+ }
C << nl << "::Ice::ObjectPtr";
C << nl << scoped.substr(2) << "::ice_clone() const";
C << sb;
if(!p->isAbstract())
{
+
+
C << nl << "::Ice::Object* __p = new " << name << "(*this);";
C << nl << "return __p;";
}
@@ -2816,6 +2829,14 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
C << nl << "throw ::Ice::CloneNotImplementedException(__FILE__, __LINE__);";
}
C << eb;
+ if(hasGCObjectBaseClass)
+ {
+ C.zeroIndent();
+ C << nl << "#if defined(_MSC_VER) && (_MSC_VER >= 1900)";
+ C << nl << "# pragma warning(pop)";
+ C << nl << "#endif";
+ C.restoreIndent();
+ }
}
ClassList allBases = p->allBases();