This is the mail archive of the
mailing list for the libstdc++ project.
Re: [patch] libstdc++/67173 Fix filesystem::canonical for Solaris 10.
- From: Jonathan Wakely <jwakely at redhat dot com>
- To: Martin Sebor <msebor at gmail dot com>
- Cc: libstdc++ <libstdc++ at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 16 Sep 2015 17:02:22 +0100
- Subject: Re: [patch] libstdc++/67173 Fix filesystem::canonical for Solaris 10.
- Authentication-results: sourceware.org; auth=none
- References: <20150911142140 dot GL2631 at redhat dot com> <55F311D2 dot 8050405 at gmail dot com> <CAH6eHdTjPFof-+ENBLytMsD2AU+6m2WoU020bwGsFLBen4s=yg at mail dot gmail dot com> <55F469CF dot 9010503 at gmail dot com> <20150916144207 dot GY2631 at redhat dot 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
+#define _XOPEN_SOURCE 700
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
#if defined(_ISOC99_SOURCE) || (__STDC_VERSION__ - 0) > 199901L || \
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:
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 :-(