Fix finalize.c compilation in 'strict ANSI' mode
authorIvan Maidanski <ivmai@mail.ru>
Thu, 23 Mar 2017 20:12:07 +0000 (23:12 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Thu, 23 Mar 2017 20:12:07 +0000 (23:12 +0300)
This and some other GC .c files include gc_pmark.h directly (not
gc_priv.h), so the compiler complains that sigset_t (used in
gc_pthread_redirects.h) is undefined if 'strict ANSI' mode is on and
_GNU_SOURCE is not defined before including system headers.

* include/private/gc_pmark.h [(__linux__ || __GLIBC__ || __GNU__)
&& GC_PTHREADS && !GC_NO_PTHREAD_SIGMASK] (_GNU_SOURCE): Define (before
including other headers).

include/private/gc_pmark.h

index cb65f3d..1d48fe3 100644 (file)
 # define GC_BUILD
 #endif
 
+#if (defined(__linux__) || defined(__GLIBC__) || defined(__GNU__)) \
+    && !defined(_GNU_SOURCE) && defined(GC_PTHREADS) \
+    && !defined(GC_NO_PTHREAD_SIGMASK)
+# define _GNU_SOURCE 1
+#endif
+
 #if defined(KEEP_BACK_PTRS) || defined(PRINT_BLACK_LIST)
 # include "dbg_mlc.h"
 #endif