This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH][aarch64] Fix error calls in aarch64 code so they can be tranlated


On 09/22/2017 11:54 AM, Steve Ellcey wrote:

In my view, the ideal message would use the same form as in
the source code.  But I suspect that's not easy to determine at
all sites where the message is being formatted, so the next best
thing is to avoid using the keyword and fall back on the general
term.

Martin

PS If possible, I would also suggest adopting a style that is
already in use elsewhere, for consistency.  (That would suggest
using %<target(\"arch=\")%> with no spaces and no "string" after
arch=.)

Here is a new version of my patch.  I think it addresses these issues
and is consistent.  It does cause some regressions in tests that check
for certain error messages, specifically:

gcc.target/aarch64/spellcheck_1.c
gcc.target/aarch64/spellcheck_2.c
gcc.target/aarch64/spellcheck_3.c
gcc.target/aarch64/target_attr_11.c
gcc.target/aarch64/target_attr_12.c
gcc.target/aarch64/target_attr_17.c

But I thought we should try and get some agreement on the format of the
messages before updating the tests.  If we think these changes look
good I can submit a final patch that includes the testsuite changes.

Thank you for taking my suggestions!  The changes look good to me.
Just one minor nit.  The following won't produce the kind of output
we'd like it to:

  error (is_pragma
         ? G_("pragma %<target(%qs)%> does not accept an argument")
         : G_("attribute %<target(%qs)%> does not accept an argument"),
         str_to_check);

It will end up printing:

  error: pragma ‘target(‘...’)’ does not accept an argument

(note the single quotes around the ... where the syntax otherwise
calls for a string).  The %s directive should not use the 'q' flag
when nested between %< and %>.  -Wformat normally warns about this
but in this case it doesn't see the format string because of the
conditional (I think -Wformat can be extended to handle this case).

  warning: 'q' flag used within a quoted sequence [-Wformat=]

To get the right output I think the format string should like
something like this:

  "pragma %<target(\"%s\")%> does not accept an argument"

Martin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]