summaryrefslogtreecommitdiff
path: root/unittests/Support/DynamicLibrary/PipSqueak.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'unittests/Support/DynamicLibrary/PipSqueak.cxx')
-rw-r--r--unittests/Support/DynamicLibrary/PipSqueak.cxx34
1 files changed, 18 insertions, 16 deletions
diff --git a/unittests/Support/DynamicLibrary/PipSqueak.cxx b/unittests/Support/DynamicLibrary/PipSqueak.cxx
index d1cf7c042b72..79cf59255a4f 100644
--- a/unittests/Support/DynamicLibrary/PipSqueak.cxx
+++ b/unittests/Support/DynamicLibrary/PipSqueak.cxx
@@ -9,38 +9,40 @@
#include "PipSqueak.h"
-#if defined(_WIN32) && !defined(__GNUC__)
-// Disable warnings from inclusion of xlocale & exception
-#pragma warning(push)
-#pragma warning(disable: 4530)
-#pragma warning(disable: 4577)
-#include <string>
-#pragma warning(pop)
-#else
-#include <string>
-#endif
-
struct Global {
std::string *Str;
- Global() : Str(nullptr) {}
+ std::vector<std::string> *Vec;
+ Global() : Str(nullptr), Vec(nullptr) {}
~Global() {
- if (Str)
+ if (Str) {
+ if (Vec)
+ Vec->push_back(*Str);
*Str = "Global::~Global";
+ }
}
};
+static Global Glb;
+
struct Local {
std::string &Str;
- Local(std::string &S) : Str(S) { Str = "Local::Local"; }
+ Local(std::string &S) : Str(S) {
+ Str = "Local::Local";
+ if (Glb.Str && !Glb.Str->empty())
+ Str += std::string("(") + *Glb.Str + std::string(")");
+ }
~Local() { Str = "Local::~Local"; }
};
-static Global Glb;
extern "C" PIPSQUEAK_EXPORT void SetStrings(std::string &GStr,
std::string &LStr) {
- static Local Lcl(LStr);
Glb.Str = &GStr;
+ static Local Lcl(LStr);
+}
+
+extern "C" PIPSQUEAK_EXPORT void TestOrder(std::vector<std::string> &V) {
+ Glb.Vec = &V;
}
extern "C" PIPSQUEAK_EXPORT const char *TestA() { return "LibCall"; }