Mercurial > gnulib
changeset 39376:f935df9cb366
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.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Sun, 13 May 2018 21:33:48 +0200 |
parents | 621ae8d62a9b |
children | d4f5e651f17c |
files | ChangeLog lib/get-rusage-as.c lib/vma-iter.c tests/zerosize-ptr.h |
diffstat | 4 files changed, 40 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Sun May 13 20:25:13 2018 +0200 +++ b/ChangeLog Sun May 13 21:33:48 2018 +0200 @@ -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.
--- a/lib/get-rusage-as.c Sun May 13 20:25:13 2018 +0200 +++ b/lib/get-rusage-as.c Sun May 13 21:33:48 2018 +0200 @@ -17,6 +17,18 @@ #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"
--- a/lib/vma-iter.c Sun May 13 20:25:13 2018 +0200 +++ b/lib/vma-iter.c Sun May 13 21:33:48 2018 +0200 @@ -20,9 +20,15 @@ /* 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
--- a/tests/zerosize-ptr.h Sun May 13 20:25:13 2018 +0200 +++ b/tests/zerosize-ptr.h Sun May 13 21:33:48 2018 +0200 @@ -18,6 +18,19 @@ 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.