Print this page
2964 need POSIX 2008 locale object support
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Gordon Ross <gordon.ross@nexenta.com>
Approved by: TBD

@@ -21,10 +21,13 @@
 
 /*
  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
+/*
+ * Copyright 2013 Garrett D'Amore <garrett@damore.org>
+ */
 
 #ifndef _SYS_FEATURE_TESTS_H
 #define _SYS_FEATURE_TESTS_H
 
 #include <sys/ccompile.h>

@@ -41,19 +44,20 @@
  *              1           POSIX.1-1990 compilation
  *              2           POSIX.2-1992 compilation
  *              199309L     POSIX.1b-1993 compilation (Real Time)
  *              199506L     POSIX.1c-1995 compilation (POSIX Threads)
  *              200112L     POSIX.1-2001 compilation (Austin Group Revision)
+ *              200809L     POSIX.1-2008 compilation
  */
 #if defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE)
 #define _POSIX_C_SOURCE 1
 #endif
 
 /*
- * The feature test macros __XOPEN_OR_POSIX, _STRICT_STDC, and _STDC_C99
- * are Sun implementation specific macros created in order to compress
- * common standards specified feature test macros for easier reading.
+ * The feature test macros __XOPEN_OR_POSIX, _STRICT_STDC, _STRICT_SYMBOLS,
+ * and _STDC_C99 are Sun implementation specific macros created in order to
+ * compress common standards specified feature test macros for easier reading.
  * These macros should not be used by the application developer as
  * unexpected results may occur. Instead, the user should reference
  * standards(5) for correct usage of the standards feature test macros.
  *
  * __XOPEN_OR_POSIX     Used in cases where a symbol is defined by both

@@ -75,10 +79,14 @@
  * _STDC_C99            __STDC_VERSION__ is specified by the C standards and
  *                      defined by the compiler and indicates the version of
  *                      the C standard. A value of 199901L indicates a
  *                      compiler that complies with ISO/IEC 9899:1999, other-
  *                      wise known as the C99 standard.
+ *
+ * _STRICT_SYMBOLS      Used in cases where symbol visibility is restricted
+ *                      by the standards, and the user has not explicitly
+ *                      relaxed the strictness via __EXTENSIONS__.
  */
 
 #if defined(_XOPEN_SOURCE) || defined(_POSIX_C_SOURCE)
 #define __XOPEN_OR_POSIX
 #endif

@@ -142,10 +150,18 @@
 #if __STDC_VERSION__ - 0 >= 199901L
 #define _STDC_C99
 #endif
 
 /*
+ * Use strict symbol visibility.
+ */
+#if (defined(_STRICT_STDC) || defined(__XOPEN_OR_POSIX)) && \
+        !defined(__EXTENSIONS__)
+#define _STRICT_SYMBOLS
+#endif
+
+/*
  * Large file interfaces:
  *
  *      _LARGEFILE_SOURCE
  *              1               large file-related additions to POSIX
  *                              interfaces requested (fseeko, etc.)

@@ -220,17 +236,20 @@
  * X/Open CAE Specification, Issue 4 (XPG4)
  * X/Open CAE Specification, Issue 4, Version 2 (XPG4v2)
  * X/Open CAE Specification, Issue 5 (XPG5)
  * Open Group Technical Standard, Issue 6 (XPG6), also referred to as
  *    IEEE Std. 1003.1-2001 and ISO/IEC 9945:2002.
+ * Open Group Technical Standard, Issue 7 (XPG7), also referred to as
+ *    IEEE Std. 1003.1-2008 and ISO/IEC 9945:2009.
  *
  * XPG4v2 is also referred to as UNIX 95 (SUS or SUSv1).
  * XPG5 is also referred to as UNIX 98 or the Single Unix Specification,
  *     Version 2 (SUSv2)
  * XPG6 is the result of a merge of the X/Open and POSIX specifications
  *     and as such is also referred to as IEEE Std. 1003.1-2001 in
  *     addition to UNIX 03 and SUSv3.
+ * XPG7 is also referred to as UNIX 08 and SUSv4.
  *
  * When writing a conforming X/Open application, as per the specification
  * requirements, the appropriate feature test macros must be defined at
  * compile time. These are as follows. For more info, see standards(5).
  *

@@ -239,10 +258,11 @@
  * _XOPEN_SOURCE                                         XPG3
  * _XOPEN_SOURCE && _XOPEN_VERSION = 4                   XPG4
  * _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED = 1           XPG4v2
  * _XOPEN_SOURCE = 500                                   XPG5
  * _XOPEN_SOURCE = 600  (or POSIX_C_SOURCE=200112L)      XPG6
+ * _XOPEN_SOURCE = 700  (or POSIX_C_SOURCE=200809L)      XPG7
  *
  * In order to simplify the guards within the headers, the following
  * implementation private test macros have been created. Applications
  * must NOT use these private test macros as unexpected results will
  * occur.

@@ -258,10 +278,11 @@
  * _XPG3    X/Open Portability Guide, Issue 3 (XPG3)
  * _XPG4    X/Open CAE Specification, Issue 4 (XPG4)
  * _XPG4_2  X/Open CAE Specification, Issue 4, Version 2 (XPG4v2/UNIX 95/SUS)
  * _XPG5    X/Open CAE Specification, Issue 5 (XPG5/UNIX 98/SUSv2)
  * _XPG6    Open Group Technical Standard, Issue 6 (XPG6/UNIX 03/SUSv3)
+ * _XPG7    Open Group Technical Standard, Issue 7 (XPG7/UNIX 08/SUSv4)
  */
 
 /* X/Open Portability Guide, Issue 3 */
 #if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE - 0 < 500) && \
         (_XOPEN_VERSION - 0 < 4) && !defined(_XOPEN_SOURCE_EXTENDED)

@@ -292,10 +313,23 @@
 #define _XPG3
 #undef  _POSIX_C_SOURCE
 #define _POSIX_C_SOURCE                 200112L
 #undef  _XOPEN_SOURCE
 #define _XOPEN_SOURCE                   600
+
+/* Open Group Technical Standard, Issue 7 */
+#elif   (_XOPEN_SOURCE - 0 == 700) || (_POSIX_C_SOURCE - 0 == 200809L)
+#define _XPG7
+#define _XPG6
+#define _XPG5
+#define _XPG4_2
+#define _XPG4
+#define _XPG3
+#undef  _POSIX_C_SOURCE
+#define _POSIX_C_SOURCE                 200809L
+#undef  _XOPEN_SOURCE
+#define _XOPEN_SOURCE                   700
 #endif
 
 /*
  * _XOPEN_VERSION is defined by the X/Open specifications and is not
  * normally defined by the application, except in the case of an XPG4

@@ -302,16 +336,19 @@
  * application.  On the implementation side, _XOPEN_VERSION defined with
  * the value of 3 indicates an XPG3 application. _XOPEN_VERSION defined
  * with the value of 4 indicates an XPG4 or XPG4v2 (UNIX 95) application.
  * _XOPEN_VERSION  defined with a value of 500 indicates an XPG5 (UNIX 98)
  * application and with a value of 600 indicates an XPG6 (UNIX 03)
- * application.  The appropriate version is determined by the use of the
+ * application and with a value of 700 indicates an XPG7 (UNIX 08).
+ * The appropriate version is determined by the use of the
  * feature test macros described earlier.  The value of _XOPEN_VERSION
  * defaults to 3 otherwise indicating support for XPG3 applications.
  */
 #ifndef _XOPEN_VERSION
-#ifdef  _XPG6
+#if     defined(_XPG7)
+#define _XOPEN_VERSION 700
+#elif   defined(_XPG6)
 #define _XOPEN_VERSION 600
 #elif defined(_XPG5)
 #define _XOPEN_VERSION 500
 #elif   defined(_XPG4_2)
 #define _XOPEN_VERSION  4