[PATCH] Add simple versions of random() and srandom()
Wed Mar 23 19:29:00 GMT 2016
On Mar 23 15:20, Craig Howland wrote:
> On 03/23/2016 02:00 PM, Yaakov Selkowitz wrote:
> >On 2016-03-23 09:32, Craig Howland wrote:
> >>On 03/23/2016 01:04 AM, Yaakov Selkowitz wrote:
> >>>On 2016-03-22 17:51, Joel Sherrill wrote:
> >>>>Prototypes also added for initstate() and setstate() but they
> >>>>were not implemented.
> >>>This should allow Cygwin to remove its own declarations of these
> >>>>+#if __SVID_VISIBLE || __XSI_VISIBLE >= 4 || __BSD_VISIBLE
> >>>#if __MISC_VISIBLE || __XSI_VISIBLE >= 500
> >>No, the value 4 is actually the right one. At first look I had also
> >>thought that it needed to be 500, but it originated in issue 4 as an
> >>X/OPEN UNIX extension (see
> >>and was moved to BASE in issue 5.
> >Just great, so we have conflicting documentation. :-( I agree with your
> >assessment but Linux man-pages says it's >= 500:
> I have the same error in man random under RHEL6 (which likely comes from the
> URL you reference), but I went straight to POSIX to check under the
> assumption Joel had picked 4 with a reason.
> I just checked further, and their error does seem to be only in the man
> page. At least with GLIBC 2.12 on RHEL6, the headers--referring only to the
> POSIX aspect--need either _XOPEN_SOURCE >= 500 || (defined(_XOPEN_SOURCE) &&
> defined(_XOPEN_SOURCE_EXTENDED). I've sent an email to report the bug on the
> manpage. However, they might have purposely suppressed the additional
> If this macro is defined, and _XOPEN_SOURCE is defined, then
> expose definitions corresponding to the XPG4v2 (SUSv1) UNIX
> extensions (UNIX 95). Defining _XOPEN_SOURCE with a value of 500
> or more also produces the same effect as defining
> _XOPEN_SOURCE_EXTENDED. Use of _XOPEN_SOURCE_EXTENDED in new
> source code should be avoided.
> Since defining _XOPEN_SOURCE with a value of 500 or more has the
> same effect as defining _XOPEN_SOURCE_EXTENDED, the latter
> (obsolete) feature test macro is generally not described in the
> SYNOPSIS in man pages."
> This email is to get the information into the record. Joel's revised patch
> is sufficient for the user to get it to work. (As the quote from the Linux
> man pages points out, new code should not be starting out with _XOPEN_SOURCE
> < 500, anyway.)
I'd still rather opt for correctness in the header if possible.
MISC+XPG4 seems the way to go:
#if __MISC_VISIBLE || __XOPEN_VISIBLE >=4
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 819 bytes
Desc: not available
More information about the Newlib