This is the mail archive of the
pthreads-win32@sourceware.org
mailing list for the pthreas-win32 project.
warning with _POSIX_C_SOURCE and PTW32_LEVEL
- From: "Burkhardt, Glenn UTAS" <Glenn dot Burkhardt at utas dot utc dot com>
- To: "pthreads-win32 at sourceware dot org" <pthreads-win32 at sourceware dot org>
- Date: Wed, 11 Sep 2013 18:24:18 +0000
- Subject: warning with _POSIX_C_SOURCE and PTW32_LEVEL
- Authentication-results: sourceware.org; auth=none
I'm seeing a CPP warning when _POSIX_C_SOURCE is defined
$ cpp -D_POSIX_C_SOURCE=200809L pthread.h > /dev/null
pthread.h:108:0: warning: "PTW32_LEVEL" redefined [enabled by default]
pthread.h:95:0: note: this is the location of the previous definition
$ cpp -D_POSIX_C_SOURCE=200809L sched.h > /dev/null
sched.h:64:0: warning: "PTW32_SCHED_LEVEL" redefined [enabled by default]
sched.h:51:0: note: this is the location of the previous definition
$ cpp --version
cpp.exe (GCC) 4.7.0
and my reading of the code in pthread.h indicates that the warning is valid:
first:
#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309
#undef PTW32_LEVEL
#define PTW32_LEVEL 1
/* Include 1b, 1c and 1d */
#endif
defines PTW32_LEVEL, and then
#if ( defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112 ) || !defined(PTW32_LEVEL)
#define PTW32_LEVEL PTW32_LEVEL_MAX
/* Include everything */
#endif
so when _POSIX_C_SOURCE=200809L, PTW32_LEVEL gets defined twice.
Seems like a bug...