Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2010-03-02 22:28:39 +0300
committerJeff Johnston <jjohnstn@redhat.com>2010-03-02 22:28:39 +0300
commit6fc25b2d1e77e48241219400fe840249697c6a56 (patch)
tree5a46b381ebcc19ceb2f7e59e56ca10926bcdbfd7
parent180044b3867145dbbe8ce421dbeff0df425b74ce (diff)
2010-03-02 Craig Howland <howland@LGSInnovations.com>
* libc/include/sys/features.h: Add POSIX.1-permitted definition of _POSIX_C_SOURCE if not already defined and _XOPEN_SOURCE has an appropriate value. Specifically, check for POSIX.1-2008 & 2001 values. * libc/include/sys/config.h: Add #include <sys/features.h> so that all includes get the new check added to it.
-rw-r--r--newlib/ChangeLog8
-rw-r--r--newlib/libc/include/sys/config.h1
-rw-r--r--newlib/libc/include/sys/features.h13
3 files changed, 22 insertions, 0 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog
index 14be98efb..be249d8b7 100644
--- a/newlib/ChangeLog
+++ b/newlib/ChangeLog
@@ -1,3 +1,11 @@
+2010-03-02 Craig Howland <howland@LGSInnovations.com>
+
+ * libc/include/sys/features.h: Add POSIX.1-permitted definition of
+ _POSIX_C_SOURCE if not already defined and _XOPEN_SOURCE has an
+ appropriate value. Specifically, check for POSIX.1-2008 & 2001 values.
+ * libc/include/sys/config.h: Add #include <sys/features.h> so that all
+ includes get the new check added to it.
+
2010-03-02 Charles Wilson <cygwin@cwilson.fastmail.fm>
* libc/xdr/README: Correct grammatical errors.
diff --git a/newlib/libc/include/sys/config.h b/newlib/libc/include/sys/config.h
index 49a3d8ac7..71f9d281d 100644
--- a/newlib/libc/include/sys/config.h
+++ b/newlib/libc/include/sys/config.h
@@ -2,6 +2,7 @@
#define __SYS_CONFIG_H__
#include <machine/ieeefp.h> /* floating point macros */
+#include <sys/features.h> /* POSIX defs */
/* exceptions first */
#if defined(__H8500__) || defined(__W65__)
diff --git a/newlib/libc/include/sys/features.h b/newlib/libc/include/sys/features.h
index bc40f0068..e7968e05a 100644
--- a/newlib/libc/include/sys/features.h
+++ b/newlib/libc/include/sys/features.h
@@ -180,6 +180,19 @@ extern "C" {
#endif /* !__STRICT_ANSI__ || __cplusplus || __STDC_VERSION__ >= 199901L */
#endif /* __CYGWIN__ */
+/* 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
+
#ifdef __cplusplus
}
#endif