public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Joseph Myers <joseph@codesourcery.com>
To: chenglulu <chenglulu@loongson.cn>
Cc: <gcc-patches@gcc.gnu.org>, <yangyujie@loongson.cn>,
	<xuchenghua@loongson.cn>
Subject: Re: [PATCH 01/12] LoongArch Port: gcc build
Date: Mon, 29 Nov 2021 21:10:41 +0000	[thread overview]
Message-ID: <alpine.DEB.2.22.394.2111292102230.1907190@digraph.polyomino.org.uk> (raw)
In-Reply-To: <20211127082735.4139682-2-chenglulu@loongson.cn>

On Sat, 27 Nov 2021, chenglulu wrote:

> +	if (p_arch_native)
> +	  fatal_error (UNKNOWN_LOCATION,
> +		       "Unknown FPU type %<0x%x%>, "
> +		       "%<-m" OPTSTR_ARCH "=" STR_CPU_NATIVE "%> failed",

Diagnostics should not start with an uppercase letter (unless the start 
would have a capital letter even in the middle of a sentence - thus, the 
diagnostic you have elsewhere starting "ABI" is fine as-is).

Diagnostics can't use string concatenation with macros, because that means 
only the part up to the first macro name gets extracted into gcc.pot for 
translation - in this case, "Unknown FPU type %<0x%x%>, %<-m" - so the 
translations never match at runtime.  The whole format string for a 
diagnostic function needs to appear directly in the call to the function 
(or to macros such as G_), without any part of that string itself coming 
from macro expansion, for translation to work properly.

> +	inform (UNKNOWN_LOCATION, "Unknown processor ID %<0x%x%>, "
> +		"some tuning parameters will fall back to default",

Diagnostics should not start with an uppercase letter.

> +	inform (UNKNOWN_LOCATION,
> +		"%<-m%s%> overrides %<-m" OPTSTR_ABI_BASE "=%s%>",

Same comment as above about not concatenating with macros in diagnostics.

> +  if (t.cpu_arch == CPU_NATIVE)
> +    fatal_error (UNKNOWN_LOCATION,
> +		 "%<-m" OPTSTR_ARCH "=" STR_CPU_NATIVE "%> "
> +		 "does not work on a cross compiler");
> +
> +  else if (t.cpu_tune == CPU_NATIVE)
> +    fatal_error (UNKNOWN_LOCATION,
> +		 "%<-m" OPTSTR_TUNE "=" STR_CPU_NATIVE "%> "
> +		 "does not work on a cross compiler");

Likewise.

> +      warning (0, "%s CPU architecture (%qs) does not support %qs ABI, "
> +	       "falling back to %<-m" OPTSTR_ARCH "=%s%>",

Likewise.

> +	       (t.cpu_arch == CPU_NATIVE ? "your native" : "default"),

Also, "your native" and "default" look like they are intended as English 
that should be translated, not e.g. literal option arguments that should 
stay as-is.  So they needs to appear directly in the diagnostic sentence 
for proper translation, e.g.

  if (t.cpu_arch == CPU_NATIVE)
    warning (...);
  else
    warning (...);

(if you use a conditional expression in the second argument to warning to 
avoid having separate calls like that, both format strings then need to 
have G_ () around them to ensure they are properly extracted for 
translation).

-- 
Joseph S. Myers
joseph@codesourcery.com

  parent reply	other threads:[~2021-11-29 21:10 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-27  8:27 LoongArch Port chenglulu
2021-11-27  8:27 ` [PATCH 01/12] LoongArch Port: gcc build chenglulu
2021-11-27 23:39   ` Xi Ruoyao
2021-11-27 23:43     ` Xi Ruoyao
2021-11-28  0:51   ` Xi Ruoyao
2021-11-29 21:10   ` Joseph Myers [this message]
2021-11-27  8:27 ` [PATCH 02/12] LoongArch Port: Regenerate gcc/configure chenglulu
2021-11-27  8:27 ` [PATCH 03/12] LoongArch Port: Machine Decsription files chenglulu
2021-11-27  8:27 ` [PATCH 04/12] LoongArch Port: Machine description C files and .h files chenglulu
2021-11-27  8:27 ` [PATCH 05/12] LoongArch Port: Builtin functions chenglulu
2021-11-27  8:27 ` [PATCH 06/12] LoongArch Port: Builtin macros chenglulu
2021-11-27  8:27 ` [PATCH 07/12] LoongArch Port: libgcc chenglulu
2021-11-27  8:27 ` [PATCH 08/12] LoongArch Port: Regenerate libgcc/configure chenglulu
2021-11-27  8:27 ` [PATCH 09/12] LoongArch Port: libgomp chenglulu
2021-11-27  8:27 ` [PATCH 10/12] LoongArch Port: gcc/testsuite chenglulu
2021-11-27  8:27 ` [PATCH 11/12] LoongArch Port: Regenerate configure chenglulu
2021-11-27  8:27 ` [PATCH 12/12] LoongArch Port: Add doc chenglulu
2021-11-27  9:57 ` LoongArch Port Xi Ruoyao
2021-11-28  0:06 ` Xi Ruoyao
2021-11-28  8:37 ` Xi Ruoyao

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=alpine.DEB.2.22.394.2111292102230.1907190@digraph.polyomino.org.uk \
    --to=joseph@codesourcery.com \
    --cc=chenglulu@loongson.cn \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=xuchenghua@loongson.cn \
    --cc=yangyujie@loongson.cn \
    /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).