If -std=cXX option is passed to gcc/clang then sigset_t is undefined,
thus GC_pthread_sigmask declaration should be omitted. However, this
symbol should be available during GC source code audit by cppcheck.
* include/gc_pthread_redirects.h [!GC_NO_PTHREAD_SIGMASK]
(GC_pthread_sigmask): Declare only if GC_PTHREAD_SIGMASK_NEEDED or
_POSIX_C_SOURCE >= 199506 or _XOPEN_SOURCE >= 500.
* tests/test.c [CPPCHECK] (GC_PTHREAD_SIGMASK_NEEDED): Define (before
include gc.h).
* tests/test.c [CPPCHECK && !_GNU_SOURCE] (_GNU_SOURCE): Likewise.
GC_API void *GC_dlopen(const char * /* path */, int /* mode */);
# endif /* !GC_NO_DLOPEN */
-# ifndef GC_NO_PTHREAD_SIGMASK
+# if !defined(GC_NO_PTHREAD_SIGMASK) \
+ && (defined(GC_PTHREAD_SIGMASK_NEEDED) \
+ || _POSIX_C_SOURCE >= 199506L || _XOPEN_SOURCE >= 500)
# include <signal.h>
GC_API int GC_pthread_sigmask(int /* how */, const sigset_t *,
sigset_t * /* oset */);
# define GC_DEBUG
#endif
+#ifdef CPPCHECK
+# define GC_PTHREAD_SIGMASK_NEEDED
+# ifndef _GNU_SOURCE
+# define _GNU_SOURCE 1
+# endif
+#endif
#undef GC_NO_THREAD_REDIRECTS
#include "gc.h"