Bug 79868 - aarch64: diagnostic "malformed target %s value" not translateable
Summary: aarch64: diagnostic "malformed target %s value" not translateable
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 7.0
: P3 normal
Target Milestone: 8.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-03-05 10:16 UTC by Roland Illig
Modified: 2018-02-22 16:21 UTC (History)
1 user (show)

See Also:
Host:
Target: aarch64
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
Proposed patch (2.24 KB, text/plain)
2017-09-15 23:17 UTC, Steve Ellcey
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Roland Illig 2017-03-05 10:16:45 UTC
from config/aarch64/aarch64.c:

error ("malformed target %s value", pragma_or_attr);

Assuming that the %s placeholder can be either "pragma" or "attribute" (which should be documented right above the above code line), this message cannot be translated propertly into French.

le valeur d'attribute
le valeur du pragma

Depending on the inserted word, the outside sentence changes.

Therefore, instead of passing "const char *pragma_or_attr", that parameter should be a boolean.

if (pragma)
  error ("malformed target pragma value");
else
  error ("malformed target attribute value");
Comment 1 Roland Illig 2017-03-05 10:17:47 UTC
Same for:

error ("target %s %qs is invalid", pragma_or_attr, token);
Comment 2 Roland Illig 2017-03-05 10:20:59 UTC
Also, the word "attribute" appeared as an untranslated literal:

ret = aarch64_process_target_attr (args, "attribute");

This makes it impossible to do any proper translation into any language other than English.
Comment 3 Richard Earnshaw 2017-03-05 13:06:07 UTC
Both pragma and attribute are keywords in the language.  If the substituted value were placed in quotes, would that help?
Comment 4 Roland Illig 2017-03-05 13:50:02 UTC
(In reply to Richard Earnshaw from comment #3)
> Both pragma and attribute are keywords in the language.  If the substituted
> value were placed in quotes, would that help?

No, it wouldn't. It would only confuse users. Imagine the following diagnostic:

>> target »attribute« »__format__« is invalid

Although "attribute" and "pragma" are both keywords in the language, they are not used as such in this diagnostic. Rather, they form part of the normal sentence structure.
Comment 5 Roland Illig 2017-03-12 23:20:54 UTC
Same for all occurrences of the »pragma_or_attr« variable.
Comment 6 Steve Ellcey 2017-09-15 23:17:19 UTC
Created attachment 42184 [details]
Proposed patch

Roland, does this patch look like it will fix your translation problems?  If so I can submit it to gcc-patches.
Comment 7 Frederic Marchal 2017-09-17 18:34:44 UTC
I think there is an error here:

@@ -9938,7 +9978,7 @@ aarch64_process_target_attr (tree args, const char* pragma_or_attr)
 
   if (len == 0)
     {
-      error ("malformed target %s value", pragma_or_attr);
+      error ("malformed target %s value", is_pragma);

You should probably have two strings like you did in every other instance:

   if (is_pragma)
      error ("malformed target pragma value");
   else
      error ("malformed target attribute value");

Everything else looks good to me (I'm the current French translator).
Comment 8 Roland Illig 2017-09-17 23:17:27 UTC
Yes, the patch looks good to me. (I didn't even catch the one instance that Frederic found.) Thanks for putting this much effort into this issue.
Comment 9 Steve Ellcey 2017-11-02 21:56:31 UTC
Author: sje
Date: Thu Nov  2 21:56:00 2017
New Revision: 254359

URL: https://gcc.gnu.org/viewcvs?rev=254359&root=gcc&view=rev
Log:
	PR target/79868
	* config/aarch64/aarch64-c.c (aarch64_pragma_target_parse):
	Remove second argument from aarch64_process_target_attr call.
	* config/aarch64/aarch64-protos.h (aarch64_process_target_attr):
	Ditto.
	* config/aarch64/aarch64.c (aarch64_attribute_info): Change
	field type.
	(aarch64_handle_attr_arch): Remove second argument.
	(aarch64_handle_attr_cpu): Ditto.
	(aarch64_handle_attr_tune): Ditto.
	(aarch64_handle_attr_isa_flags): Ditto.
	(aarch64_process_one_target_attr): Ditto.
	(aarch64_process_target_attr): Ditto.
	(aarch64_option_valid_attribute_p): Remove second argument.
	on aarch64_process_target_attr call.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/aarch64/aarch64-c.c
    trunk/gcc/config/aarch64/aarch64-protos.h
    trunk/gcc/config/aarch64/aarch64.c
Comment 10 Steve Ellcey 2017-11-02 21:58:36 UTC
Author: sje
Date: Thu Nov  2 21:58:05 2017
New Revision: 254360

URL: https://gcc.gnu.org/viewcvs?rev=254360&root=gcc&view=rev
Log:
	PR target/79868
	* gcc.target/aarch64/spellcheck_1.c: Update dg-error string to match
	new format.
	* gcc.target/aarch64/spellcheck_2.c: Ditto.
	* gcc.target/aarch64/spellcheck_3.c: Ditto.
	* gcc.target/aarch64/target_attr_11.c: Ditto.
	* gcc.target/aarch64/target_attr_12.c: Ditto.
	* gcc.target/aarch64/target_attr_17.c: Ditto.

Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.target/aarch64/spellcheck_1.c
    trunk/gcc/testsuite/gcc.target/aarch64/spellcheck_2.c
    trunk/gcc/testsuite/gcc.target/aarch64/spellcheck_3.c
    trunk/gcc/testsuite/gcc.target/aarch64/target_attr_11.c
    trunk/gcc/testsuite/gcc.target/aarch64/target_attr_12.c
    trunk/gcc/testsuite/gcc.target/aarch64/target_attr_17.c
Comment 11 Steve Ellcey 2017-11-15 22:38:20 UTC
Fixed on Tot for 8.0.