[oi-dev] feature.h and __XOPEN_SOURCE_EXTENDED

Albert Lee Albert.Lee at nexenta.com
Fri Jun 7 05:19:09 UTC 2013


On Thu, Jun 6, 2013 at 5:15 AM, Alexander Pyhalov <alp at rsu.ru> wrote:

> 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
>
>
Alternatively, you could reverse the order of the conditional blocks. I'm
not sure what the implications of defining _XPG3 as well as _XPG5 are
offhand.

-Albert

 --
> Best regards,
> Alexander Pyhalov,
> system administrator of Computer Center of Southern Federal University
>
> ______________________________**_________________
> oi-dev mailing list
> oi-dev at openindiana.org
> http://openindiana.org/**mailman/listinfo/oi-dev<http://openindiana.org/mailman/listinfo/oi-dev>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://openindiana.org/pipermail/oi-dev/attachments/20130607/fa026fda/attachment-0005.html>


More information about the oi-dev mailing list