[libcxx-commits] [libcxx] [AIX][libc++] fopen() does not support the 'x' (exclusive/noreplace) mode suffix. (PR #206498)
via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Jul 10 09:39:15 PDT 2026
================
@@ -664,6 +674,9 @@ const char* basic_filebuf<_CharT, _Traits>::__make_mdstring(ios_base::openmode _
case ios_base::in | ios_base::app | ios_base::binary:
return "a+b" _LIBCPP_FOPEN_CLOEXEC_MODE;
# if _LIBCPP_STD_VER >= 23
+// AIX fopen() does not support the 'x' (noreplace) mode suffix; these cases fall through to
+// default (return nullptr), which is conformant per C23 7.21.5.3p5 (fail if atomic check-and-create is unsupported).
+# if !defined(_AIX)
----------------
Himadhith wrote:
The guard here is the actual conformance fix — it's independent of the _LIBCPP_DIAGNOSE_WARNING, which is only advisory. Omitting these cases on AIX causes them to fall through to `default: return nullptr`, making `open()` fail as required.
https://github.com/llvm/llvm-project/pull/206498
More information about the libcxx-commits
mailing list