bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: EX_OK collision


From: Eric Blake
Subject: Re: EX_OK collision
Date: Sun, 25 Mar 2007 16:30:54 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.10) Gecko/20070221 Thunderbird/1.5.0.10 Mnenhy/0.7.4.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Bruno Haible on 3/25/2007 2:22 PM:
> Warning seen on IRIX 6.5:
> 
> "///usr/include/unistd.h", line 43: warning(1047): macro redefined differently
> 
> IRIX 6.5 has two definitions of EX_OK:
>   - one in <unistd.h>, protected with "#if _SGIAPI", as a flag that can be
>     passed to the access() function, with value 020,
>   - one in <sysexits.h>, always active, as an exit code, with value 0.
> 
> Which definition is active, thus depends on the order of inclusion.

Hmm.  EX_OK is not standardized, nor does it fall within the namespace
reserved for use by unistd.h.  But sysexits.h is not even a standardized
header, so it is less likely to be used in a portable program.  Also,
EXIT_SUCCESS of stdlib.h has been standardized.  And looking at the name,
I recognized the _OK suffix more than the EX_ prefix.

> 
> What should we do?
> 
I would go with option d)

Create a replacement <unistd.h> that does
  #if HAVE_SYSEXITS_H
  # include <sysexits.h>
  #endif
  #undef EX_OK
  #include </usr/include/unistd.h>

with no change to sysexits.h

thereby preventing portable programs from falling into the trap of using
non-portable EX_OK as an exit status, while still allowing IRIX-specific
code to query the extended access() attribute.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGBvgd84KuGfSFAYARAqlGAJ0UAzmjQnlNgY2kkNONHmvKkXIL3ACfaSb9
gbDfIJk4232yYTUOZra53MI=
=LGbS
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]