Merge bitcoin/bitcoin#22069: fuzz: don't try and use fopencookie() when building for Android

1be6267ce1ee142c3b90baed1925a82eab6514aa fuzz: don't try and use fopencookie when building for Android (fanquake)

Pull request description:

  When building for Android, `_GNU_SOURCE` will be defined:
  ```bash
  /home/ubuntu/android-sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android30-clang++ -dM -E -x c++ - < /dev/null
  #define _GNU_SOURCE 1
  #define _LP64 1
  #define __AARCH64EL__ 1
  #define __AARCH64_CMODEL_SMALL__ 1
  #define __ANDROID_API__ 30
  #define __ANDROID__ 1
  #define __ARM_64BIT_STATE 1
  .....
  ```
  but it doesn't have the [`fopencookie()` function](https://www.gnu.org/software/libc/manual/html_node/Streams-and-Cookies.html), or define the `cookie_io_functions_t` type, which results in compile failures:
  ```bash
  In file included from test/fuzz/addition_overflow.cpp:7:
  ./test/fuzz/util.h:388:15: error: unknown type name 'cookie_io_functions_t'
          const cookie_io_functions_t io_hooks = {
                ^
  15 warnings and 1 error generated.
  ```

  Just skip trying to use it if we are building for Android. Should fix #22062.

ACKs for top commit:
  practicalswift:
    cr ACK 1be6267ce1ee142c3b90baed1925a82eab6514aa

Tree-SHA512: d62f63d0624af04b76c7e07b0332c71eca2bf9cd9e096a60aea9e212b7bbc1548e9fa9a76d065ec719bb345fe8726619c3bd2d0631f54d877c82972b7b289321
This commit is contained in:
MarcoFalke 2021-05-26 07:44:31 +02:00 committed by UdjinM6
parent ec1007efce
commit 64f05c7941

View File

@ -345,7 +345,7 @@ public:
[&] { [&] {
mode = "a+"; mode = "a+";
}); });
#ifdef _GNU_SOURCE #if defined _GNU_SOURCE && !defined __ANDROID__
const cookie_io_functions_t io_hooks = { const cookie_io_functions_t io_hooks = {
FuzzedFileProvider::read, FuzzedFileProvider::read,
FuzzedFileProvider::write, FuzzedFileProvider::write,