From: Ross Johnson <Ross.Johnson@homemail.com.au>
To: Ramiro Polla <ramiro@lisha.ufsc.br>
Cc: pthreads-win32@sourceware.org
Subject: Re: _POSIX_C_SOURCE-related problems
Date: Mon, 29 Sep 2008 22:56:00 -0000 [thread overview]
Message-ID: <48E15CF6.4020402@homemail.com.au> (raw)
In-Reply-To: <48E1175C.3020400@lisha.ufsc.br>
This came up recently and a temporary fix was placed in CVS (sched.h).
Really though, the PTW32_LEVEL stuff needs to be reviewed and appears to
be incorrect, i.e. the line in both sched.h and pthread.h
#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309
is setting PTW32_LEVEL equal to 1, which is wrong for you (should be 3).
Regards.
Ross
Ramiro Polla wrote:
> 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
>
next prev parent reply other threads:[~2008-09-29 22:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-29 17:59 Ramiro Polla
2008-09-29 22:56 ` Ross Johnson [this message]
2008-09-30 0:10 ` Ramiro Polla
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48E15CF6.4020402@homemail.com.au \
--to=ross.johnson@homemail.com.au \
--cc=pthreads-win32@sourceware.org \
--cc=ramiro@lisha.ufsc.br \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).