This is “interesting” behavior (and breaks my build, but then, I’m doing
something a bit weird):
I’m building SDL 2.0.0 on my main development box, which runs Debian sid AMD64
with GCC 4.7.3 (Debian 4.7.3-4). The autoconf-based configure for it detects
functions like strdup and setenv being available, which they are, provided
the correct feature test macros are active. However, trying to build a test
application results in:
SDL_stdinc.h: In function ?SDL_setenv_inline?:
SDL_stdinc.h:282:1: error: implicit declaration of function ?setenv? [-Werror=implicit-function-declaration]
SDL_stdinc.h: In function ?SDL_strdup_inline?:
SDL_stdinc.h:485:1: error: implicit declaration of function ?strdup? [-Werror=implicit-function-declaration]
SDL_stdinc.h:485:61: error: return makes pointer from integer without a cast [-Werror]
I’m guessing this is because I’m compiling my application with -std=c99. If I
use -std=gnu99, for instance, the errors go away, but don’t I lose my more
explicit portability control that way. I’d just as soon not have so much
transitive header cruft anyway (cf. SDL_syswm.h not being included by default),
but a lot of the public headers depend on SDL_stdinc.h; a cursory glance
suggests that they mainly depend on it for types, so I’m not sure why all the
inlines are stuffed in there too.
My current intended workaround is to just strip all the inline functions from
that file manually, but this seems fragile as well and might wind up requiring
me to keep a local fork if I juggle build environments enough.
Any recommendation on how best to handle this?
—> Drake Wilson