This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Re: stray quotation marks warning enhancement or extension
- From: Manuel LÃpez-IbÃÃez <lopezibanez at gmail dot com>
- To: Jonathan Wakely <jwakely dot gcc at gmail dot com>, Daniel Gutson <daniel dot gutson at tallertechnologies dot com>
- Cc: gcc Mailing List <gcc at gcc dot gnu dot org>, Jason Merrill <jason at redhat dot com>
- Date: Fri, 1 Apr 2016 15:33:45 +0100
- Subject: Re: Re: stray quotation marks warning enhancement or extension
- Authentication-results: sourceware.org; auth=none
- References: <CAF5HaEVky8mR8=kyhgfpVMpi=bhrSZvKMd3jMUL99sd81yEg7g at mail dot gmail dot com> <CAH6eHdQER9Cm9f6eJfmVn+-WmoJeGj1UV1wqH-DtQeFrvULO4Q at mail dot gmail dot com>
On 31/03/16 23:23, Jonathan Wakely wrote:
On 31 March 2016@21:10, Daniel Gutson wrote:
Hi,
many times we copy code snippets from sources that change the
Unicode quotation marks ( “ ” ) rather than " ". For example
const std::string a_string(“Hello”);
That line looks innocent but causes gcc to say
xxxxx.cpp:4:1: error: stray ‘\342’ in program
const std::string a_string(“Hello”);
^
misleading the poor programmer with such error message and wrong
column. A quick Google search says there are 171,000 matches for "
error: stray ‘\342’ in program" which may show that this is a very
common issue.
[...]
* improve the error message for the case of the Unicode quotes such
as adding "(seems Unicode quotes where used)"
IMHO this would be better.
Note that GCC 6.0 has the capability of issuing something like:
xxxxx.cpp:4:28: error: Unicode quotation marks ‘\342’ are not valid
const std::string a_string(“Hello”);
^
"
or even:
xxxxx.cpp:4:28: error: Unicode quotation marks ‘\342’ are not valid
const std::string a_string(“Hello”);
^~~~~~~
"Hello"
Smart editors might be able to apply the fix automatically given the above.
Cheers,
Manuel.