public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Marek Polacek <polacek@redhat.com>
To: Jason Merrill <jason@redhat.com>
Cc: Tom Honermann <tom@honermann.net>,
	Martin Sebor <msebor@gmail.com>,
	gcc-patches <gcc-patches@gcc.gnu.org>,
	"Joseph S. Myers" <joseph@codesourcery.com>
Subject: Re: PATCH: Updated error messages for ill-formed cases of array initialization by string literal
Date: Tue, 15 Jan 2019 16:00:00 -0000	[thread overview]
Message-ID: <20190115160025.GG19569@redhat.com> (raw)
In-Reply-To: <99ca7332-f658-d5fe-fc42-b4199111ad3d@redhat.com>

On Tue, Jan 15, 2019 at 10:15:22AM -0500, Jason Merrill wrote:
> On 1/14/19 11:09 PM, Tom Honermann wrote:
> > On 1/4/19 7:25 PM, Martin Sebor wrote:
> > > On 12/27/18 1:49 PM, Tom Honermann wrote:
> > > > As requested by Jason in the review of the P0482 (char8_t) core
> > > > language changes, this patch includes updates to the error
> > > > messages emitted for ill-formed cases of array initialization
> > > > with a string literal.  With these changes, error messages that
> > > > previously looked something like these:
> > > > 
> > > > - "char-array initialized from wide string"
> > > > - "wide character array initialized from non-wide string"
> > > > - "wide character array initialized from incompatible wide string"
> > > > 
> > > > now look like:
> > > > 
> > > > - "cannot initialize array of type 'char' from a string literal
> > > > with type array of 'short unsigned int'"
> > > 
> > > The first word "type" doesn't quite work here.  The type of every
> > > array is "array of T" where T is the type of the element, so for
> > > instance, "array of char."  Saying "array of type X" makes it sound
> > > like X is the type of the whole array, which is of course not
> > > the case when X is char.  I think you want to use the same wording
> > > as for the second type:
> > > 
> > >   "cannot initialize array of 'char' from a string literal with
> > >   type array of 'short unsigned int'"
> > > 
> > > or perhaps even better
> > > 
> > >   "cannot initialize array of 'char' from a string literal with
> > >   type 'char16_t[N]'"
> > > 
> > > (i.e., show the actual type of the string, including its bound).
> > 
> > Thank you for the feedback, Martin; sorry for the delayed response. I'll
> > follow up with a revised patch within the next week or two.
> 
> I actually incorporated the C++ part of these changes into yesterday's
> commit, using Martin's first suggestion.  Here's the adjusted C patch, which
> I'd like a C maintainer to approve.

Patch is OK, thanks.

Marek

  reply	other threads:[~2019-01-15 16:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-27 21:29 Tom Honermann
2019-01-05  0:26 ` Martin Sebor
2019-01-15  4:10   ` Tom Honermann
2019-01-15 15:15     ` Jason Merrill
2019-01-15 16:00       ` Marek Polacek [this message]
2019-01-15 17:59       ` Joseph Myers
2019-01-17 17:41         ` Jason Merrill
2019-01-17 20:24           ` Joseph Myers
2019-01-18 12:52           ` Rainer Orth
2019-01-18 14:46             ` Christophe Lyon

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=20190115160025.GG19569@redhat.com \
    --to=polacek@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jason@redhat.com \
    --cc=joseph@codesourcery.com \
    --cc=msebor@gmail.com \
    --cc=tom@honermann.net \
    /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).