libc-2.25.90.pot

Message ID f63c4d0d-3e15-6bca-e6e7-ee965e1bc0bf@linaro.org
State Dropped
Headers

Commit Message

Adhemerval Zanella July 19, 2017, 1:28 p.m. UTC
  On 19/07/2017 04:33, Benno Schulenberg wrote:
> Op 19-07-2017 om 09:15 schreef Siddhesh Poyarekar:
>> On Wednesday 19 July 2017 12:32 AM, Adhemerval Zanella wrote:
>>>
>>> And 'PRIdLINENO' is defined as
>>>
>>> 50 typedef intmax_t lineno;
>>> 51 #define PRIdLINENO PRIdMAX
>>>
>>> Which means we will get different string encodings depending of how
>>> __PRI64_PREFIX is defined by the ABI.
>>>
>>> Both changes came from '92bd70fb' (Update timezone code from tzcode 2017b.) and
>>> from original tz project it seems to get from cc8aec6ecb1ecc (zic: some
>>> integer-width fixups).  TZ commit log seems to indicate this is just a integer
>>> cleanup without original from an actual bug or limitation.
>>>
>>> Paul I think we can use default %d for ints for these two specific printf to
>>> make translation work as intended. What do you think?
>>
>> There are three of those instances and they refer to line numbers in the
>> timezone data file.  If we can assume that the tzdata files are sane
>> then I suppose we could assume %d for these.
> 
> Or at least change them to something that xgettext recognizes.  There are
> several instances of %<PRIuMAX> and %<PRIu64> in the POT file, so xgettext
> is able to recognize some of those "PRI..." strings, but seemingly not
> custom-defined ones?

I think for glibc, since we support C99 intmax_t printf format, we can
just use %jd instead:

	* timezone/zic.c (PRIdLINENO): Remove macro.
	(verror): Use %jd instead of PRIdLINENO.
---
 ChangeLog      | 5 +++++
 timezone/zic.c | 7 +++----
 2 files changed, 8 insertions(+), 4 deletions(-)

--
  

Comments

Siddhesh Poyarekar July 19, 2017, 1:49 p.m. UTC | #1
On Wednesday 19 July 2017 06:58 PM, Adhemerval Zanella wrote:
> I think for glibc, since we support C99 intmax_t printf format, we can
> just use %jd instead:
> 
> 	* timezone/zic.c (PRIdLINENO): Remove macro.
> 	(verror): Use %jd instead of PRIdLINENO.

Fine with me, but I'd like to hear from Joseph/Paul too if they have any
context from the tz project that may make this a bad idea.

Siddhesh

> ---
>  ChangeLog      | 5 +++++
>  timezone/zic.c | 7 +++----
>  2 files changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/timezone/zic.c b/timezone/zic.c
> index 068fb43..aaef06b 100644
> --- a/timezone/zic.c
> +++ b/timezone/zic.c
> @@ -48,7 +48,6 @@ static ptrdiff_t const PTRDIFF_MAX = MAXVAL(ptrdiff_t, TYPE_BIT(ptrdiff_t));
>  
>  /* The type and printf format for line numbers.  */
>  typedef intmax_t lineno;
> -#define PRIdLINENO PRIdMAX
>  
>  struct rule {
>  	const char *	r_filename;
> @@ -484,10 +483,10 @@ verror(const char *const string, va_list args)
>  	** on BSD systems.
>  	*/
>  	if (filename)
> -	  fprintf(stderr, _("\"%s\", line %"PRIdLINENO": "), filename, linenum);
> +	  fprintf(stderr, _("\"%s\", line %jd: "), filename, linenum);
>  	vfprintf(stderr, string, args);
>  	if (rfilename != NULL)
> -		fprintf(stderr, _(" (rule from \"%s\", line %"PRIdLINENO")"),
> +		fprintf(stderr, _(" (rule from \"%s\", line %jd)"),
>  			rfilename, rlinenum);
>  	fprintf(stderr, "\n");
>  }
> @@ -1250,7 +1249,7 @@ _("\"Zone %s\" line and -p option are mutually exclusive"),
>  		if (zones[i].z_name != NULL &&
>  			strcmp(zones[i].z_name, fields[ZF_NAME]) == 0) {
>  				error(_("duplicate zone name %s"
> -					" (file \"%s\", line %"PRIdLINENO")"),
> +					" (file \"%s\", line %jd)"),
>  					fields[ZF_NAME],
>  					zones[i].z_filename,
>  					zones[i].z_linenum);
>
  
Siddhesh Poyarekar July 20, 2017, 11:17 a.m. UTC | #2
On Wednesday 19 July 2017 07:19 PM, Siddhesh Poyarekar wrote:
> On Wednesday 19 July 2017 06:58 PM, Adhemerval Zanella wrote:
>> I think for glibc, since we support C99 intmax_t printf format, we can
>> just use %jd instead:
>>
>> 	* timezone/zic.c (PRIdLINENO): Remove macro.
>> 	(verror): Use %jd instead of PRIdLINENO.
> 
> Fine with me, but I'd like to hear from Joseph/Paul too if they have any
> context from the tz project that may make this a bad idea.

In the interest of unblocking the translation team, lets wait till
tomorrow and then commit if there are no objections.  The more I look at
the change the more it looks like future-proofing and not relevant to a
current problem.  If the future-proofing is necessary, we can get it
back in 2.26.90 in a way that does not break translation strings.

Siddhesh
  
Adhemerval Zanella July 20, 2017, 12:52 p.m. UTC | #3
On 20/07/2017 08:17, Siddhesh Poyarekar wrote:
> On Wednesday 19 July 2017 07:19 PM, Siddhesh Poyarekar wrote:
>> On Wednesday 19 July 2017 06:58 PM, Adhemerval Zanella wrote:
>>> I think for glibc, since we support C99 intmax_t printf format, we can
>>> just use %jd instead:
>>>
>>> 	* timezone/zic.c (PRIdLINENO): Remove macro.
>>> 	(verror): Use %jd instead of PRIdLINENO.
>>
>> Fine with me, but I'd like to hear from Joseph/Paul too if they have any
>> context from the tz project that may make this a bad idea.
> 
> In the interest of unblocking the translation team, lets wait till
> tomorrow and then commit if there are no objections.  The more I look at
> the change the more it looks like future-proofing and not relevant to a
> current problem.  If the future-proofing is necessary, we can get it
> back in 2.26.90 in a way that does not break translation strings.

I would not say future-proof, but rather the macro is to allow more
compatibility for different libc implementation (for the case where the
libc is c99 compatible but not support %jd).
  
Siddhesh Poyarekar July 20, 2017, 2:57 p.m. UTC | #4
On Thursday 20 July 2017 06:22 PM, Adhemerval Zanella wrote:
> I would not say future-proof, but rather the macro is to allow more
> compatibility for different libc implementation (for the case where the
> libc is c99 compatible but not support %jd).

Oh I meant PRIdLINENO, not PRIdMAX.  I suppose using PRIdMAX directly
might work since gettext seems to recognize the other PRI* macros.

Siddhesh
  

Patch

diff --git a/timezone/zic.c b/timezone/zic.c
index 068fb43..aaef06b 100644
--- a/timezone/zic.c
+++ b/timezone/zic.c
@@ -48,7 +48,6 @@  static ptrdiff_t const PTRDIFF_MAX = MAXVAL(ptrdiff_t, TYPE_BIT(ptrdiff_t));
 
 /* The type and printf format for line numbers.  */
 typedef intmax_t lineno;
-#define PRIdLINENO PRIdMAX
 
 struct rule {
 	const char *	r_filename;
@@ -484,10 +483,10 @@  verror(const char *const string, va_list args)
 	** on BSD systems.
 	*/
 	if (filename)
-	  fprintf(stderr, _("\"%s\", line %"PRIdLINENO": "), filename, linenum);
+	  fprintf(stderr, _("\"%s\", line %jd: "), filename, linenum);
 	vfprintf(stderr, string, args);
 	if (rfilename != NULL)
-		fprintf(stderr, _(" (rule from \"%s\", line %"PRIdLINENO")"),
+		fprintf(stderr, _(" (rule from \"%s\", line %jd)"),
 			rfilename, rlinenum);
 	fprintf(stderr, "\n");
 }
@@ -1250,7 +1249,7 @@  _("\"Zone %s\" line and -p option are mutually exclusive"),
 		if (zones[i].z_name != NULL &&
 			strcmp(zones[i].z_name, fields[ZF_NAME]) == 0) {
 				error(_("duplicate zone name %s"
-					" (file \"%s\", line %"PRIdLINENO")"),
+					" (file \"%s\", line %jd)"),
 					fields[ZF_NAME],
 					zones[i].z_filename,
 					zones[i].z_linenum);