Bug 187378 - [headers] stdlib.h doesn't define W* macros (e.g. WEXITSTATUS)
Summary: [headers] stdlib.h doesn't define W* macros (e.g. WEXITSTATUS)
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: standards (show other bugs)
Version: CURRENT
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-standards (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-08 17:20 UTC by Roman Bogorodskiy
Modified: 2017-12-31 22:23 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Roman Bogorodskiy freebsd_committer freebsd_triage 2014-03-08 17:20:00 UTC
As per this document:

http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/stdlib.h.html

stdlib.h should define W* macros like WEXITSTATUS etc. However, it doesn't.

On 10-STABLE, I get:

(21:13) novel@kloomba:~ %> cat stdlib_wmacros.c
#include <stdlib.h>

#ifndef WEXITSTATUS
# error WEXITSTATUS not defined
#endif
(21:13) novel@kloomba:~ %> cc -c stdlib_wmacros.c 
stdlib_wmacros.c:4:3: error: WEXITSTATUS not defined
# error WEXITSTATUS not defined
  ^
1 error generated.
(21:13) novel@kloomba:~ %>

The same test on Fedora 18:

(12:17) novel@localhost:~ %> cat stdlib_wmacros.c
#include <stdlib.h>

#ifndef WEXITSTATUS
# error WEXITSTATUS not defined
#endif
(12:17) novel@localhost:~ %> gcc -c stdlib_wmacros.c
(12:18) novel@localhost:~ %>
Comment 1 Peter Pentchev 2014-03-11 16:24:43 UTC
FWIW, this is even documented in FreeBSD's stdlib.h :)

/* XXX XSI requires pollution from <sys/wait.h> here.  We'd rather not. */

Yes, I know this doesn't help you much; I'm just trying to point out
that, well, this is not an accidental omission, but a deliberate design
decision.  For the reasons for it you'll have to ask the people who did
it - this particular text seems to have been added by Garrett Wollman
back in 2002, but I think that he was just documenting the status quo
rather than making a decision right there and then.

G'luck,
Peter

-- 
Peter Pentchev	roam@ringlet.net roam@FreeBSD.org p.penchev@storpool.com
PGP key:	http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint 2EE7 A7A5 17FC 124C F115  C354 651E EFB0 2527 DF13
This sentence claims to be an Epimenides paradox, but it is lying.
Comment 2 Roman Bogorodskiy freebsd_committer freebsd_triage 2014-03-11 16:52:34 UTC
Thanks for pointing that out, I didn't notice that comment. Anyway, I
found the commit that introduces this comment:

http://svnweb.freebsd.org/base/head/include/stdlib.h?annotate=103728

Unfortunately, commit message doesn't provide reasoning about that.

I've CCed wollman@.

Roman Bogorodskiy
Comment 3 Garrett Wollman 2014-03-11 18:15:41 UTC
In IEEE Std.1003.1-2001 (SUSv6), those macros were marked as XSI
extensions.  FreeBSD does not claim to implement XSI (which mostly
memorializes old System V mistakes that the vendors who control The
Open Group were unwilling to give up on).  In IEEE Std.1003.1-2008
(SUSv7), they are marked CX (mandatory C extensions) instead.  The
change history is unhelpful; I've sent a query to the Austin Group
list asking if anyone can recall why this change was made.

-GAWollman
Comment 4 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:58:38 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped