[PATCH] Prototype initstate() etc. if _XOPEN_SOURCE is defined appropriately

2013-11-13 Thread Jon TURNEY

Not sure if this is wanted, but mesa likes to compile with '-std=c99
D_XOPEN_SOURCE=500', which leads to exciting crashes on x86_64 because
initstate() is not prototyped.

2013-11-13  Jon TURNEY  

* include/cygwin/stdlib.h(initstate, random, setstate, srandom) :
Prototype if not __STRICT_ANSI__ or _XOPEN_SOURCE is defined 
appropriately.
Index: cygwin/include/cygwin/stdlib.h
===
RCS file: /cvs/src/src/winsup/cygwin/include/cygwin/stdlib.h,v
retrieving revision 1.13
diff -u -u -p -r1.13 stdlib.h
--- cygwin/include/cygwin/stdlib.h  21 May 2013 19:04:49 -  1.13
+++ cygwin/include/cygwin/stdlib.h  13 Nov 2013 14:28:35 -
@@ -31,10 +31,14 @@ voidsetprogname (const char *);
 char *realpath (const char *, char *);
 char *canonicalize_file_name (const char *);
 int unsetenv (const char *);
+#endif /*__STRICT_ANSI__*/
+#if !defined(__STRICT_ANSI__) || (_XOPEN_SOURCE >= 500) || 
(defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED))
 char *initstate (unsigned seed, char *state, size_t size);
 long random (void);
 char *setstate (const char *state);
 void srandom (unsigned);
+#endif
+#ifndef __STRICT_ANSI__
 char *ptsname (int);
 int ptsname_r(int, char *, size_t);
 int getpt (void);


Re: [PATCH] Prototype initstate() etc. if _XOPEN_SOURCE is defined appropriately

2013-11-13 Thread Christopher Faylor
On Wed, Nov 13, 2013 at 02:37:00PM +, Jon TURNEY wrote:
>
>Not sure if this is wanted, but mesa likes to compile with '-std=c99
>D_XOPEN_SOURCE=500', which leads to exciting crashes on x86_64 because
>initstate() is not prototyped.
>
>2013-11-13  Jon TURNEY  
>
>   * include/cygwin/stdlib.h(initstate, random, setstate, srandom) :
>   Prototype if not __STRICT_ANSI__ or _XOPEN_SOURCE is defined 
> appropriately.

Looks good to me.  Please commit.

cgf

>Index: cygwin/include/cygwin/stdlib.h
>===
>RCS file: /cvs/src/src/winsup/cygwin/include/cygwin/stdlib.h,v
>retrieving revision 1.13
>diff -u -u -p -r1.13 stdlib.h
>--- cygwin/include/cygwin/stdlib.h 21 May 2013 19:04:49 -  1.13
>+++ cygwin/include/cygwin/stdlib.h 13 Nov 2013 14:28:35 -
>@@ -31,10 +31,14 @@ void   setprogname (const char *);
> char *realpath (const char *, char *);
> char *canonicalize_file_name (const char *);
> int unsetenv (const char *);
>+#endif /*__STRICT_ANSI__*/
>+#if !defined(__STRICT_ANSI__) || (_XOPEN_SOURCE >= 500) || 
>(defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED))
> char *initstate (unsigned seed, char *state, size_t size);
> long random (void);
> char *setstate (const char *state);
> void srandom (unsigned);
>+#endif
>+#ifndef __STRICT_ANSI__
> char *ptsname (int);
> int ptsname_r(int, char *, size_t);
> int getpt (void);



Re: [PATCH] Prototype initstate() etc. if _XOPEN_SOURCE is defined appropriately

2013-11-13 Thread Corinna Vinschen
On Nov 13 14:37, Jon TURNEY wrote:
> 
> Not sure if this is wanted, but mesa likes to compile with '-std=c99
> D_XOPEN_SOURCE=500', which leads to exciting crashes on x86_64 because
> initstate() is not prototyped.
> 
> 2013-11-13  Jon TURNEY  <...>
> 
>   * include/cygwin/stdlib.h(initstate, random, setstate, srandom) :
>   Prototype if not __STRICT_ANSI__ or _XOPEN_SOURCE is defined 
> appropriately.

Looks good to me.  Please apply.


Thanks,
Corinna

-- 
Corinna Vinschen  Please, send mails regarding Cygwin to
Cygwin Maintainer cygwin AT cygwin DOT com
Red Hat


pgpVwlWc5iiFF.pgp
Description: PGP signature