Index: ChangeLog =================================================================== RCS file: /cvs/src/src/newlib/ChangeLog,v retrieving revision 1.1487 diff -p -u -r1.1487 ChangeLog --- ChangeLog 25 Feb 2010 16:16:15 -0000 1.1487 +++ ChangeLog 25 Feb 2010 17:26:33 -0000 @@ -1,3 +1,10 @@ +2010-02-25 Craig Howland + + * libc/include/sys/config.h: Add POSIX.1-permitted definition of + _POSIX_C_SOURCE if not already defined and _XOPEN_SOURCE has an + appropriate value. (Since config.h gets included everywhere, it is + a good spot for this.) Specifically, check for POSIX.1-2008 value. + 2010-02-25 Corinna Vinschen * libc/locale/locale.c (loadlocale): Fix typo in comment. Index: libc/include/sys/config.h =================================================================== RCS file: /cvs/src/src/newlib/libc/include/sys/config.h,v retrieving revision 1.56 diff -p -u -r1.56 config.h --- libc/include/sys/config.h 10 Dec 2009 17:12:11 -0000 1.56 +++ libc/include/sys/config.h 25 Feb 2010 17:26:33 -0000 @@ -1,6 +1,19 @@ #ifndef __SYS_CONFIG_H__ #define __SYS_CONFIG_H__ +/* Per the permission given in POSIX.1-2008 section 2.2.1, define + * _POSIX_C_SOURCE if _XOPEN_SOURCE is defined and _POSIX_C_SOURCE is not. + * (_XOPEN_SOURCE indicates that XSI extensions are desired by an application.) + * This permission is first granted in 2008, but it is used for 2001, anyway. + */ +#if !defined(_POSIX_C_SOURCE) && defined(_XOPEN_SOURCE) + #if _XOPEN_SOURCE == 700 /* POSIX.1-2008 */ + #define _POSIX_C_SOURCE 200809L + #elif _XOPEN_SOURCE == 600 /* POSIX.1-2001 */ + #define _POSIX_C_SOURCE 200112L + #endif +#endif + #include /* floating point macros */ /* exceptions first */