[flang-commits] [flang] 8b6b882 - [flang] allow _POSIX_SOURCE to be defined without a value (#78179)
via flang-commits
flang-commits at lists.llvm.org
Mon Jan 15 13:54:55 PST 2024
Author: Kelvin Li
Date: 2024-01-15T16:54:51-05:00
New Revision: 8b6b882f27e86bae717ffcbaef6da3f00af86003
URL: https://github.com/llvm/llvm-project/commit/8b6b882f27e86bae717ffcbaef6da3f00af86003
DIFF: https://github.com/llvm/llvm-project/commit/8b6b882f27e86bae717ffcbaef6da3f00af86003.diff
LOG: [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)`.
Added:
Modified:
flang/runtime/extensions.cpp
flang/unittests/Runtime/CommandTest.cpp
Removed:
################################################################################
diff --git a/flang/runtime/extensions.cpp b/flang/runtime/extensions.cpp
index 38a0633a3648d7..2740c854b80781 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 6b30333001d527..5ae0f1c72f92c3 100644
--- a/flang/unittests/Runtime/CommandTest.cpp
+++ b/flang/unittests/Runtime/CommandTest.cpp
@@ -233,7 +233,7 @@ class NoArgv : public CommandFixture {
};
#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);
More information about the flang-commits
mailing list