c++/4915: Solaris: C++ compiler defines _XOPEN_SOURCE

dpo@club-internet.fr dpo@club-internet.fr
Fri Nov 9 09:56:00 GMT 2001


>Number:         4915
>Category:       c++
>Synopsis:       Solaris: C++ compiler defines _XOPEN_SOURCE
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Nov 20 12:36:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Dimitri Papadopoulos
>Release:        3.0.2
>Organization:
>Environment:
Solaris 8 on various Sparc machines
>Description:
The C++ compiler defines the macro variable _XOPEN_SOURCE
to be 500 while the C compiler does not:

$ gcc --version
3.0.2
$ cat foo.c
_XOPEN_SOURCE
$ gcc -E foo.c
# 1 "foo.c"
_XOPEN_SOURCE
$ 

$ g++ --version
3.0.2
$ cat foo.cc
_XOPEN_SOURCE
$ g++ -E foo.cc
# 1 "foo.cc"
500
$ 

There's no reason why the C++ compiler should override the
default Solaris compiling environment, is there? One should
be able to decide whether to define _XOPEN_SOURCE or not.

For reference here is the output of the Sun compilers:

$ cc -E foo.c
# 1 "foo.c"
_XOPEN_SOURCE
#ident "acomp: WorkShop Compilers 5.0 99/12/04 C 5.0 patch 107289-05"
$ 

$ CC -E foo.cc
#1 "foo.cc"
_XOPEN_SOURCE
$ 
>How-To-Repeat:

>Fix:
Do not define _POSIX_SOURCE in the C++ compiler.
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list