]> Savannah Git Hosting - gnulib.git/commitdiff
Avoid compilation error due to 'mmap' on Android.
authorBruno Haible <bruno@clisp.org>
Sun, 13 May 2018 19:33:48 +0000 (21:33 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 13 May 2018 19:33:48 +0000 (21:33 +0200)
* lib/vma-iter.c (_FILE_OFFSET_BITS): Undefine on Android.
* lib/get-rusage-as.c (_FILE_OFFSET_BITS): Likewise.
* tests/zerosize-ptr.h (_FILE_OFFSET_BITS, __USE_FILE_OFFSET64):
Undefine on Android.

ChangeLog
lib/get-rusage-as.c
lib/vma-iter.c
tests/zerosize-ptr.h

index 55f4802b8def28ef1f0180fd14ca46935476f8f0..6753aa14be93ef3110a8a52d310c28b091337e49 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2018-05-13  Bruno Haible  <bruno@clisp.org>
+
+       Avoid compilation error due to 'mmap' on Android.
+       * lib/vma-iter.c (_FILE_OFFSET_BITS): Undefine on Android.
+       * lib/get-rusage-as.c (_FILE_OFFSET_BITS): Likewise.
+       * tests/zerosize-ptr.h (_FILE_OFFSET_BITS, __USE_FILE_OFFSET64):
+       Undefine on Android.
+
 2018-05-13  Bruno Haible  <bruno@clisp.org>
 
        Add cross-compilation guesses for Linux systems without glibc.
index 096d3d192acdc32e3d317327cce91869578aa36f..e3c3dfd9391c153698c69d4a233fc5c6905b8db1 100644 (file)
 
 #include <config.h>
 
+/* On Android, when targeting Android 4.4 or older with a GCC toolchain,
+   prevent a compilation error
+     "error: call to 'mmap' declared with attribute error: mmap is not
+      available with _FILE_OFFSET_BITS=64 when using GCC until android-21.
+      Either raise your minSdkVersion, disable _FILE_OFFSET_BITS=64, or
+      switch to Clang."
+   The files that we access in this compilation unit are less than 2 GB
+   large.  */
+#if defined __ANDROID__
+# undef _FILE_OFFSET_BITS
+#endif
+
 /* Specification.  */
 #include "resource-ext.h"
 
index b98b0415fe9ee3aeedac8b26a9d7bd80f21317c4..30d19a521e1d5e026f8770c63b31fcadd39ec304 100644 (file)
 /* On Solaris in 32-bit mode, when gnulib module 'largefile' is in use,
    prevent a compilation error
      "Cannot use procfs in the large file compilation environment"
+   On Android, when targeting Android 4.4 or older with a GCC toolchain,
+   prevent a compilation error
+     "error: call to 'mmap' declared with attribute error: mmap is not
+      available with _FILE_OFFSET_BITS=64 when using GCC until android-21.
+      Either raise your minSdkVersion, disable _FILE_OFFSET_BITS=64, or
+      switch to Clang."
    The files that we access in this compilation unit are less than 2 GB
    large.  */
-#if defined __sun
+#if defined __sun || defined __ANDROID__
 # undef _FILE_OFFSET_BITS
 #endif
 
index e4867e9a01979a8cc4cb52e231f051f3f61a5909..d5592c5858e50d5aecb19f53face84ed5cdaa52e 100644 (file)
    argument.  Therefore this file produces a non-NULL pointer which cannot
    be dereferenced, if possible.  */
 
+/* On Android, when targeting Android 4.4 or older with a GCC toolchain,
+   prevent a compilation error
+     "error: call to 'mmap' declared with attribute error: mmap is not
+      available with _FILE_OFFSET_BITS=64 when using GCC until android-21.
+      Either raise your minSdkVersion, disable _FILE_OFFSET_BITS=64, or
+      switch to Clang."
+   The files that we access in this compilation unit are less than 2 GB
+   large.  */
+#if defined __ANDROID__
+# undef _FILE_OFFSET_BITS
+# undef __USE_FILE_OFFSET64
+#endif
+
 #include <stdlib.h>
 
 /* Test whether mmap() and mprotect() are available.