This is the mail archive of the pthreads-win32@sourceware.org mailing list for the pthreas-win32 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

_POSIX_C_SOURCE-related problems


Hello,

Simple testcase using MinGW gcc 4.2.4, mingw-runtime 3.15, w32api 3.12:

-----------------------------------------------------------------------
ramiro@FOUND ~/code/smalls
$ cat > pthread.c << EOF
> #include <pthread.h>
> EOF

ramiro@FOUND ~/code/smalls
$ gcc -o pthread.o -c pthread.c -D_POSIX_C_SOURCE=200112
In file included from e:/mingw/include/pthread.h:288,
                 from pthread.c:1:
e:/mingw/include/sched.h:152: error: expected ')' before 'pid'
e:/mingw/include/sched.h:154: error: expected ')' before 'pid'
-----------------------------------------------------------------------

This snippet in sched.h (pthreads-w32-2-8-0) starting at line 116 seems suspicious:

-----------------------------------------------------------------------
#if defined(__MINGW32__) || defined(_UWIN)
#if PTW32_LEVEL >= PTW32_LEVEL_MAX
/* For pid_t */
#  include <sys/types.h>
/* Required by Unix 98 */
#  include <time.h>
#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */
#else
typedef int pid_t;
#endif
-----------------------------------------------------------------------

PTW32_LEVEL_MAX is defined to 3 in line 61. PTW32_LEVEL is set to 1 under this snippet starting at line 49:

-----------------------------------------------------------------------
#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309
#undef PTW32_LEVEL
#define PTW32_LEVEL 1
/* Include 1b, 1c and 1d */
#endif
-----------------------------------------------------------------------

I don't understand why sys/types.h isn't included when _POSIX_C_SOURCE is defined to 200112. It should be, right? According to [0], pid_t must be defined in sys/types.h.

Ramiro Polla
[0]http://www.opengroup.org/onlinepubs/009695399/basedefs/sys/types.h.html


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]