public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Patch I have Formatted in Git
@ 2017-09-29 16:07 nick
  2017-09-29 20:25 ` Joseph Myers
  0 siblings, 1 reply; 3+ messages in thread
From: nick @ 2017-09-29 16:07 UTC (permalink / raw)
  To: gcc-patches

Greetings All,
I have this patch formatted in git, I was unable to figure out how the whole svn works. I
am new to svn. Here is the patch below so any comments on this patch or how to format it
properly would be great:
From a86173b1cab13a8fe5615c53005adcfafb97415f Mon Sep 17 00:00:00 2001
From: Nicholas Krause <xerofoify@gmail.com>
Date: Fri, 29 Sep 2017 11:39:46 -0400
Subject: [PATCH] Fix maybe_complain_about_tail_call_arises
 This patch fixes, https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80188 which 
 reports that the char* pointer reason is not being translated properly when the 
 error message from the function, maybe_complain_about_tail_call arises. Fix it 
 by wrapping it in the N_ marco to translate to the proper lanuage of the user. 
 No new testcases are required due to the triviality of the bug.

Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
---
 gcc/calls.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/calls.c b/gcc/calls.c
index 6bd025ed197..cfdd6b2cf6b 100644
--- a/gcc/calls.c
+++ b/gcc/calls.c
@@ -1516,7 +1516,7 @@ maybe_complain_about_tail_call (tree call_expr, const char *reason)
   if (!CALL_EXPR_MUST_TAIL_CALL (call_expr))
     return;
 
-  error_at (EXPR_LOCATION (call_expr), "cannot tail-call: %s", reason);
+  error_at (EXPR_LOCATION (call_expr), "cannot tail-call: %s", N_(reason));
 }
 
 /* Fill in ARGS_SIZE and ARGS array based on the parameters found in
-- 
2.11.0

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

* Re: Patch I have Formatted in Git
  2017-09-29 16:07 Patch I have Formatted in Git nick
@ 2017-09-29 20:25 ` Joseph Myers
  2017-09-29 20:31   ` nick
  0 siblings, 1 reply; 3+ messages in thread
From: Joseph Myers @ 2017-09-29 20:25 UTC (permalink / raw)
  To: nick; +Cc: gcc-patches

On Fri, 29 Sep 2017, nick wrote:

> -  error_at (EXPR_LOCATION (call_expr), "cannot tail-call: %s", reason);
> +  error_at (EXPR_LOCATION (call_expr), "cannot tail-call: %s", N_(reason));

This can't be right.  N_ only makes sense around a string literal (e.g. in 
a constant initializer); it marks a string for extraction for translation, 
but does not cause it to be translated at runtime.  You need _() to cause 
the translation at runtime (and then make sure that every string constant 
that can end up as a value of reason is surrounded by N_() - or just 
surround the string constants directly by _() if there isn't a reason that 
won't work).

-- 
Joseph S. Myers
joseph@codesourcery.com

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

* Re: Patch I have Formatted in Git
  2017-09-29 20:25 ` Joseph Myers
@ 2017-09-29 20:31   ` nick
  0 siblings, 0 replies; 3+ messages in thread
From: nick @ 2017-09-29 20:31 UTC (permalink / raw)
  To: Joseph Myers; +Cc: gcc-patches



On 2017-09-29 04:25 PM, Joseph Myers wrote:
> On Fri, 29 Sep 2017, nick wrote:
> 
>> -  error_at (EXPR_LOCATION (call_expr), "cannot tail-call: %s", reason);
>> +  error_at (EXPR_LOCATION (call_expr), "cannot tail-call: %s", N_(reason));
> 
> This can't be right.  N_ only makes sense around a string literal (e.g. in 
> a constant initializer); it marks a string for extraction for translation, 
> but does not cause it to be translated at runtime.  You need _() to cause 
> the translation at runtime (and then make sure that every string constant 
> that can end up as a value of reason is surrounded by N_() - or just 
> surround the string constants directly by _() if there isn't a reason that 
> won't work).
> 
Exactly what was commented on my another developer I agree should be _(reason) 
as this will need to be used at runtime. I am just building and running
the tests for it now.

Thanks,
Nick

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

end of thread, other threads:[~2017-09-29 20:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-29 16:07 Patch I have Formatted in Git nick
2017-09-29 20:25 ` Joseph Myers
2017-09-29 20:31   ` nick

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