warning with _POSIX_C_SOURCE and PTW32_LEVEL

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

warning with _POSIX_C_SOURCE and PTW32_LEVEL

Burkhardt, Glenn UTAS
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...