Browse Source

alloca: use alloca from <stdlib.h> on NetBSD

The only generally portable way to do this is to use -std=gnu99,
"#include <stdlib.h>", and write "alloca".
__builtin_alloca does not seem to be available on NetBSD
Anonymous Maarten 1 year ago
parent
commit
d6291d4d42
1 changed files with 6 additions and 0 deletions
  1. 6 0
      include/SDL3/SDL_stdinc.h

+ 6 - 0
include/SDL3/SDL_stdinc.h

@@ -41,6 +41,12 @@
 # ifndef alloca
 #  ifdef HAVE_ALLOCA_H
 #   include <alloca.h>
+#  elif defined(__NETBSD__)
+#   if defined(__STRICT_ANSI__)
+#    define SDL_DISABLE_ALLOCA
+#   else
+#    include <stdlib.h>
+#   endif
 #  elif defined(__GNUC__)
 #   define alloca __builtin_alloca
 #  elif defined(_MSC_VER)