[libcxx-commits] [PATCH] D76093: Don't expose unavailable cstdio functions.
Dan Albert via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Mar 13 12:23:41 PDT 2020
danalbert updated this revision to Diff 250275.
danalbert added a comment.
Yep, good point. I think we don't run the full libc++ test suite for the broken configuration. Fixed.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D76093/new/
https://reviews.llvm.org/D76093
Files:
libcxx/include/__config
libcxx/include/cstdio
libcxx/test/std/depr/depr.c.headers/stdio_h.pass.cpp
libcxx/test/std/input.output/file.streams/c.files/cstdio.pass.cpp
Index: libcxx/test/std/input.output/file.streams/c.files/cstdio.pass.cpp
===================================================================
--- libcxx/test/std/input.output/file.streams/c.files/cstdio.pass.cpp
+++ libcxx/test/std/input.output/file.streams/c.files/cstdio.pass.cpp
@@ -120,9 +120,13 @@
static_assert((std::is_same<decltype(std::ungetc(0,fp)), int>::value), "");
static_assert((std::is_same<decltype(std::fread((void*)0,0,0,fp)), std::size_t>::value), "");
static_assert((std::is_same<decltype(std::fwrite((const void*)0,0,0,fp)), std::size_t>::value), "");
+#ifndef _LIBCPP_HAS_NO_FGETPOS
static_assert((std::is_same<decltype(std::fgetpos(fp, &fpos)), int>::value), "");
+#endif
static_assert((std::is_same<decltype(std::fseek(fp, 0,0)), int>::value), "");
+#ifndef _LIBCPP_HAS_NO_FSETPOS
static_assert((std::is_same<decltype(std::fsetpos(fp, &fpos)), int>::value), "");
+#endif
static_assert((std::is_same<decltype(std::ftell(fp)), long>::value), "");
static_assert((std::is_same<decltype(std::rewind(fp)), void>::value), "");
static_assert((std::is_same<decltype(std::clearerr(fp)), void>::value), "");
Index: libcxx/test/std/depr/depr.c.headers/stdio_h.pass.cpp
===================================================================
--- libcxx/test/std/depr/depr.c.headers/stdio_h.pass.cpp
+++ libcxx/test/std/depr/depr.c.headers/stdio_h.pass.cpp
@@ -156,9 +156,13 @@
static_assert((std::is_same<decltype(ungetc(0,fp)), int>::value), "");
static_assert((std::is_same<decltype(fread((void*)0,0,0,fp)), size_t>::value), "");
static_assert((std::is_same<decltype(fwrite((const void*)arr,1,0,fp)), size_t>::value), "");
+#ifndef _LIBCPP_HAS_NO_FGETPOS
static_assert((std::is_same<decltype(fgetpos(fp, &fpos)), int>::value), "");
+#endif
static_assert((std::is_same<decltype(fseek(fp, 0,0)), int>::value), "");
+#ifndef _LIBCPP_HAS_NO_FSETPOS
static_assert((std::is_same<decltype(fsetpos(fp, &fpos)), int>::value), "");
+#endif
static_assert((std::is_same<decltype(ftell(fp)), long>::value), "");
static_assert((std::is_same<decltype(rewind(fp)), void>::value), "");
static_assert((std::is_same<decltype(clearerr(fp)), void>::value), "");
Index: libcxx/include/cstdio
===================================================================
--- libcxx/include/cstdio
+++ libcxx/include/cstdio
@@ -131,9 +131,13 @@
using ::ungetc;
using ::fread;
using ::fwrite;
+#ifndef _LIBCPP_HAS_NO_FGETPOS
using ::fgetpos;
+#endif
using ::fseek;
+#ifndef _LIBCPP_HAS_NO_FSETPOS
using ::fsetpos;
+#endif
using ::ftell;
using ::rewind;
using ::clearerr;
Index: libcxx/include/__config
===================================================================
--- libcxx/include/__config
+++ libcxx/include/__config
@@ -1544,6 +1544,14 @@
#define _LIBCPP_BUILTIN_CONSTANT_P(x) false
#endif
+// Support for _FILE_OFFSET_BITS=64 landed gradually in Android, so the full set
+// of functions used in cstdio may not be available for low API levels when
+// using 64-bit file offsets on LP32.
+#if defined(__BIONIC__) && defined(__USE_FILE_OFFSET64) && __ANDROID_API__ < 24
+#define _LIBCPP_HAS_NO_FGETPOS
+#define _LIBCPP_HAS_NO_FSETPOS
+#endif
+
#endif // __cplusplus
#endif // _LIBCPP_CONFIG
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76093.250275.patch
Type: text/x-patch
Size: 3281 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20200313/9932aa09/attachment.bin>
More information about the libcxx-commits
mailing list