public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: dpo@club-internet.fr
To: gcc-gnats@gcc.gnu.org
Subject: c++/5821: Solaris: C++ compiler defines _XOPEN_SOURCE
Date: Sun, 03 Mar 2002 14:56:00 -0000	[thread overview]
Message-ID: <20020303224952.9620.qmail@sources.redhat.com> (raw)


>Number:         5821
>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:   Sun Mar 03 14:56:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     dpo@club-internet.fr
>Release:        3.0.4
>Organization:
>Environment:
Solaris 8 on various Sparc machines
>Description:
I'm sorry to open a new bug report about the same
issue, but report #4915 was erroneously closed and
I don't know how to reopen it.

I won't discuss that libstdc++ may need to define
_XOPEN_SOURCE, although I'm curious why. I'll try
to remove it and see what happens for myself.

The problem is that one should not be defining
_XOPEN_SOURCE just because it's practical, for
example for building libstdc++. This is a bad
hack.

The default Solaris environment is to have none
of the _XOPEN_SOURCE_EXTENDED, _XOPEN_SOURCE,
__EXTENSIONS__, and other similar macros defined.
The C compiler is not modifying this default
environment and the C++ compiler should not either.
Just like the Sun C/C++ compilers.

If libstdc++ needs _XOPEN_SOURCE, then its build
system should be fixed so that _XOPEN_SOURCE is
defined when libstdc++ is built.

The problem is that defining _XOPEN_SOURCE triggers
lots of macro definitions like
	#define connect ...
that break sources that have always been compiling
with previous GNU compilers and Sun compilers. Well,
the sources can be modified of course. But the compiler
shouldn't modify the standard Solaris environment.
Let the user decide about it.
>How-To-Repeat:
$ 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
$ 
>Fix:
Do not define _POSIX_SOURCE in the C++ compiler.
>Release-Note:
>Audit-Trail:
>Unformatted:


             reply	other threads:[~2002-03-03 22:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-03 14:56 dpo [this message]
2002-03-03 15:03 rodrigc
2002-03-04  7:46 Phil Edwards
2002-03-04 14:56 Dimitri Papadopoulos
2002-03-05 13:56 Phil Edwards

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020303224952.9620.qmail@sources.redhat.com \
    --to=dpo@club-internet.fr \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).