[oi-dev] g++ 4.7 headers issue (_XOPEN_SOURCE_EXTENDED/_STD_C_99)

Alexander Pyhalov alp at rsu.ru
Thu Jun 6 06:57:15 UTC 2013


Hello...
I've found one more issue with new g++ while trying to compile ncurses 
library. I can't say if it's a fault of autoconf or of our headers. g++ 
now defines _STDC_C99 macro (3.4 g++ didn't do it).

The problems appears when using sys/feature_tests.h header with 
_XOPEN_SOURCE_EXTENDED macros defined.


_XOPEN_SOURCE_EXTENDED functionality is enabled, e.g. in ncurses library 
or aspell to support UTF-8 in curses.

In <sys/feature_tests.h>  _XOPEN_SOURCE   leads to defining
__XOPEN_OR_POSIX, _XPG4_2, _XPG4 and _XPG3.

This leads to error at least  because of the following check

#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"
#elif !defined(_STDC_C99) && \
         (defined(__XOPEN_OR_POSIX) && defined(_XPG6))
#error "Compiler or options invalid; UNIX 03 and POSIX.1-2001 applications \
         require the use of c99"
#endif.

If I use the following patch:

--- 
/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 10:16:38.470538468 +0400
@@ -275,6 +275,9 @@
  #define        _XPG4_2
  #define        _XPG4
  #define        _XPG3
+#if defined (__GNUG__)  && __cplusplus >= 199711L && defined(_STDC_C99)
+#define _XPG6
+#endif
  /* X/Open CAE Specification, Issue 5 */
  #elif  (_XOPEN_SOURCE - 0 == 500)
  #define        _XPG5

then ncurses can be compiled.

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




More information about the oi-dev mailing list