From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 209.51.188.0/24 X-Spam-Status: No, score=-4.0 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 0C13C1F461 for ; Wed, 3 Jul 2019 04:48:47 +0000 (UTC) Received: from localhost ([::1]:60702 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hiXCH-0004cs-Bx for normalperson@yhbt.net; Wed, 03 Jul 2019 00:48:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58252) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hiXC7-0004aG-SG for bug-gnulib@gnu.org; Wed, 03 Jul 2019 00:48:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hiXC6-0003qQ-Ie for bug-gnulib@gnu.org; Wed, 03 Jul 2019 00:48:35 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]:40936) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hiXC6-0003oo-8M for bug-gnulib@gnu.org; Wed, 03 Jul 2019 00:48:34 -0400 Received: by mail-wm1-x32b.google.com with SMTP id v19so732315wmj.5 for ; Tue, 02 Jul 2019 21:48:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=ClVsOorF6327+d4tqyccM3lel0mrndO1Evlvx/clwCc=; b=bBlm22SC8658ainflwHnH9wu0+nLlONNB2tdAum1XBWwPrVeXd1sZthbgxNMA+Wa0G WiJQIxoKBlkeTAuON8yvgWhpZ6u9C1Sp/ZIcfdts7niE4P0OrsIlPCPe2eswv/p/CVQy PMYa/pzNAeB3yIwUz/YIspe579aMRysV196UALbQnaSwetX40b4MuvIJhJUidkE2vKMj poV6ftC2BVMon1DwIfDB5z4VR5SI+0kjmy4W/62xiYNhim+zAOPpGD2eZMGOWcxkbzR8 WPspp/ejOIUOPtwwVksk/DSgBiGPbhSBBQiJ6VTCDSQdmMXqpFVSI6jmw9vFEV9vBwfF E0+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=ClVsOorF6327+d4tqyccM3lel0mrndO1Evlvx/clwCc=; b=L6B5CCoK7+WgPvxRr4CL6w3swUb1ROK4oz2d+0v8VzmD2hBYg9etEiZ9j2mzm14Lzg M+FpQofreOpcQV6tFPLe40ziewIZxNWB2kMA275xIa4CMiy9Tg1748p0IjlA+rMX9Ksg wIbtAwxlZsqxgwaONy1LgBOFdTKNF449227BoUUL144EOzkS3HUlXBjLm0qwzLbtYnd/ 7SrrtSVPuAP7zCeOQEBT7vry3yLvnNZ2kkWRukzolJzVf48n5EDUM7qsV3Q7/CXY59Te dAU5XirwnhwThy2X9ZE0JAbqUUS7ESo9NieushKiAudQflXkhAqeBusxE04h4XjhdhQd l99A== X-Gm-Message-State: APjAAAWKfg1hycsDLHX8Mcno6NBqnjxFxTOkKxOw4og2nuu+T/o7m9m+ hWvZLvSnA9+5jOScKQewJHM= X-Google-Smtp-Source: APXvYqytYsNvfBR7+l4gcHlQ/bM+lhfUJknPTMWSbpWHWl2uL5OFgvz79zeW+P+sgOd7JTu3tOtTQg== X-Received: by 2002:a1c:6585:: with SMTP id z127mr6362066wmb.25.1562129312515; Tue, 02 Jul 2019 21:48:32 -0700 (PDT) Received: from ?IPv6:2a01:e35:2fd9:96a0:4497:18dc:1cd4:768a? ([2a01:e35:2fd9:96a0:4497:18dc:1cd4:768a]) by smtp.gmail.com with ESMTPSA id x11sm911430wmg.23.2019.07.02.21.48.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Jul 2019 21:48:31 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.8\)) Subject: Re: argmatch.h: new "_" definition may conflict with that of callers From: Akim Demaille In-Reply-To: Date: Wed, 3 Jul 2019 06:48:28 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: References: To: Jim Meyering X-Mailer: Apple Mail (2.3445.104.8) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::32b X-BeenThere: bug-gnulib@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Gnulib discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "bug-gnulib@gnu.org List" Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: "bug-gnulib" Hi Jim! > Le 3 juil. 2019 =C3=A0 06:17, Jim Meyering a =C3=A9cr= it : >=20 > Hi Akim, > I tried to build grep using latest gnulib and it failed with these = errors: >=20 > CC grep.o > In file included from grep.c:30: > ../lib/argmatch.h:35: error: "_" redefined [-Werror] > 35 | # define _(Msgid) gettext (Msgid) > | > In file included from grep.c:28: > system.h:43: note: this is the location of the previous definition > 43 | #define _(String) gettext(String) > | > In file included from grep.c:30: > ../lib/argmatch.h:36: error: "N_" redefined [-Werror] > 36 | # define N_(Msgid) (Msgid) > | > In file included from grep.c:28: > system.h:42: note: this is the location of the previous definition > 42 | #define N_(String) gettext_noop(String) >=20 > First, the "N_" definition appears unnecessary: it is used in neither > of argmatch.[ch]. > One fix for the "_" problem is to expand it: s/\b_\b/gettext / >=20 > Care to fix it, one way or another? Bummer :( Sorry about that. I installed the following commit. Cheers! commit 65b3308bb67777a8e42b0d5a4550a62562790e10 Author: Akim Demaille Date: Wed Jul 3 06:35:34 2019 +0200 argmatch: don't define _ in the header =20 Reported by Jim Meyering. =20 * lib/argmatch.h (N_, _): Don't define. Use gettext instead. * lib/argmatch.h (_): Define. * tests/test-argmatch.c (N_): Define. diff --git a/ChangeLog b/ChangeLog index b89fd5d9e..c3e197870 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2019-07-03 Akim Demaille + + argmatch: don't define _ in the header. + Reported by Jim Meyering. + * lib/argmatch.h (N_, _): Don't define. + Use gettext instead. + * lib/argmatch.h (_): Define. + * tests/test-argmatch.c (N_): Define. + 2019-07-02 Paul Eggert =20 verify: document =E2=80=98assume=E2=80=99 better diff --git a/lib/argmatch.c b/lib/argmatch.c index 183a0ca94..9eeb4514d 100644 --- a/lib/argmatch.c +++ b/lib/argmatch.c @@ -29,6 +29,8 @@ #include #include =20 +#define _(msgid) gettext (msgid) + #include "error.h" #include "quotearg.h" #include "getprogname.h" diff --git a/lib/argmatch.h b/lib/argmatch.h index d18549942..57d131f32 100644 --- a/lib/argmatch.h +++ b/lib/argmatch.h @@ -32,9 +32,6 @@ # include "quote.h" # include "verify.h" =20 -# define _(Msgid) gettext (Msgid) -# define N_(Msgid) (Msgid) - # ifdef __cplusplus extern "C" { # endif @@ -223,7 +220,7 @@ char const *argmatch_to_argument (void const *value, = \ /* Try to put synonyms on the same line. Synonyms are expected = \ to follow each other. */ = \ - fputs (_("Valid arguments are:"), out); = \ + fputs (gettext ("Valid arguments are:"), out); = \ for (int i =3D 0; g->args[i].arg; i++) = \ if (i =3D=3D 0 = \ || memcmp (&g->args[i-1].val, &g->args[i].val, size)) = \ @@ -284,7 +281,7 @@ char const *argmatch_to_argument (void const *value, large width. */ = \ const int screen_width =3D getenv ("HELP2MAN") ? INT_MAX : 80; = \ if (g->doc_pre) = \ - fprintf (out, "%s\n", _(g->doc_pre)); = \ + fprintf (out, "%s\n", gettext (g->doc_pre)); = \ int doc_col =3D argmatch_##Name##_doc_col (); = \ for (int i =3D 0; g->docs[i].arg; ++i) = \ { = \ @@ -321,10 +318,11 @@ char const *argmatch_to_argument (void const = *value, fprintf (out, "\n"); = \ col =3D 0; = \ } = \ - fprintf (out, "%*s%s\n", doc_col - col, "", _(g->docs[i].doc)); = \ + fprintf (out, "%*s%s\n", = \ + doc_col - col, "", gettext (g->docs[i].doc)); = \ } = \ if (g->doc_post) = \ - fprintf (out, "%s\n", _(g->doc_post)); = \ + fprintf (out, "%s\n", gettext (g->doc_post)); = \ } =20 # ifdef __cplusplus diff --git a/tests/test-argmatch.c b/tests/test-argmatch.c index 11b5819ea..7b1b38a19 100644 --- a/tests/test-argmatch.c +++ b/tests/test-argmatch.c @@ -25,6 +25,8 @@ =20 #include "macros.h" =20 +# define N_(Msgid) (Msgid) + /* Some packages define ARGMATCH_DIE and ARGMATCH_DIE_DECL in = , and thus must link with a definition of that function. Provide it here. = */ #ifdef ARGMATCH_DIE_DECL