From patchwork Thu Jul 20 19:41:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Eggert X-Patchwork-Id: 21712 Received: (qmail 94552 invoked by alias); 20 Jul 2017 19:41:47 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 94524 invoked by uid 89); 20 Jul 2017 19:41:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy=stan, formerly X-HELO: zimbra.cs.ucla.edu Subject: Re: libc-2.25.90.pot To: Siddhesh Poyarekar , Adhemerval Zanella , Benno Schulenberg , libc-alpha@sourceware.org References: <8b9b4e60-f580-e56a-26bc-adb7192ba779@sourceware.org> <6e7f7602-3536-2edb-0cf4-e66a948fdb71@translationproject.org> Cc: Time Zone Mailing List From: Paul Eggert Message-ID: <9b1396c9-dd87-5627-6a26-3d6be03cb1df@cs.ucla.edu> Date: Thu, 20 Jul 2017 12:41:42 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: On 07/20/2017 07:57 AM, Siddhesh Poyarekar wrote: > Oh I meant PRIdLINENO, not PRIdMAX. I suppose using PRIdMAX directly > might work since gettext seems to recognize the other PRI* macros. Yes, PRIdMAX should work. The zic.c code uses the macro (as opposed to just %jd) to be portable to pre-C99 libraries. I installed the attached patch into the upstream tzdb sources; the zic.c part of it should work for glibc too. Thanks for reporting the problem. From fd13571c626bac8f5bb90ad79543cefae0fef134 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 20 Jul 2017 12:34:12 -0700 Subject: [PATCH] Fix zic.c incompatibility with xgettext Problem reported by Benno Schulenberg in: https://sourceware.org/ml/libc-alpha/2017-07/msg00653.html * NEWS: Document this. * zic.c (PRIdLINENO): Remove. All uses replaced with definiens. --- NEWS | 3 +++ zic.c | 11 ++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index 5f79225..64d5c91 100644 --- a/NEWS +++ b/NEWS @@ -102,6 +102,9 @@ Unreleased, experimental changes Calculation of time_t extrema works around a bug in GCC 4.8.4 (Reported by Stan Shebs and Joseph Myers.) + zic.c no longer mistranslates formats of line numbers in non-English + locales. (Problem reported by Benno Schulenberg.) + Several minor changes have been made to the code to make it a bit easier to port to MS-Windows and Solaris. (Thanks to Kees Dekker for reporting the problems.) diff --git a/zic.c b/zic.c index 300d563..765fe7d 100644 --- a/zic.c +++ b/zic.c @@ -58,9 +58,10 @@ typedef int_fast64_t zic_t; static ptrdiff_t const PTRDIFF_MAX = MAXVAL(ptrdiff_t, TYPE_BIT(ptrdiff_t)); #endif -/* The type and printf format for line numbers. */ +/* The type for line numbers. Use PRIdMAX to format them; formerly + there was also "#define PRIdLINENO PRIdMAX" and formats used + PRIdLINENO, but xgettext cannot grok that. */ typedef intmax_t lineno; -#define PRIdLINENO PRIdMAX struct rule { const char * r_filename; @@ -499,10 +500,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 %"PRIdMAX": "), filename, linenum); vfprintf(stderr, string, args); if (rfilename != NULL) - fprintf(stderr, _(" (rule from \"%s\", line %"PRIdLINENO")"), + fprintf(stderr, _(" (rule from \"%s\", line %"PRIdMAX")"), rfilename, rlinenum); fprintf(stderr, "\n"); } @@ -1264,7 +1265,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 %"PRIdMAX")"), fields[ZF_NAME], zones[i].z_filename, zones[i].z_linenum); -- 2.13.3