From 6c2ccaf9456aebdd977fb75640f2733bcbab8712 Mon Sep 17 00:00:00 2001 From: Alexey Prokhin Date: Thu, 30 Dec 2010 14:04:24 +0300 Subject: [PATCH] Fix for shared static constructors and destructors --- gen/functions.cpp | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/gen/functions.cpp b/gen/functions.cpp index 6425c38c..e431169e 100644 --- a/gen/functions.cpp +++ b/gen/functions.cpp @@ -501,6 +501,20 @@ void DtoDeclareFunction(FuncDeclaration* fdecl) gIR->mainFunc = func; } +#if DMDV2 + // shared static ctor + if (fdecl->isSharedStaticCtorDeclaration()) { + if (mustDefineSymbol(fdecl)) { + gIR->sharedCtors.push_back(fdecl); + } + } + // shared static dtor + else if (fdecl->isSharedStaticDtorDeclaration()) { + if (mustDefineSymbol(fdecl)) { + gIR->sharedDtors.push_back(fdecl); + } + } else +#endif // static ctor if (fdecl->isStaticCtorDeclaration()) { if (mustDefineSymbol(fdecl)) { @@ -513,20 +527,7 @@ void DtoDeclareFunction(FuncDeclaration* fdecl) gIR->dtors.push_back(fdecl); } } -#if DMDV2 - // shared static ctor - else if (fdecl->isSharedStaticCtorDeclaration()) { - if (mustDefineSymbol(fdecl)) { - gIR->sharedCtors.push_back(fdecl); - } - } - // static dtor - else if (fdecl->isSharedStaticDtorDeclaration()) { - if (mustDefineSymbol(fdecl)) { - gIR->sharedDtors.push_back(fdecl); - } - } -#endif + // we never reference parameters of function prototypes std::string str; // if (!declareOnly)