From: Jonathan Wakely <jwakely@redhat.com>
To: Olivier Hainque <hainque@adacore.com>
Cc: "libstdc++" <libstdc++@gcc.gnu.org>,
gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] #undef isblank before def or decl in libstdc++ headers
Date: Fri, 10 Dec 2021 18:24:18 +0000 [thread overview]
Message-ID: <CACb0b4=VHWQOfEqvHfFMQU46RDt3yc40rS80rXFcZA+TG29TKg@mail.gmail.com> (raw)
In-Reply-To: <E4EEFE7A-0BD9-4845-A32C-E62D0DCAA16C@adacore.com>
On Fri, 10 Dec 2021 at 17:07, Olivier Hainque via Libstdc++
<libstdc++@gcc.gnu.org> wrote:
>
> Hello,
>
> The attached patch helps fix a build failure of libstdc++
> on some variants of VxWorks where the system headers expose
> an "isblank" macro.
>
> I understand this kind of thing normally is handled through
> fixincludes, however fixincludes on VxWorks is very tricky and
> we already have
>
> libstdc++-v3/include/c_global/cctype:#undef isblank
> libstdc++-v3/include/tr1/cctype:#undef isblank
>
> so the suggestion here is to simply do the same in a couple
> more places.
Both of those places already include <cctype> so I think we should just do this:
--- a/libstdc++-v3/include/c_global/cctype
+++ b/libstdc++-v3/include/c_global/cctype
@@ -78,10 +78,10 @@ namespace std
#if __cplusplus >= 201103L
-#ifdef _GLIBCXX_USE_C99_CTYPE_TR1
-
#undef isblank
+#ifdef _GLIBCXX_USE_C99_CTYPE_TR1
+
namespace std
{
using ::isblank;
I'm curious why _GLIBCXX_USE_C99_CTYPE_TR1 is not defined if VxWorks
has isblank, the configure check is:
# Check for the existence of <ctype.h> functions.
AC_CACHE_CHECK([for ISO C99 support to TR1 in <ctype.h>],
glibcxx_cv_c99_ctype_tr1, [
AC_TRY_COMPILE([#include <ctype.h>],
[int ch;
int ret;
ret = isblank(ch);
],[glibcxx_cv_c99_ctype_tr1=yes],
[glibcxx_cv_c99_ctype_tr1=no])
])
if test x"$glibcxx_cv_c99_ctype_tr1" = x"yes"; then
AC_DEFINE(_GLIBCXX_USE_C99_CTYPE_TR1, 1,
[Define if C99 functions in <ctype.h> should be imported in
<tr1/cctype> in namespace std::tr1.])
fi
In any case, undef'ing it unconditionally in <cctype> should work, and
avoids having to do it in multiple places (we still need it in
<tr1/cctype> because that is used in C++98 code, whereas the other
definitions of functions called "isblank" were added for C++11).
next prev parent reply other threads:[~2021-12-10 18:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-10 17:06 Olivier Hainque
2021-12-10 18:24 ` Jonathan Wakely [this message]
2021-12-11 10:55 ` Olivier Hainque
2021-12-11 17:09 ` Jonathan Wakely
2021-12-13 11:09 ` Olivier Hainque
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='CACb0b4=VHWQOfEqvHfFMQU46RDt3yc40rS80rXFcZA+TG29TKg@mail.gmail.com' \
--to=jwakely@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=hainque@adacore.com \
--cc=libstdc++@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).