public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] #undef isblank before def or decl in libstdc++ headers
@ 2021-12-10 17:06 Olivier Hainque
  2021-12-10 18:24 ` Jonathan Wakely
  0 siblings, 1 reply; 5+ messages in thread
From: Olivier Hainque @ 2021-12-10 17:06 UTC (permalink / raw)
  To: libstdc++, gcc-patches; +Cc: Olivier Hainque

[-- 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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-12-13 11:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-10 17:06 [PATCH] #undef isblank before def or decl in libstdc++ headers Olivier Hainque
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

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).