public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Olivier Hainque <hainque@adacore.com>
To: libstdc++ <libstdc++@gcc.gnu.org>, gcc-patches <gcc-patches@gcc.gnu.org>
Cc: Olivier Hainque <hainque@adacore.com>
Subject: [PATCH] #undef isblank before def or decl in libstdc++ headers
Date: Fri, 10 Dec 2021 18:06:58 +0100	[thread overview]
Message-ID: <E4EEFE7A-0BD9-4845-A32C-E62D0DCAA16C@adacore.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 859 bytes --]

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.

I checked that it gets us through the observed build failure
for VxWorks, then bootstrapped and regtested on native 64bit
linux.

Ok to commit?

Thanks in advance,

With Kind Regards,

Olivier

2021-12-07  Olivier Hainque  <hainque@adacore.com>

libstdc++-v3/

	* include/bits/locale_facets.h: #undef isblank before
	providing a definition.
	* libstdc++-v3/include/bits/localefwd.h: Likewise.


[-- Attachment #2: 0001-Add-undef-isblank-before-definition-or-decl-in-bits-.patch --]
[-- Type: application/octet-stream, Size: 1974 bytes --]

From 6e2b18025476ba5acf929eb7a313305ff282efe3 Mon Sep 17 00:00:00 2001
From: Olivier Hainque <hainque@adacore.com>
Date: Fri, 19 Nov 2021 15:20:45 +0000
Subject: [PATCH] Add #undef isblank before definition or decl in bits headers

As already done in

  libstdc++-v3/include/c_global/cctype:#undef isblank
  libstdc++-v3/include/tr1/cctype:#undef isblank

Fixes build failures for old VxWorks variants where the system
headers provide a macro version (observed on 6.9).

2021-12-07  Olivier Hainque  <hainque@adacore.com>

libstdc++-v3/

	* include/bits/locale_facets.h: #undef isblank before
	providing a definition.
	* libstdc++-v3/include/bits/localefwd.h: Likewise.

Part of UB12-004 (vxworks ports transition to gcc-11)

Change-Id: Ib682f663a833d02e814c3ac9905e81096c361601
(cherry picked from commit 6bad427c07cb22983b419a85cf9116f03e954d47)
---
 libstdc++-v3/include/bits/locale_facets.h | 1 +
 libstdc++-v3/include/bits/localefwd.h     | 1 +
 2 files changed, 2 insertions(+)

diff --git a/libstdc++-v3/include/bits/locale_facets.h b/libstdc++-v3/include/bits/locale_facets.h
index 5ca431e1a25..9e1d33f84e7 100644
--- a/libstdc++-v3/include/bits/locale_facets.h
+++ b/libstdc++-v3/include/bits/locale_facets.h
@@ -2663,6 +2663,7 @@ _GLIBCXX_END_NAMESPACE_LDBL
 
 #if __cplusplus >= 201103L
   /// Convenience interface to ctype.is(ctype_base::blank, __c).
+  #undef isblank
   template<typename _CharT>
     inline bool
     isblank(_CharT __c, const locale& __loc)
diff --git a/libstdc++-v3/include/bits/localefwd.h b/libstdc++-v3/include/bits/localefwd.h
index 9bc35e9761e..8d86386d2e5 100644
--- a/libstdc++-v3/include/bits/localefwd.h
+++ b/libstdc++-v3/include/bits/localefwd.h
@@ -108,6 +108,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     isgraph(_CharT, const locale&);
 
 #if __cplusplus >= 201103L
+  #undef isblank
   template<typename _CharT>
     bool
     isblank(_CharT, const locale&);
-- 
2.25.1


             reply	other threads:[~2021-12-10 17:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-10 17:06 Olivier Hainque [this message]
2021-12-10 18:24 ` Jonathan Wakely
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=E4EEFE7A-0BD9-4845-A32C-E62D0DCAA16C@adacore.com \
    --to=hainque@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    --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).