public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jason Merrill <jason@redhat.com>
To: Alexandre Oliva <oliva@adacore.com>
Cc: gcc-patches@gcc.gnu.org, hainque@adacore.com,
	joseph@codesourcery.com, nathan@acm.org
Subject: Re: [PATCH] [vxworks] make wint_t and wchar_t the same distinct type
Date: Tue, 28 Feb 2023 11:07:35 -0500	[thread overview]
Message-ID: <25fb8d35-bfc0-74e1-d747-28fe09019128@redhat.com> (raw)
In-Reply-To: <orv8jt207s.fsf@lxoliva.fsfla.org>

On 2/22/23 10:23, Alexandre Oliva wrote:
> Hello, Jason,
> 
> On Feb 17, 2023, Jason Merrill <jason@redhat.com> wrote:
> 
>> On 2/17/23 23:04, Alexandre Oliva wrote:
>>>
>>> We used to define WINT_TYPE to WCHAR_TYPE, so that both wint_t and
>>> wchar_t mapped to the same underlying type, but this caused a glitch
>>> in Wstringop-overflow-6.C: on vxworks, wint_t is typedef'ed to
>>> wchar_t
> 
>> And fixing that isn't an option?
> 
> Erhm, why do you say "fixing"?  That implies it's broken, but I don't
> see anything in the C++ standards, or in the relevant bits that it
> imports from the C standards, that rules out using wint_t = wchar_t in
> C++.  wint_t is imported from the C standard as an integral type that
> meets certain requirements, and AFAICT in C++ wchar_t is an integral
> type that meets those requirements.  Am I missing something?
> 
> 
> Now, could it be changed so that wint_t is wchar_t's underlying type
> rather than wchar_t?  If the equivalence is a compliance error, we could
> file a bug report with WRS and request them to fix it, but modifying
> their system headers would require a copyright license they don't grant,
> so we avoid doing that.  I imagine that breaking this equivalence would
> have ABI implications, and even break legitimate (though unportable)
> programs because of overload, specializations and whatnot, so there
> would have to be very strong reasons to support a request for such a
> change.
> 
>> Do the integer builtins work properly if we force them to use wchar_t
>> instead of an integer type?
> 
> I haven't observed any regressions, I don't see any builtin functions
> with wint in their signature that we even expand as builtins, and my
> imagination is failing me on why an integral type such as wchar_t would
> fail for wint_t, where other integral types, including wchar_t's
> underlying type, would work.  Did you have any specific risks in mind
> about what could go wrong?

Sorry, I think I was mostly confusing myself about how distinct wchar_t 
really is.

The patch is OK.

Jason


      reply	other threads:[~2023-02-28 16:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-17  7:04 Alexandre Oliva
2023-02-17 17:08 ` Jason Merrill
2023-02-22 15:23   ` Alexandre Oliva
2023-02-28 16:07     ` Jason Merrill [this message]

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=25fb8d35-bfc0-74e1-d747-28fe09019128@redhat.com \
    --to=jason@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hainque@adacore.com \
    --cc=joseph@codesourcery.com \
    --cc=nathan@acm.org \
    --cc=oliva@adacore.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.
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).