mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
runtime: tweak the environment handling
We would previously enable "environment variables" on Android via global properties. Re-order the macros a bit to make it more explicit that the environment handling is required for that and remove it when environment variables are unsupported.
This commit is contained in:
@@ -173,7 +173,9 @@ void printHelp(const char *extra) {
|
||||
// Initialization code.
|
||||
swift::once_t swift::runtime::environment::initializeToken;
|
||||
|
||||
#if SWIFT_STDLIB_HAS_ENVIRON && (defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__linux__))
|
||||
#if SWIFT_STDLIB_HAS_ENVIRON
|
||||
|
||||
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__linux__)
|
||||
extern "C" char **environ;
|
||||
#define ENVIRON environ
|
||||
#elif defined(_WIN32)
|
||||
@@ -213,11 +215,11 @@ static void platformInitialize(void *context) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !SWIFT_STDLIB_HAS_ENVIRON
|
||||
void swift::runtime::environment::initialize(void *context) {
|
||||
platformInitialize(context);
|
||||
}
|
||||
#elif defined(ENVIRON)
|
||||
#endif
|
||||
|
||||
#if SWIFT_STDLIB_HAS_ENVIRON
|
||||
|
||||
#if defined(ENVIRON)
|
||||
void swift::runtime::environment::initialize(void *context) {
|
||||
// On platforms where we have an environment variable array available, scan it
|
||||
// directly. This optimizes for the common case where no variables are set,
|
||||
@@ -295,6 +297,11 @@ void swift::runtime::environment::initialize(void *context) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#else
|
||||
void swift::runtime::environment::initialize(void *context) {
|
||||
}
|
||||
#endif
|
||||
|
||||
SWIFT_RUNTIME_EXPORT
|
||||
bool swift_COWChecksEnabled() {
|
||||
return runtime::environment::SWIFT_DEBUG_ENABLE_COW_CHECKS();
|
||||
|
||||
Reference in New Issue
Block a user