Jelajahi Sumber

stb_vorbis.c - Detect `__NEWLIB__` for `alloca.h`

This is needed for `stb_vorbis.c` to compile for the Wii U using
devkitPro.

This should theoretically also fix compilation for the Nintendo
Switch, 3DS, and Wii (with devkitPro, that is) as they all also use
Newlib.

Newlib is also used by Cygwin:
https://cygwin.com/git/?p=newlib-cygwin.git;a=blob;f=newlib/libc/include/alloca.h;h=5d36318914282280b353aed457e1b1f64947b584;hb=HEAD

And the Google Native Client:
https://chromium.googlesource.com/native_client/nacl-newlib/+/refs/heads/master/newlib/libc/include/alloca.h

As you can see from these links, these both provide `alloca.h` as
well, so it appears to be a safe guarantee that `alloca.h` is
available on Newlib.
Clownacy 5 tahun lalu
induk
melakukan
47a3c4f5b5
1 mengubah file dengan 1 tambahan dan 1 penghapusan
  1. 1 1
      stb_vorbis.c

+ 1 - 1
stb_vorbis.c

@@ -577,7 +577,7 @@ enum STBVorbisError
    #if defined(_MSC_VER) || defined(__MINGW32__)
    #if defined(_MSC_VER) || defined(__MINGW32__)
       #include <malloc.h>
       #include <malloc.h>
    #endif
    #endif
-   #if defined(__linux__) || defined(__linux) || defined(__EMSCRIPTEN__)
+   #if defined(__linux__) || defined(__linux) || defined(__EMSCRIPTEN__) || defined(__NEWLIB__)
       #include <alloca.h>
       #include <alloca.h>
    #endif
    #endif
 #else // STB_VORBIS_NO_CRT
 #else // STB_VORBIS_NO_CRT