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] Fix exgettext to handle multi-line help texts from *.opt files (PR translation/78745)


On Thu, 16 Feb 2017, Jakub Jelinek wrote:
> On Thu, Feb 16, 2017 at 01:56:15PM +0300, Alexander Monakov wrote:
> Are you sure you can't have them in *.c file (e.g. by setting some variable
> to a spec string or similar)?
> I think it is better to scan all those files.

Hm, probably that idea was premature, but I hope you can bear with me a bit more
here.  It still strikes me as really odd that exgettext works by scanning all
strings for %e/%n.  Would it be possible to explicitly delimit translatable spec
messages, by rewriting where we currently have

  "... %eMessage} ..."

to

  #define SPEC_MESSAGE(msg) msg

  "... %e" SPEC_MESSAGE ("Message") "} ..."

and then only handling SPEC_MESSAGE specially in exgettext, rather than %e?

> To avoid triggering this you can e.g. use
> --- gcc/config/nvptx/nvptx.c.jj	2017-01-01 12:45:43.000000000 +0100
> +++ gcc/config/nvptx/nvptx.c	2017-02-16 12:31:49.261550375 +0100
> @@ -1129,7 +1129,7 @@ write_omp_entry (FILE *file, const char
>  	.reg.u32 %r<3>;\n\
>  	.reg.u" PS " %R<4>;\n\
>  	mov.u32 %r0, %tid.y;\n\
> -	mov.u32 %r1, %ntid.y;\n\
> +	mov.u32 %r1, %ntid.y;\n""\
>  	mov.u32 %r2, %ctaid.x;\n\
>  	cvt.u" PS ".u32 %R1, %r0;\n\
>  	" MAD_PS_32 " %R1, %r1, %r2, %R1;\n\

I believe this is preferable as a minimal fix, perhaps with a space between
added quotes, or even:

+	mov.u32 %r1, %ntid.y;\n" /* Avoid %n processing in exgettext.  */ "\

(sorry for the bikeshed)

> or change the macro so that it doesn't use multi-line string and instead
> has say:
> "\n\t"	"mov.u32 %r1, %ntid.y;"
> "\n\t"	"mov.u32 %r2, %ctaid.x;"
> etc. style. or even just
> "	mov.u32 %r1, %ntid.y;\n"
> "	mov.u32 %r2, %ctaid.x;\n"

These variants need adding backslash-at-eol for continuing the macro body.  If
changing the macro is desired, this style can help keep the noise down:

"\n<tab>mov.u32 %r1, %ntid.y;" \

Thanks.
Alexander

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