Browse code

Use the correct definition to obtain snprintf(3)

At some point snprintf(3) prototype became guarded off in stdio.h.
Defining _C99_SOURCE makes it visible.
On legacy Darwin, such a guard was not present so the definition
has no impact on the build, but on "modern" macos it has the desired
effect.
Build tested on OS X 10.4 and macos 10.15.

Sevan Janiyan authored on 15/05/2023 14:33:33 • Devine Lu Linvega committed on 15/05/2023 15:32:48
Showing 2 changed files
... ...
@@ -79,7 +79,7 @@ MSYS_NT*|MINGW*) # MSYS2 on Windows
79 79
 	fi
80 80
 	;;
81 81
 Darwin) # macOS
82
-	CFLAGS="${CFLAGS} -Wno-typedef-redefinition"
82
+	CFLAGS="${CFLAGS} -Wno-typedef-redefinition -D_C99_SOURCE"
83 83
 	UXNEMU_LDFLAGS="$(brew --prefix)/lib/libSDL2.a $(sdl2-config --cflags --static-libs | sed -e 's/-lSDL2 //')"
84 84
 	;;
85 85
 Linux|*)
... ...
@@ -26,10 +26,6 @@
26 26
 #define PATH_MAX 4096
27 27
 #endif
28 28
 
29
-#ifdef __APPLE__
30
-int snprintf(char *, unsigned long, const char *, ...);
31
-#endif
32
-
33 29
 #include "../uxn.h"
34 30
 #include "file.h"
35 31