mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Joakim Sindholt <opensource@zhasha.com>
To: musl@lists.openwall.com
Subject: Re: [PATCH] uchar.h: define char16_t and char32_t for old c++
Date: Mon, 9 Jul 2018 11:20:05 +0200	[thread overview]
Message-ID: <20180709092005.GA1754177@wirbelwind.zhasha.com> (raw)
In-Reply-To: <20180708131902.GE4418@port70.net>

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.


  reply	other threads:[~2018-07-09  9:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-08 13:19 Szabolcs Nagy
2018-07-09  9:20 ` Joakim Sindholt [this message]
2018-07-09 12:58   ` Szabolcs Nagy

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=20180709092005.GA1754177@wirbelwind.zhasha.com \
    --to=opensource@zhasha.com \
    --cc=musl@lists.openwall.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).