demos: fail to build on BSDs due to _XOPEN_SOURCE
Regressed by 287684ab. From error log:
demos/plplay.c:532:27: error: implicit declaration of function 'reallocarray' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
void *new_hooks = reallocarray(p->shader_hooks, new_size, sizeof(void *));
^
demos/window_glfw.c:84:32: error: implicit declaration of function 'reallocarray' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
char **new_files = reallocarray(p->files, new_size, sizeof(char *));
^
demos/window_sdl.c:223:32: error: implicit declaration of function 'reallocarray' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
char **new_files = reallocarray(p->files, new_size, sizeof(char *));
^
BSD systems (unlike GNU) expose non-standard interfaces by default. reallocarray is available on DragonFly, FreeBSD, NetBSD, OpenBSD. However, NetBSD hid reallocarray behind _OPENBSD_SOURCE.
To fix drop _XOPEN_SOURCE. It's already bypassed on Linux via _GNU_SOURCE. However, Solaris and BSDs don't support _GNU_SOURCE. DragonFly/FreeBSD/OpenBSD can define __BSD_VISIBLE but this is discouraged.
To work around bundle non-GPL reallocarray from OpenBSD or musl.
Edited by Jan Beich