From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 108022 invoked by alias); 10 Mar 2017 06:33:23 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 107982 invoked by uid 89); 10 Mar 2017 06:33:22 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 10 Mar 2017 06:33:20 +0000 Received: from smtp.corp.redhat.com (int-mx16.intmail.prod.int.phx2.redhat.com [10.5.11.28]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B383A1293; Fri, 10 Mar 2017 06:33:20 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-117-76.ams2.redhat.com [10.36.117.76]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 324042D654; Fri, 10 Mar 2017 06:33:20 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id v2A6XFvf026306; Fri, 10 Mar 2017 07:33:16 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id v2A6XE0h026305; Fri, 10 Mar 2017 07:33:14 +0100 Date: Fri, 10 Mar 2017 06:33:00 -0000 From: Jakub Jelinek To: David Malcolm Cc: gcc-patches@gcc.gnu.org, roland.illig@gmx.de, Joseph Myers Subject: Re: [PATCH 6/7] i386.c: make "sorry" message more amenable to translation (PR target/79926) Message-ID: <20170310063314.GS22703@tucnak> Reply-To: Jakub Jelinek References: <1489081529-22256-1-git-send-email-dmalcolm@redhat.com> <1489081529-22256-7-git-send-email-dmalcolm@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1489081529-22256-7-git-send-email-dmalcolm@redhat.com> User-Agent: Mutt/1.7.1 (2016-10-04) X-IsSubscribed: yes X-SW-Source: 2017-03/txt/msg00502.txt.bz2 On Thu, Mar 09, 2017 at 12:45:28PM -0500, David Malcolm wrote: > PR target/79926 notes that in: > > sorry ("%s instructions aren't allowed in %s service routine", > isa, (cfun->machine->func_type == TYPE_EXCEPTION > ? "exception" : "interrupt")); > > the text from the second %s won't be translated, but should be. > > This patch reworks the diagnostic by breaking it out into two messages > and marking them with G_() so they're seen by xgettext; a test run of > xgettext confirms that both messages make it into po/gcc.pot (in an > earlier version of the patch I attempted to do it without introducing > a local, but xgettext only picked up on one of the strings). > > gcc/ChangeLog: > PR target/79926 > * config/i386/i386.c (ix86_set_current_function): Make "sorry" > message more amenable to translation. > --- > gcc/config/i386/i386.c | 12 +++++++++--- > 1 file changed, 9 insertions(+), 3 deletions(-) > > diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c > index e705a3e..b8688e3 100644 > --- a/gcc/config/i386/i386.c > +++ b/gcc/config/i386/i386.c > @@ -7271,9 +7271,15 @@ ix86_set_current_function (tree fndecl) > if (isa != NULL) > { > if (cfun->machine->func_type != TYPE_NORMAL) > - sorry ("%s instructions aren't allowed in %s service routine", > - isa, (cfun->machine->func_type == TYPE_EXCEPTION > - ? "exception" : "interrupt")); > + { > + const char *msgid > + = (cfun->machine->func_type == TYPE_EXCEPTION > + ? G_("%s instructions aren't allowed in" > + " exception service routine") > + : G_("%s instructions aren't allowed in" > + " interrupt service routine")); > + sorry (msgid, isa); 1) aren't should be actually aren%'t (we should probably look through gcc.pot and patch all spots that have n't instead of n%'t in them and are in the gcc-internal-format) 2) I think it should be better to do: sorry (cfun->machine->func_type == TYPE_EXCEPTION ? G_("%s instructions aren%'t allowed in exception " "service routine") : G_("%s instructions aren%'t allowed in interrupt " "service routine")); That way, you don't introduce another -Wformat-security issue Ok for trunk with those changes. Jakub