[libcxx-commits] [PATCH] D139497: [libc++][Android] Bionic also includes + for NAN
Ryan Prichard via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Dec 6 19:21:42 PST 2022
rprichard updated this revision to Diff 480743.
rprichard added a comment.
L MR1 (5.1) is API 22.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D139497/new/
https://reviews.llvm.org/D139497
Files:
libcxx/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.pass.cpp
libcxx/utils/libcxx/test/features.py
Index: libcxx/utils/libcxx/test/features.py
===================================================================
--- libcxx/utils/libcxx/test/features.py
+++ libcxx/utils/libcxx/test/features.py
@@ -142,6 +142,24 @@
}
""")),
+ # Check for an Android NAN printf change. Considering NAN and -NAN:
+ # - Android L (APIs 21 and 22): "%f" and "%+f" print "nan".
+ # - Android M (API 23) and up: "%f" prints "nan" or "-nan", "%+f" prints
+ # "+nan" or "-nan".
+ # Set this feature for L, where the sign is never printed. Otherwise, "%+f"
+ # for non-negative NAN prints the '+' sign.
+ Feature(name='android-printf-nan-no-sign',
+ when=lambda cfg: '__ANDROID__' in compilerMacros(cfg) and not programSucceeds(cfg, """
+ #include <math.h>
+ #include <stdio.h>
+ int main(int, char**) {
+ char buf[100];
+ snprintf(buf, sizeof(buf), "%+f", NAN);
+ return buf[0] != '+';
+ }
+ """),
+ actions=[AddCompileFlag('-D_LIBCPP_TESTING_ANDROID_PRINTF_NAN_NO_SIGN')]),
+
# Whether Bash can run on the executor.
# This is not always the case, for example when running on embedded systems.
#
Index: libcxx/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.pass.cpp
===================================================================
--- libcxx/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.pass.cpp
+++ libcxx/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long_double.pass.cpp
@@ -10732,7 +10732,8 @@
std::string nan= "nan";
std::string NaN = "NAN";
std::string nan_padding25 = "**********************";
-#if defined(TEST_HAS_GLIBC) || defined(_WIN32)
+#if defined(TEST_HAS_GLIBC) || defined(_WIN32) || \
+ (defined(__BIONIC__) && !defined(_LIBCPP_TESTING_ANDROID_PRINTF_NAN_NO_SIGN))
std::string pnan_sign = "+";
std::string pnan_padding25 = "*********************";
#else
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D139497.480743.patch
Type: text/x-patch
Size: 2116 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20221207/d6bee752/attachment-0001.bin>
More information about the libcxx-commits
mailing list