This is the mail archive of the
mailing list for the newlib project.
Re: [PATCH] Add simple versions of random() and srandom()
- From: Craig Howland <howland at LGSInnovations dot com>
- To: <newlib at sourceware dot org>
- Date: Wed, 23 Mar 2016 15:20:55 -0400
- Subject: Re: [PATCH] Add simple versions of random() and srandom()
- Authentication-results: sourceware.org; auth=none
- References: <1458687116-16115-1-git-send-email-joel at rtems dot org> <56F223E9 dot 7050300 at cygwin dot com> <56F2A8E7 dot 8020707 at LGSInnovations dot com> <56F2D9D0 dot 9000109 at cygwin dot com>
On 03/23/2016 02:00 PM, Yaakov Selkowitz wrote:
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 clarifier:
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:
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,