From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/12995 Path: news.gmane.org!.POSTED!not-for-mail From: Joakim Sindholt Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH] uchar.h: define char16_t and char32_t for old c++ Date: Mon, 9 Jul 2018 11:20:05 +0200 Message-ID: <20180709092005.GA1754177@wirbelwind.zhasha.com> References: <20180708131902.GE4418@port70.net> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1531127896 31595 195.159.176.226 (9 Jul 2018 09:18:16 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 9 Jul 2018 09:18:16 +0000 (UTC) User-Agent: Mutt/1.9.4 (2018-02-28) To: musl@lists.openwall.com Original-X-From: musl-return-13011-gllmg-musl=m.gmane.org@lists.openwall.com Mon Jul 09 11:18:12 2018 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1fcSJ9-000854-St for gllmg-musl@m.gmane.org; Mon, 09 Jul 2018 11:18:12 +0200 Original-Received: (qmail 9802 invoked by uid 550); 9 Jul 2018 09:20:19 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 9781 invoked from network); 9 Jul 2018 09:20:18 -0000 Content-Disposition: inline In-Reply-To: <20180708131902.GE4418@port70.net> Xref: news.gmane.org gmane.linux.lib.musl.general:12995 Archived-At: On Sun, Jul 08, 2018 at 03:19:03PM +0200, Szabolcs Nagy wrote: > including uchar.h in c++ code is only well defined in c++11 onwards > where char16_t and char32_t type definitions must be hidden since they > are keywords. however some c++ code compiled for older c++ standard > include uchar.h too and they need the typedefs, this fix makes such > code work. > --- > include/uchar.h | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/include/uchar.h b/include/uchar.h > index 8dabf1ed..7e5c4d40 100644 > --- a/include/uchar.h > +++ b/include/uchar.h > @@ -3,7 +3,9 @@ > > #ifdef __cplusplus > extern "C" { > -#else > +#endif > + > +#if __cplusplus < 201103L > typedef unsigned short char16_t; > typedef unsigned char32_t; > #endif > -- > 2.16.3 Isn't this a bit ill advised? I just did a little test to see how GCC mangles the names and it looks troublesome: char16_t func(char32_t *s); becomes _Z4funcPDi when -std=c++11 and when we add typedef unsigned short char16_t; typedef unsigned char32_t; and compile it with -std=c++03 it becomes _Z4funcPj Did I do something egregiously wrong? Because this seems like a recipe for ABI incompatibility.