mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
We need to be able to locate `swift-backtrace` relative to the current location of the runtime library. This needs to work: * In a Swift build directory. * On Darwin, where we're installed in /usr/lib/swift and /usr/libexec/swift. * On Linux, where we're in /usr/lib/swift/linux and /usr/libexec/swift/linux. * On Windows, where we may be in a flat directory layout (because of limitations of Windows DLL lookups). rdar://103071801
58 lines
2.1 KiB
C++
58 lines
2.1 KiB
C++
//===--- EnvironmentVariables.h - Debug variables. --------------*- C++ -*-===//
|
|
//
|
|
// This source file is part of the Swift.org open source project
|
|
//
|
|
// Copyright (c) 2014 - 2020 Apple Inc. and the Swift project authors
|
|
// Licensed under Apache License v2.0 with Runtime Library Exception
|
|
//
|
|
// See https://swift.org/LICENSE.txt for license information
|
|
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// Debug behavior conditionally enabled using environment variables.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "swift/Threading/Once.h"
|
|
|
|
namespace swift {
|
|
namespace runtime {
|
|
namespace environment {
|
|
|
|
void initialize(void *);
|
|
|
|
extern swift::once_t initializeToken;
|
|
|
|
// Define a typedef "string" in swift::runtime::environment to make string
|
|
// environment variables work
|
|
using string = const char *;
|
|
|
|
// Declare backing variables.
|
|
#define VARIABLE(name, type, defaultValue, help) extern type name ## _variable;
|
|
#include "../../../stdlib/public/runtime/EnvironmentVariables.def"
|
|
|
|
// Define getter functions.
|
|
#define VARIABLE(name, type, defaultValue, help) \
|
|
inline type name() { \
|
|
swift::once(initializeToken, initialize, nullptr); \
|
|
return name##_variable; \
|
|
}
|
|
#include "../../../stdlib/public/runtime/EnvironmentVariables.def"
|
|
|
|
// Wrapper around SWIFT_DEBUG_CONCURRENCY_ENABLE_COOPERATIVE_QUEUES that the
|
|
// Concurrency library can call.
|
|
SWIFT_RUNTIME_STDLIB_SPI bool concurrencyEnableCooperativeQueues();
|
|
|
|
// Wrapper around SWIFT_ENABLE_ASYNC_JOB_DISPATCH_INTEGRATION that the
|
|
// Concurrency library can call.
|
|
SWIFT_RUNTIME_STDLIB_SPI bool concurrencyEnableJobDispatchIntegration();
|
|
|
|
// Wrapper around SWIFT_DEBUG_VALIDATE_UNCHECKED_CONTINUATIONS that the
|
|
// Concurrency library can call.
|
|
SWIFT_RUNTIME_STDLIB_SPI bool concurrencyValidateUncheckedContinuations();
|
|
|
|
} // end namespace environment
|
|
} // end namespace runtime
|
|
} // end namespace Swift
|