summaryrefslogtreecommitdiff
path: root/cpp/src/slice2cpp/Gen.cpp
diff options
context:
space:
mode:
authorMichi Henning <michi@zeroc.com>2004-10-18 03:48:21 +0000
committerMichi Henning <michi@zeroc.com>2004-10-18 03:48:21 +0000
commit88c26185009908790d28d75ede5c60fa85bf8120 (patch)
tree2d7115c444d0558087fc49ae4dfda54f5766f8fe /cpp/src/slice2cpp/Gen.cpp
parentcommit test (diff)
downloadice-88c26185009908790d28d75ede5c60fa85bf8120.tar.bz2
ice-88c26185009908790d28d75ede5c60fa85bf8120.tar.xz
ice-88c26185009908790d28d75ede5c60fa85bf8120.zip
Fixed bug reported in
http://www.zeroc.com/vbulletin/showthread.php?s=&threadid=867
Diffstat (limited to 'cpp/src/slice2cpp/Gen.cpp')
-rw-r--r--cpp/src/slice2cpp/Gen.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp
index 7d5421e0e1f..6916846b1cb 100644
--- a/cpp/src/slice2cpp/Gen.cpp
+++ b/cpp/src/slice2cpp/Gen.cpp
@@ -520,6 +520,15 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
}
}
+ H << sp << nl << "struct __" << p->name() << "_init";
+ H << sb;
+ H << nl << "__" << p->name() << "_init();";
+ H << eb << ';';
+
+ C << sp << nl << p->name() << "::__" << p->name() << "_init::__" << p->name() << "_init()";
+ C << sb;
+ C << eb;
+
string factoryName = "__F" + flattenedScope + name;
C << sp << nl << "class " << factoryName << " : public ::IceInternal::UserExceptionFactory";
@@ -570,6 +579,12 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
H << sp << nl << "static const ::std::string _name;";
H << eb << ';';
+
+ if(!p->isLocal())
+ {
+ H << sp << nl << "static " << name << "::__" << p->name() << "_init __"
+ << p->name() << "_initializer; // Force initializers in .cpp file to run";
+ }
}
bool
@@ -2259,6 +2274,15 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p)
C << nl << "extern \"C\" { void " << initfuncname << "() {} }";
C << nl << "#endif";
+ H << sp << nl << "struct __" << p->name() << "_init";
+ H << sb;
+ H << nl << "__" << p->name() << "_init();";
+ H << eb << ';';
+
+ C << sp << nl << name << "::__" << p->name() << "_init::__" << name << "_init()";
+ C << sb;
+ C << eb;
+
H.dec();
H << sp << nl << "private:";
H.inc();
@@ -2268,6 +2292,12 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p)
H << eb << ';';
+ if(!p->isAbstract() && !p->isLocal())
+ {
+ H << sp << nl << "static " << fixKwd(p->name()) << "::__" << p->name() << "_init __"
+ << p->name() << "_initializer; // Force initializers in .cpp file to run";
+ }
+
if(p->isLocal())
{
C << sp;