From: David Malcolm <dmalcolm@redhat.com>
To: Joseph Myers <joseph@codesourcery.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] C/C++: add fix-it hints for various missing symbols
Date: Wed, 05 Jul 2017 15:32:00 -0000 [thread overview]
Message-ID: <1499268735.7656.131.camel@redhat.com> (raw)
In-Reply-To: <alpine.DEB.2.20.1707032300480.4080@digraph.polyomino.org.uk>
On Mon, 2017-07-03 at 23:01 +0000, Joseph Myers wrote:
> Does the changed location fix bug 7356?
The patch as-written doesn't affect that bug, since the patch only
affects sites that use c_parser_require and cp_parser_require with
certain token types, and the diagnostic in PR 7356 is emitted by the C
FE here:
2174 /* This can appear in many cases looking nothing like a
2175 function definition, so we don't give a more specific
2176 error suggesting there was one. */
2177 c_parser_error (parser, "expected %<=%>, %<,%>, %<;%>, %<asm%> "
2178 "or %<__attribute__%>");
(the C++ FE handles it, emitting:
pr7356.c:1:1: error: âaâ does not name a type
a//sample
^
)
c_parser_error currently uses the location of the next token, and
concats as description of the next token.
I tried hacking up c_parser_error to unconditionally attempt to use the
location immediately after the previous token. This "fixes" PR 7356,
giving:
pr7356.c:1:2: error: expected â=â, â,â, â;â, âasmâ or â__attribute__â before âtypedefâ
a//sample
^
This error message might be better to be worded in terms of the
syntactic thing that came before, which would yield:
pr7356.c:1:2: error: expected â=â, â,â, â;â, âasmâ or â__attribute__â
after declaration
a//sample
^
or somesuch. Doing so would presumably require adding an extra param to
c_parser_error, e.g. an enum describing the syntactic elements that go before.
Does this sound worth pursuing as a followup?
Thanks
Dave
next prev parent reply other threads:[~2017-07-05 15:32 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-03 18:04 David Malcolm
2017-07-03 18:57 ` Richard Sandiford
2017-07-03 19:34 ` David Malcolm
2017-07-11 14:09 ` [committed] diagnostics: support compact printing of secondary locations David Malcolm
2017-07-11 17:34 ` Richard Sandiford
2017-07-03 23:01 ` [PATCH] C/C++: add fix-it hints for various missing symbols Joseph Myers
2017-07-05 15:32 ` David Malcolm [this message]
2017-07-05 16:17 ` Joseph Myers
2017-08-28 16:11 ` Jeff Law
2017-09-26 13:56 ` [PATCH 0/2] " David Malcolm
2017-09-26 13:56 ` [PATCH 1/2] C++: avoid partial duplicate implementation of cp_parser_error David Malcolm
2017-10-11 17:26 ` PING: " David Malcolm
2017-10-11 21:21 ` Jason Merrill
2017-10-12 18:10 ` David Malcolm
2017-09-26 13:56 ` [PATCH 2/2] C/C++: add fix-it hints for various missing symbols (v2) David Malcolm
2017-10-05 16:08 ` [PATCH 2/2] C/C++: add fix-it hints for various missing symbols (v3) David Malcolm
2017-10-11 17:27 ` PING " David Malcolm
2017-10-12 5:23 ` Jason Merrill
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=1499268735.7656.131.camel@redhat.com \
--to=dmalcolm@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=joseph@codesourcery.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).