summaryrefslogtreecommitdiff
path: root/cpp/src/slice2cpp
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2015-12-23 23:05:33 +0100
committerJose <jose@zeroc.com>2015-12-23 23:05:33 +0100
commit5602dfcd29b1334063fa6aa83986fff53cc085e2 (patch)
treee8fba9ccf5d148e3e35d00025888ee8467c73e61 /cpp/src/slice2cpp
parentVisual Studio 2015 compiler fix (diff)
downloadice-5602dfcd29b1334063fa6aa83986fff53cc085e2.tar.bz2
ice-5602dfcd29b1334063fa6aa83986fff53cc085e2.tar.xz
ice-5602dfcd29b1334063fa6aa83986fff53cc085e2.zip
Fix binary compatibility issue with previous fix
Diffstat (limited to 'cpp/src/slice2cpp')
-rw-r--r--cpp/src/slice2cpp/Gen.cpp61
1 files changed, 13 insertions, 48 deletions
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp
index 037c788a275..dff1f3c31aa 100644
--- a/cpp/src/slice2cpp/Gen.cpp
+++ b/cpp/src/slice2cpp/Gen.cpp
@@ -3292,65 +3292,18 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p)
if(!p->isAbstract())
{
- bool restoreInProtected = false;
//
// We add a protected destructor to force heap instantiation of the class.
//
- if(inProtected)
- {
- H.zeroIndent();
- H << nl << "#if defined(_MSC_VER) && (_MSC_VER >= 1900)";
- H.restoreIndent();
-
- H << nl << "//";
- H << nl << "// COMPILERFIX: Visual Studio 2015 update 1 fails to access";
- H << nl << "// the proected destructor from a friend class.";
- H << nl << "//";
- H << nl << "public:";
-
- H.zeroIndent();
- H << nl << "#endif";
- restoreInProtected = true;
- H.restoreIndent();
- }
- else
+ if(!inProtected)
{
H.dec();
-
- H.zeroIndent();
- H << nl << "#if !defined(_MSC_VER) || (_MSC_VER < 1900)";
- H.restoreIndent();
- H << nl << "//";
- H << nl << "// COMPILERFIX: Visual Studio 2015 update 1 fails to access";
- H << nl << "// the proected destructor from a friend class.";
- H << nl << "//";
H << nl << "protected:";
-
- H.zeroIndent();
- H << nl << "#endif";
- H.restoreIndent();
-
H.inc();
inProtected = true;
}
H << sp << nl << "virtual ~" << fixKwd(p->name()) << "() {}";
- if(restoreInProtected)
- {
- H.zeroIndent();
- H << nl << "#if defined(_MSC_VER) && (_MSC_VER >= 1900)";
- H.restoreIndent();
- H << nl << "//";
- H << nl << "// COMPILERFIX: Visual Studio 2015 update 1 fails to access";
- H << nl << "// the proected destructor from a friend class.";
- H << nl << "//";
- H << nl << "protected:";
-
- H.zeroIndent();
- H << nl << "#endif";
- H.restoreIndent();
- }
-
if(!_doneStaticSymbol)
{
H.dec();
@@ -3383,6 +3336,14 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p)
// For a Slice class Foo, we instantiate a dummy class Foo__staticInit instead of using a static
// Foo instance directly because Foo has a protected destructor.
//
+ H.zeroIndent();
+ H << nl << "#if !defined(_MSC_VER) || (_MSC_VER < 1900)";
+ H.restoreIndent();
+ H << nl << "//";
+ H << nl << "// COMPILERFIX: Visual Studio 2015 update 1 fails to access";
+ H << nl << "// the proected destructor from a friend class.";
+ H << nl << "//";
+
H << sp << nl << "class " << p->name() << "__staticInit";
H << sb;
H.dec();
@@ -3392,6 +3353,10 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p)
H << eb << ';';
_doneStaticSymbol = true;
H << sp << nl << "static " << p->name() << "__staticInit _" << p->name() << "_init;";
+
+ H.zeroIndent();
+ H << nl << "#endif";
+ H.restoreIndent();
}
if(p->isLocal())