First attempt at fixing nlohmann doctest compilation error (#4499)

* First attempt at fixing nlohmann doctest compilation error

* fixed compilation issue

* Fixed ApiView generation for azure core
This commit is contained in:
Larry Osterman 2023-03-31 09:36:06 -07:00 committed by GitHub
parent 6999572809
commit 6e810750be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 44 additions and 6 deletions

View File

@ -0,0 +1,19 @@
{
"sourceFilesToProcess": null,
"sourceFilesToSkip": [
],
"additionalIncludeDirectories": [
"../../azure-core/inc"
],
"additionalCompilerSwitches": [
"-D_azure_APIVIEW",
"-D_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH"
],
"allowInternal": true,
"includeDetail": false,
"includePrivate": false,
"filterNamespace": "Azure::",
"reviewName": "Azure Core Tracing Open-Telemetry API Review",
"serviceName": null,
"packageName": "azure-core-tracing-opentelemetry-cpp"
}

View File

@ -9,7 +9,8 @@
"additionalCompilerSwitches": [
"-DBUILD_CURL_HTTP_TRANSPORT_ADAPTER",
"-DBUILD_TRANSPORT_WINHTTP_ADAPTER",
"-DCURL_STATICLIB"
"-DCURL_STATICLIB",
"-D_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH"
],
"allowInternal": true,
"includeDetail": false,

View File

@ -3930,6 +3930,8 @@ namespace {
struct FatalConditionHandler
{
void reset() {}
static void allocateAltStackMem() {}
static void freeAltStackMem() {}
};
#else // DOCTEST_CONFIG_POSIX_SIGNALS || DOCTEST_CONFIG_WINDOWS_SEH
@ -3966,6 +3968,9 @@ namespace {
return EXCEPTION_CONTINUE_SEARCH;
}
static void allocateAltStackMem() {}
static void freeAltStackMem() {}
FatalConditionHandler() {
isSet = true;
// 32k seems enough for doctest to handle stack overflow,
@ -4018,7 +4023,8 @@ namespace {
static bool isSet;
static struct sigaction oldSigActions[DOCTEST_COUNTOF(signalDefs)];
static stack_t oldSigStack;
static char altStackMem[4 * SIGSTKSZ];
static size_t altStackSize;
static char * altStackMem;
static void handleSignal(int sig) {
const char* name = "<unknown signal>";
@ -4034,11 +4040,18 @@ namespace {
raise(sig);
}
static void allocateAltStackMem() {
altStackMem = new char[altStackSize];
}
static void freeAltStackMem() {
delete[] altStackMem;
}
FatalConditionHandler() {
isSet = true;
stack_t sigStack;
sigStack.ss_sp = altStackMem;
sigStack.ss_size = sizeof(altStackMem);
sigStack.ss_size = altStackSize;
sigStack.ss_flags = 0;
sigaltstack(&sigStack, &oldSigStack);
struct sigaction sa = {};
@ -4063,10 +4076,12 @@ namespace {
}
};
bool FatalConditionHandler::isSet = false;
bool FatalConditionHandler::isSet = false;
struct sigaction FatalConditionHandler::oldSigActions[DOCTEST_COUNTOF(signalDefs)] = {};
stack_t FatalConditionHandler::oldSigStack = {};
char FatalConditionHandler::altStackMem[] = {};
stack_t FatalConditionHandler::oldSigStack = {};
size_t FatalConditionHandler::altStackSize = 4 * SIGSTKSZ;
char * FatalConditionHandler::altStackMem = nullptr;
#endif // DOCTEST_PLATFORM_WINDOWS
#endif // DOCTEST_CONFIG_POSIX_SIGNALS || DOCTEST_CONFIG_WINDOWS_SEH
@ -5687,7 +5702,10 @@ int Context::run() {
p->cout = &fstr;
}
FatalConditionHandler::allocateAltStackMem();
auto cleanup_and_return = [&]() {
FatalConditionHandler::freeAltStackMem();
if(fstr.is_open())
fstr.close();