[libcxx-commits] [PATCH] D76093: Don't expose unavailable cstdio functions.

Dan Albert via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Mar 12 12:29:02 PDT 2020


danalbert created this revision.
danalbert added a reviewer: EricWF.
danalbert added a project: libc++.
Herald added a subscriber: krytarowski.
Herald added a reviewer: mclow.lists.
Herald added a reviewer: libc++.

These aren't available on Android in all configurations.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D76093

Files:
  libcxx/include/__config
  libcxx/include/cstdio


Index: libcxx/include/cstdio
===================================================================
--- libcxx/include/cstdio
+++ libcxx/include/cstdio
@@ -131,9 +131,13 @@
 using ::ungetc;
 using ::fread;
 using ::fwrite;
+#ifdef _LIBCPP_HAS_FGETPOS
 using ::fgetpos;
+#endif
 using ::fseek;
+#ifdef _LIBCPP_HAS_FSETPOS
 using ::fsetpos;
+#endif
 using ::ftell;
 using ::rewind;
 using ::clearerr;
Index: libcxx/include/__config
===================================================================
--- libcxx/include/__config
+++ libcxx/include/__config
@@ -1544,6 +1544,15 @@
 #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(__ANDROID__) || !defined(__USE_FILE_OFFSET64) ||                  \
+    (__ANDROID_API__ >= 24)
+#define _LIBCPP_HAS_FGETPOS
+#define _LIBCPP_HAS_FSETPOS
+#endif
+
 #endif // __cplusplus
 
 #endif // _LIBCPP_CONFIG


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76093.250023.patch
Type: text/x-patch
Size: 1057 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20200312/9cb09a1a/attachment.bin>


More information about the libcxx-commits mailing list