Ok, while building ncurses I encountered the following problem.

It seems that a lot of projects define __XOPEN_SOURCE_EXTENDED macros.
When it is tested in feature_tests.h the value of __XOPEN_SOURCE is ignored, and we have problems - _XPG5 is not defined for gcc 3.4 and _XPG5 and _XPG6 are not defined for gcc4.7.
So, we miss some declarations in wchar.h/wchar_iso.h
for example because of  the following macro
#if (!defined(_XPG4) && !defined(_XPG4_2) || defined(_XPG5))

and possibly receive the following error with gcc 4.7 from feature_test.h:

if defined(_STDC_C99) && (defined(__XOPEN_OR_POSIX) && !defined(_XPG6))
#error "Compiler or options invalid for pre-UNIX 03 X/Open applications \
        and pre-2001 POSIX applications"

It seems the following patch solves the problem.
Is it a correct solution or I just don't see potential problems?
Or, alternavely we could add && (_XOPEN_SOURCE - 0 < 500) condition to

#elif (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE_EXTENDED - 0 == 1)

This condition is used in the first #if branch.

--- /export/home/build/srcs/illumos-gate/usr/src/uts/common/sys/feature_tests.h 2013-05-29 16:15:49.497379177 +0400
+++ /usr/include/sys/feature_tests.h    2013-06-06 12:57:43.994292322 +0400
@@ -275,8 +275,9 @@
 #define        _XPG4_2
 #define        _XPG4
 #define        _XPG3
+#endif
 /* X/Open CAE Specification, Issue 5 */
-#elif  (_XOPEN_SOURCE - 0 == 500)
+#if    (_XOPEN_SOURCE - 0 == 500)
 #define        _XPG5
 #define        _XPG4_2
 #define        _XPG4

--
Best regards,
Alexander Pyhalov,
system administrator of Computer Center of Southern Federal University

_______________________________________________
oi-dev mailing list
[email protected]
http://openindiana.org/mailman/listinfo/oi-dev

Reply via email to