Closed smcv closed 1 year ago
Reproducer:
#include "SDL.h"
struct a {
int b;
};
int main(void)
{
return offsetof(struct a, b);
}
gcc -ot t.c $(pkg-config --cflags --libs sdl)
with sdl12-compat 1.2.64 ⇒ fails
gcc -ot t.c -Iinclude/SDL
without #298 ⇒ fails
gcc -ot t.c -Iinclude/SDL
with #298 ⇒ succeeds
I've been trying to rebuild various Debian packages against sdl12-compat headers, which is likely to be a prerequisite for Debian switching to sdl12-compat (not because we'll actually rebuild them - I know sdl12-compat is binary-compatible with classic SDL 1.2 - but because the release managers will want to know that we can rebuild them if/when they need unrelated bug fixes).
One game, berusky, compiles OK with classic SDL 1.2, but failed to compile with sdl12-compat headers:
This appears to be because classic SDL 1.2 has an
AC_CHECK_HEADERS
forstddef.h
(the C equivalent of<cstddef>
, with a definition ofoffsetof
), but the substituteSDL_config.h
in sdl12-compat doesn't defineHAVE_STDDEF_H
, resulting inSDL_stdinc.h
not includingstddef.h
.stddef.h
is required by C89, and is unconditionally included by even very portable libraries likelibdbus
, so it should be safe to defineHAVE_STDDEF_H
and include<stddef.h>
unconditionally on all platforms.