aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKelvin Li <kkwli@users.noreply.github.com>2024-01-15 16:54:51 -0500
committerGitHub <noreply@github.com>2024-01-15 16:54:51 -0500
commit8b6b882f27e86bae717ffcbaef6da3f00af86003 (patch)
treea6129a0056e4dd0935001588cec5f30cfc2a461a
parentab33c0b96e26430b22e152cb6ecbab54dd2cfa41 (diff)
downloadllvm-8b6b882f27e86bae717ffcbaef6da3f00af86003.zip
llvm-8b6b882f27e86bae717ffcbaef6da3f00af86003.tar.gz
llvm-8b6b882f27e86bae717ffcbaef6da3f00af86003.tar.bz2
[flang] allow _POSIX_SOURCE to be defined without a value (#78179)
The `_POSIX_SOURCE` macro is defined without a value on AIX. Change the check to `defined(_POSIX_SOURCE)`.
-rw-r--r--flang/runtime/extensions.cpp2
-rw-r--r--flang/unittests/Runtime/CommandTest.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/flang/runtime/extensions.cpp b/flang/runtime/extensions.cpp
index 38a0633..2740c85 100644
--- a/flang/runtime/extensions.cpp
+++ b/flang/runtime/extensions.cpp
@@ -24,7 +24,7 @@ inline void CtimeBuffer(char *buffer, size_t bufsize, const time_t cur_time,
RUNTIME_CHECK(terminator, error == 0);
}
#elif _POSIX_C_SOURCE >= 1 || _XOPEN_SOURCE || _BSD_SOURCE || _SVID_SOURCE || \
- _POSIX_SOURCE
+ defined(_POSIX_SOURCE)
inline void CtimeBuffer(char *buffer, size_t bufsize, const time_t cur_time,
Fortran::runtime::Terminator terminator) {
const char *res{ctime_r(&cur_time, buffer)};
diff --git a/flang/unittests/Runtime/CommandTest.cpp b/flang/unittests/Runtime/CommandTest.cpp
index 6b30333..5ae0f1c 100644
--- a/flang/unittests/Runtime/CommandTest.cpp
+++ b/flang/unittests/Runtime/CommandTest.cpp
@@ -233,7 +233,7 @@ protected:
};
#if _WIN32 || _POSIX_C_SOURCE >= 1 || _XOPEN_SOURCE || _BSD_SOURCE || \
- _SVID_SOURCE || _POSIX_SOURCE
+ _SVID_SOURCE || defined(_POSIX_SOURCE)
TEST_F(NoArgv, FdateGetDate) {
char input[]{"24LengthCharIsJustRight"};
const std::size_t charLen = sizeof(input);