public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/2] gas: Minor strings fix on June 2022 (Mach-O and RISC-V)
@ 2022-06-10 10:00 Tsukasa OI
  2022-06-10 10:00 ` [PATCH 1/2] Mach-O: i18n enablement on some error messages Tsukasa OI
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Tsukasa OI @ 2022-06-10 10:00 UTC (permalink / raw)
  To: Tsukasa OI, Tristan Gingold, Nelson Chu; +Cc: binutils

This patchset contains some minor string improvements I discovered
while I'm investigating/translating GAS.

All patches are independent and can be applied independently.

PATCH 1 : gas/config/obj-macho.c (i18n enablement)
PATCH 2 : gas/config/tc-riscv.c  (wording / consistency)



PATCH 1 : gas/config/obj-macho.c (i18n enablement)

On collect_16char_name on this file, there's a formatted error message:

> as_bad (_("the %s name '%s' is too long (maximum 16 characters)"),
>            msg, namstart);

collect_16char_name is called by obj_mach_o_get_section_names but
it does not wrap input `msg' parameter.  Quoting from the function:

> if (collect_16char_name (seg, "segment", 1))

> collect_16char_name (sec, "section", 0);

The words "segment" and "section" should be wrapped with _().
This is not a problem on French but it IS on Spanish.  I quote some
Spanish translation from gas/po/es.po:

> #: config/obj-macho.c:119
> #, c-format
> msgid "the %s name '%s' is too long (maximum 16 characters)"
> msgstr "el nombre %s «%s» es demasiado largo (máximo 16 caracteres)"

> #: config/tc-aarch64.c:607 config/tc-arm.c:1072 config/tc-i860.c:1003
> #: config/tc-sparc.c:3440
> msgid "bad segment"
> msgstr "segmento equivocado"

> #: config/tc-alpha.c:4274
> #, c-format
> msgid "unknown section attribute %s"
> msgstr "atributo seccional %s desconocido"

It will have following mappings on Spanish:

segment  -->  segmento
section  -->  seccional

In Japanese (the language I am trying to translate some GAS strings),
it will be visiblly significant:

Sample message in English:
    the section name 'ABC...' is too long (maximum 16 characters)
Possible Japanese translation without this patch:
    section 名 'ABC...' が長すぎます (最大 16 文字)
Possible Japanese translation with this patch:
    セクション名 'ABC...' が長すぎます (最大 16 文字)

In here, an English word "section" stands out too much in otherwise
Japanese message.  If we can translate the word "section" (technically,
transliterate) to "セクション" (Hepburn: sekushon), the whole sentense
gets more natural.

It will have following mappings on Japanese:

segment  -->  セグメント
section  -->  セクション



PATCH 2 : gas/config/tc-riscv.c (wording / consistency)

This is about consistency.  Quoting some from riscv_ip, there are
similar error messages here:

> as_bad (_("bad value for compressed funct6 "
>           "field, value must be 0...64"));

> as_bad (_("bad value for compressed funct4 "
>           "field, value must be 0...15"));

> as_bad (_("bad value for compressed funct3 "
>           "field, value must be 0...7"));

> as_bad (_("bad value for compressed funct2 "
>           "field, value must be 0...3"));

You can see the difference.  For funct2, funct3 and funct4, ranges in
error strings are 0...(2^n-1).  However on funct6, range in the error
string is 0...(2^n).

This patch fixes this inconsistency by changing from 0...64 to 0...63.




Tsukasa OI (2):
  Mach-O: i18n enablement on some error messages
  RISC-V: Fix inconsistent error message (range)

 gas/config/obj-macho.c | 4 ++--
 gas/config/tc-riscv.c  | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)


base-commit: 6a72edd8e26c670bbdce7aeae3c0c8f793fc8612
-- 
2.34.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/2] Mach-O: i18n enablement on some error messages
  2022-06-10 10:00 [PATCH 0/2] gas: Minor strings fix on June 2022 (Mach-O and RISC-V) Tsukasa OI
@ 2022-06-10 10:00 ` Tsukasa OI
  2022-06-10 10:00 ` [PATCH 2/2] RISC-V: Fix inconsistent error message (range) Tsukasa OI
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 10+ messages in thread
From: Tsukasa OI @ 2022-06-10 10:00 UTC (permalink / raw)
  To: Tsukasa OI, Tristan Gingold, Nelson Chu; +Cc: binutils

This commit now wraps two string literals with _() for i18n support
enablement.  They are used in the collect_16char_name function to form
localized error messages that contain "%s name".

gas/ChangeLog:

	* config/obj-macho.c (obj_mach_o_get_section_names): Wrap two
	string literals within with gettext macro.
---
 gas/config/obj-macho.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gas/config/obj-macho.c b/gas/config/obj-macho.c
index f055aeadafb..119f2fd1356 100644
--- a/gas/config/obj-macho.c
+++ b/gas/config/obj-macho.c
@@ -141,7 +141,7 @@ obj_mach_o_get_section_names (char *seg, char *sec,
   /* Zero-length segment and section names are allowed.  */
   /* Parse segment name.  */
   memset (seg, 0, segl);
-  if (collect_16char_name (seg, "segment", 1))
+  if (collect_16char_name (seg, _("segment"), 1))
     {
       ignore_rest_of_line ();
       return 0;
@@ -150,7 +150,7 @@ obj_mach_o_get_section_names (char *seg, char *sec,
 
   /* Parse section name, which can be empty.  */
   memset (sec, 0, secl);
-  collect_16char_name (sec, "section", 0);
+  collect_16char_name (sec, _("section"), 0);
   return 1;
 }
 
-- 
2.34.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 2/2] RISC-V: Fix inconsistent error message (range)
  2022-06-10 10:00 [PATCH 0/2] gas: Minor strings fix on June 2022 (Mach-O and RISC-V) Tsukasa OI
  2022-06-10 10:00 ` [PATCH 1/2] Mach-O: i18n enablement on some error messages Tsukasa OI
@ 2022-06-10 10:00 ` Tsukasa OI
  2022-06-22 10:36   ` Nelson Chu
  2022-06-12  4:12 ` [PATCH 0/2] gas: Minor strings fix on June 2022 (Mach-O and RISC-V) Tristan Gingold
  2022-08-07  7:40 ` [RESEND PATCH 0/1] gas: Minor strings fix on June 2022 (Mach-O part) Tsukasa OI
  3 siblings, 1 reply; 10+ messages in thread
From: Tsukasa OI @ 2022-06-10 10:00 UTC (permalink / raw)
  To: Tsukasa OI, Tristan Gingold, Nelson Chu; +Cc: binutils

This commit fixes inconsistent error message format involving compressed
funct<n> fields.  In specific, funct6 had an error message with range
0..2^<n> ("0..64") unlike other funct<n> fields with 0..2^<n>-1
(e.g. funct4 with "0..15").

gas/ChangeLog:

	* config/tc-riscv.c (riscv_ip): Fix inconsistent error message.
---
 gas/config/tc-riscv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c
index 1b730b4be36..a10ae8e237b 100644
--- a/gas/config/tc-riscv.c
+++ b/gas/config/tc-riscv.c
@@ -2582,7 +2582,7 @@ riscv_ip (char *str, struct riscv_cl_insn *ip, expressionS *imm_expr,
 			    || imm_expr->X_add_number >= 64)
 			  {
 			    as_bad (_("bad value for compressed funct6 "
-				      "field, value must be 0...64"));
+				      "field, value must be 0...63"));
 			    break;
 			  }
 			INSERT_OPERAND (CFUNCT6, *ip, imm_expr->X_add_number);
-- 
2.34.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 0/2] gas: Minor strings fix on June 2022 (Mach-O and RISC-V)
  2022-06-10 10:00 [PATCH 0/2] gas: Minor strings fix on June 2022 (Mach-O and RISC-V) Tsukasa OI
  2022-06-10 10:00 ` [PATCH 1/2] Mach-O: i18n enablement on some error messages Tsukasa OI
  2022-06-10 10:00 ` [PATCH 2/2] RISC-V: Fix inconsistent error message (range) Tsukasa OI
@ 2022-06-12  4:12 ` Tristan Gingold
  2022-06-12  9:28   ` Tsukasa OI
  2022-07-13  3:23   ` Tsukasa OI
  2022-08-07  7:40 ` [RESEND PATCH 0/1] gas: Minor strings fix on June 2022 (Mach-O part) Tsukasa OI
  3 siblings, 2 replies; 10+ messages in thread
From: Tristan Gingold @ 2022-06-12  4:12 UTC (permalink / raw)
  To: Tsukasa OI; +Cc: Nelson Chu, binutils

For me, the mach-o part is OK.  I am not sure I would translate section or segment as they are technical words, but you are the native speaker!


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 0/2] gas: Minor strings fix on June 2022 (Mach-O and RISC-V)
  2022-06-12  4:12 ` [PATCH 0/2] gas: Minor strings fix on June 2022 (Mach-O and RISC-V) Tristan Gingold
@ 2022-06-12  9:28   ` Tsukasa OI
  2022-07-13  3:23   ` Tsukasa OI
  1 sibling, 0 replies; 10+ messages in thread
From: Tsukasa OI @ 2022-06-12  9:28 UTC (permalink / raw)
  To: Tristan Gingold; +Cc: binutils

On 2022/06/12 13:12, Tristan Gingold wrote:
> For me, the mach-o part is OK.
> I am not sure I would translate section or segment as they are technical words, but you are the native speaker!
At least, I think most of Binutils users understand what English words
"section" and "segment" mean (even if they are not non-English
speakers).  The reason I sent this patch is words "section" and
"segment" are translated in other messages.  In that sense, it's also
about consistency.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/2] RISC-V: Fix inconsistent error message (range)
  2022-06-10 10:00 ` [PATCH 2/2] RISC-V: Fix inconsistent error message (range) Tsukasa OI
@ 2022-06-22 10:36   ` Nelson Chu
  0 siblings, 0 replies; 10+ messages in thread
From: Nelson Chu @ 2022-06-22 10:36 UTC (permalink / raw)
  To: Tsukasa OI; +Cc: Tristan Gingold, Binutils

LGTM, so committed

Thanks
Nelson

On Fri, Jun 10, 2022 at 6:00 PM Tsukasa OI <research_trasio@irq.a4lg.com> wrote:
>
> This commit fixes inconsistent error message format involving compressed
> funct<n> fields.  In specific, funct6 had an error message with range
> 0..2^<n> ("0..64") unlike other funct<n> fields with 0..2^<n>-1
> (e.g. funct4 with "0..15").
>
> gas/ChangeLog:
>
>         * config/tc-riscv.c (riscv_ip): Fix inconsistent error message.
> ---
>  gas/config/tc-riscv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c
> index 1b730b4be36..a10ae8e237b 100644
> --- a/gas/config/tc-riscv.c
> +++ b/gas/config/tc-riscv.c
> @@ -2582,7 +2582,7 @@ riscv_ip (char *str, struct riscv_cl_insn *ip, expressionS *imm_expr,
>                             || imm_expr->X_add_number >= 64)
>                           {
>                             as_bad (_("bad value for compressed funct6 "
> -                                     "field, value must be 0...64"));
> +                                     "field, value must be 0...63"));
>                             break;
>                           }
>                         INSERT_OPERAND (CFUNCT6, *ip, imm_expr->X_add_number);
> --
> 2.34.1
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 0/2] gas: Minor strings fix on June 2022 (Mach-O and RISC-V)
  2022-06-12  4:12 ` [PATCH 0/2] gas: Minor strings fix on June 2022 (Mach-O and RISC-V) Tristan Gingold
  2022-06-12  9:28   ` Tsukasa OI
@ 2022-07-13  3:23   ` Tsukasa OI
  1 sibling, 0 replies; 10+ messages in thread
From: Tsukasa OI @ 2022-07-13  3:23 UTC (permalink / raw)
  To: Tristan Gingold; +Cc: binutils

On 2022/06/12 13:12, Tristan Gingold wrote:
> For me, the mach-o part is OK.  I am not sure I would translate section or segment as they are technical words, but you are the native speaker!
> 

Hi Tristan,

Fortunately, my other change (RISC-V part) is merged into master.  If
you are okay and you have a commit right, would you merge the Mach-O
part?  I'm afraid that I don't have commit rights.

Thanks,
Tsukasa

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [RESEND PATCH 0/1] gas: Minor strings fix on June 2022 (Mach-O part)
  2022-06-10 10:00 [PATCH 0/2] gas: Minor strings fix on June 2022 (Mach-O and RISC-V) Tsukasa OI
                   ` (2 preceding siblings ...)
  2022-06-12  4:12 ` [PATCH 0/2] gas: Minor strings fix on June 2022 (Mach-O and RISC-V) Tristan Gingold
@ 2022-08-07  7:40 ` Tsukasa OI
  2022-08-07  7:40   ` [RESEND PATCH 1/1] Mach-O: i18n enablement on some error messages Tsukasa OI
  3 siblings, 1 reply; 10+ messages in thread
From: Tsukasa OI @ 2022-08-07  7:40 UTC (permalink / raw)
  To: Tsukasa OI, Nick Clifton, Jan Beulich, Tristan Gingold; +Cc: binutils

This is a ping.

Previous:
<https://sourceware.org/pipermail/binutils/2022-June/121211.html>

This patchset contains some minor string improvements I discovered
while I'm investigating/translating GAS.

Original PATCH 2/2 was merged independently so I will resend PATCH 1/2 only.

It seems this is okay to Tristan (Mach-O maintainer) so I request for merge.
<https://sourceware.org/pipermail/binutils/2022-June/121224.html>



PATCH 1 : gas/config/obj-macho.c (i18n enablement)

On collect_16char_name on this file, there's a formatted error message:

> as_bad (_("the %s name '%s' is too long (maximum 16 characters)"),
>            msg, namstart);

collect_16char_name is called by obj_mach_o_get_section_names but
it does not wrap input `msg' parameter.  Quoting from the function:

> if (collect_16char_name (seg, "segment", 1))

> collect_16char_name (sec, "section", 0);

The words "segment" and "section" should be wrapped with _().
This is not a problem on French but it IS on Spanish.  I quote some
Spanish translation from gas/po/es.po:

> #: config/obj-macho.c:119
> #, c-format
> msgid "the %s name '%s' is too long (maximum 16 characters)"
> msgstr "el nombre %s «%s» es demasiado largo (máximo 16 caracteres)"

> #: config/tc-aarch64.c:607 config/tc-arm.c:1072 config/tc-i860.c:1003
> #: config/tc-sparc.c:3440
> msgid "bad segment"
> msgstr "segmento equivocado"

> #: config/tc-alpha.c:4274
> #, c-format
> msgid "unknown section attribute %s"
> msgstr "atributo seccional %s desconocido"

It will have following mappings in French (fr):

    segment  -->  segment
    section  -->  section

On the other hand, it will have following mappings in Spanish (es):

    segment  -->  segmento
    section  -->  seccional

In Japanese (the language I am trying to translate some GAS strings),
it will be visiblly significant:

Sample message in English:
    the section name 'ABC...' is too long (maximum 16 characters)
Possible Japanese translation without this patch:
    section 名 'ABC...' が長すぎます (最大 16 文字)
Possible Japanese translation with this patch:
    セクション名 'ABC...' が長すぎます (最大 16 文字)

In here, an English word "section" stands out too much in otherwise
Japanese message.  If we can translate the word "section" (technically,
transliterate) to "セクション" (Hepburn: sekushon), the whole sentense
gets more natural.

It will have following mappings in Japanese:

    segment  -->  セグメント
    section  -->  セクション

I completely understand that the most of Binutils users understand what
"section" and "segment" is.  However, we usually translate the text containing
"section" and "segment" (or at least make them translatable) and we don't want
messages with mixed languages.

Thanks,
Tsukasa




Tsukasa OI (1):
  Mach-O: i18n enablement on some error messages

 gas/config/obj-macho.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)


base-commit: 9663a947c09f63f75491dd4ad2f38fb448142240
-- 
2.34.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [RESEND PATCH 1/1] Mach-O: i18n enablement on some error messages
  2022-08-07  7:40 ` [RESEND PATCH 0/1] gas: Minor strings fix on June 2022 (Mach-O part) Tsukasa OI
@ 2022-08-07  7:40   ` Tsukasa OI
  2022-08-08 11:42     ` Nick Clifton
  0 siblings, 1 reply; 10+ messages in thread
From: Tsukasa OI @ 2022-08-07  7:40 UTC (permalink / raw)
  To: Tsukasa OI, Nick Clifton, Jan Beulich, Tristan Gingold; +Cc: binutils

This commit now wraps two string literals with _() for i18n support
enablement.  They are used in the collect_16char_name function to form
localized error messages that contain "%s name".

gas/ChangeLog:

	* config/obj-macho.c (obj_mach_o_get_section_names): Wrap two
	string literals within with gettext macro.
---
 gas/config/obj-macho.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gas/config/obj-macho.c b/gas/config/obj-macho.c
index f055aeadafb..119f2fd1356 100644
--- a/gas/config/obj-macho.c
+++ b/gas/config/obj-macho.c
@@ -141,7 +141,7 @@ obj_mach_o_get_section_names (char *seg, char *sec,
   /* Zero-length segment and section names are allowed.  */
   /* Parse segment name.  */
   memset (seg, 0, segl);
-  if (collect_16char_name (seg, "segment", 1))
+  if (collect_16char_name (seg, _("segment"), 1))
     {
       ignore_rest_of_line ();
       return 0;
@@ -150,7 +150,7 @@ obj_mach_o_get_section_names (char *seg, char *sec,
 
   /* Parse section name, which can be empty.  */
   memset (sec, 0, secl);
-  collect_16char_name (sec, "section", 0);
+  collect_16char_name (sec, _("section"), 0);
   return 1;
 }
 
-- 
2.34.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [RESEND PATCH 1/1] Mach-O: i18n enablement on some error messages
  2022-08-07  7:40   ` [RESEND PATCH 1/1] Mach-O: i18n enablement on some error messages Tsukasa OI
@ 2022-08-08 11:42     ` Nick Clifton
  0 siblings, 0 replies; 10+ messages in thread
From: Nick Clifton @ 2022-08-08 11:42 UTC (permalink / raw)
  To: Tsukasa OI, Jan Beulich, Tristan Gingold; +Cc: binutils

Hi Tsukasa,

> gas/ChangeLog:
> 
> 	* config/obj-macho.c (obj_mach_o_get_section_names): Wrap two
> 	string literals within with gettext macro.

Patch approved and applied.

Cheers
   Nick


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-08-08 11:42 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-10 10:00 [PATCH 0/2] gas: Minor strings fix on June 2022 (Mach-O and RISC-V) Tsukasa OI
2022-06-10 10:00 ` [PATCH 1/2] Mach-O: i18n enablement on some error messages Tsukasa OI
2022-06-10 10:00 ` [PATCH 2/2] RISC-V: Fix inconsistent error message (range) Tsukasa OI
2022-06-22 10:36   ` Nelson Chu
2022-06-12  4:12 ` [PATCH 0/2] gas: Minor strings fix on June 2022 (Mach-O and RISC-V) Tristan Gingold
2022-06-12  9:28   ` Tsukasa OI
2022-07-13  3:23   ` Tsukasa OI
2022-08-07  7:40 ` [RESEND PATCH 0/1] gas: Minor strings fix on June 2022 (Mach-O part) Tsukasa OI
2022-08-07  7:40   ` [RESEND PATCH 1/1] Mach-O: i18n enablement on some error messages Tsukasa OI
2022-08-08 11:42     ` Nick Clifton

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).