Bug#427722: closed by Pierre Habouzit <madcoder@debian.org> (Re: Bug#427722: pthread_kill() declaration disappears when compiling with -ansi)
Thanks for the useful explanation and guidance, I'm sure you know the
language rules better than I (and that you're correct). But....
I had presumed, since pthread_create() and pthread_kill() were both
introduced in the Issue 5 (the "Base Specifications"):
Technical Standard, February 1997, published by The Open Group:
* System Interface Definitions (XBD), Issue 5 (ISBN: 1-85912-186-1, C605)
* Commands and Utilities (XCU), Issue 5 (ISBN: 1-85912-191-8, C604)
* System Interfaces and Headers (XSH), Issue 5 (ISBN: 1-85912-181-0, C606)
that either both should work, or both should fail. The current behavior is
then still wrong, in that pthread_create() should throw up a warning with
-ansi too. (According to http://www.unix.org/single_unix_specification/
anyway.)
pthread_kill() was first specified in Issue 2 of the Single UNIX
Specification V2, which claims to be "fully aligned with ISO/IEC
9899:1990/Amendment 1:1995". Man gcc(1) says -ansi "support[s] all ISO C90
programs". Maybe Issue 2's semi-draft status prevented true support of
pthread_kill() and gcc's man page is overly optimistic!
Odd that they should define pthreads as a language extension, not as a
library.... B-)
Thanks again,
Daniel
P.S., googling features_test_macros returns zero results.
Debian Bug Tracking System scribed the following, on or around Wed, Jun 06, 2007 at 09:09:15AM +0000:
> This is an automatic notification regarding your Bug report
> #427722: pthread_kill() declaration disappears when compiling with -ansi,
> which was filed against the libc6-dev package.
>
> It has been closed by Pierre Habouzit <madcoder@debian.org>.
>
> Their explanation is attached below. If this explanation is
> unsatisfactory and you have not received a better one in a separate
> message then please contact Pierre Habouzit <madcoder@debian.org> by replying
> to this email.
>
> Debian bug tracking system administrator
> (administrator, Debian Bugs database)
>
> From: Pierre Habouzit <madcoder@debian.org>
> To: dfsmith@almaden.ibm.com, 427722-done@bugs.debian.org
> Date: Wed, 6 Jun 2007 11:03:22 +0200
> Subject: Re: Bug#427722: pthread_kill() declaration disappears when compiling with -ansi
>
> On Tue, Jun 05, 2007 at 07:04:27PM -0700, Daniel F. Smith wrote:
> > Package: libc6-dev
> > Version: 2.5-9+b1
> >
> > When compiling with the -ansi flag in gcc, pthread_kill() is implicitly
> > defined. The old behavior worked with -ansi. See this example.
>
> Old behaviour is wrong. pthread_kill is defined in IEEE Std 2003.1
> with threads extensions.
>
> Using -ansi, you use plain old C, with no POSIX extensions, hence need
> to "define" some features see features_test_macros(7).
>
> To have pthread_kill you need to -D_POSIX_C_SOURCE=199506 or
> -D_XOPEN_SOURCE=500 at the strict minimum. (see man page and/or
> <features.h> for explanations).
>
> --
> ??O?? Pierre Habouzit
> ????O madcoder@debian.org
> OOO http://www.madism.org
Reply to: