public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely@redhat.com>
To: Martin Sebor <msebor@gmail.com>
Cc: libstdc++ <libstdc++@gcc.gnu.org>, gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [patch] libstdc++/67173 Fix filesystem::canonical for Solaris 10.
Date: Wed, 16 Sep 2015 16:05:00 -0000	[thread overview]
Message-ID: <20150916160221.GZ2631@redhat.com> (raw)
In-Reply-To: <20150916144207.GY2631@redhat.com>

On 16/09/15 15:42 +0100, Jonathan Wakely wrote:
>@@ -22,6 +22,8 @@
> // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
> // <http://www.gnu.org/licenses/>.
> 
>+#define _XOPEN_SOURCE 700
>+
> #include <experimental/filesystem>
> #include <functional>
> #include <stack>

Unfortunately this completely breaks NetBSD, because defining
_XOPEN_SOURCE for this one file is inconsistent with how the autconf
test were run, so C99 functions that were implicitly available during
configure tests (because no _POSIX_C_SOURCE, _XOPEN_SOURCE etc. macro
was defined) are no longer available when compiling this translation
unit with _XOPEN_SOURCE defined.

Specifically, <wchar.h> in NetBSD 5.1 does:

#if !defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) && \
    !defined(_XOPEN_SOURCE) && !defined(_NETBSD_SOURCE)
#define _NETBSD_SOURCE 1
#endif
...
#if defined(_ISOC99_SOURCE) || (__STDC_VERSION__ - 0) > 199901L || \
    defined(_NETBSD_SOURCE)
int vfwscanf(FILE * __restrict, const wchar_t * __restrict, _BSD_VA_LIST_);


So it's defined during configure and we define _GLIBCXX_HAVE_VFWSCANF
and our <cwchar> does:

#if _GLIBCXX_HAVE_VFWSCANF
  using ::vfwscanf;
#endif

but the value of _GLIBCXX_HAVE_VFWSCANF determined during configure is
not valid in src/filesystem/ops.cc after defining _XOPEN_SOURCE.

I don't know how to use _XOPEN_VERSION or _POSIX_VERSION to check for
a suitable realpath without defining one of those feature-test macros,
which then breaks other things.

(This is fixed in NetBSD 7.x which knows about C++11 and so defines
vfwscanf more liberally, but that doesn't help NetBSD 5.1).

Maybe I should just give up on realpath() and use my new
implementation everywhere :-(

  reply	other threads:[~2015-09-16 16:02 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-11 14:23 Jonathan Wakely
2015-09-11 18:05 ` Martin Sebor
2015-09-12 10:39   ` Jonathan Wakely
2015-09-12 19:49     ` Martin Sebor
2015-09-12 22:00       ` Martin Sebor
2015-09-16 14:52       ` Jonathan Wakely
2015-09-16 16:05         ` Jonathan Wakely [this message]
2015-09-16 16:11           ` Jonathan Wakely
2015-09-16 17:38         ` Martin Sebor
2015-09-16 19:02           ` Jonathan Wakely
2015-09-16 22:17             ` Martin Sebor
2015-09-16 22:23               ` Jonathan Wakely
2015-09-16 23:51                 ` Martin Sebor
2015-09-17 11:31                   ` Jonathan Wakely
2015-09-17 11:33                     ` Jonathan Wakely
2015-09-17 14:38                     ` Jonathan Wakely
2015-09-17 15:40                     ` Martin Sebor
2015-09-23 12:14                       ` Jonathan Wakely
2015-09-16 23:42             ` Jonathan Wakely
2015-09-17 15:36               ` Jonathan Wakely
2015-09-17 19:27             ` Andreas Schwab
2015-09-17 22:23               ` Jonathan Wakely

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=20150916160221.GZ2631@redhat.com \
    --to=jwakely@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=libstdc++@gcc.gnu.org \
    --cc=msebor@gmail.com \
    /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).