From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 90912 invoked by alias); 28 Apr 2017 16:37:00 -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 90817 invoked by uid 89); 28 Apr 2017 16:36:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,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, 28 Apr 2017 16:36:58 +0000 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BCC77C04BD51; Fri, 28 Apr 2017 16:36:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com BCC77C04BD51 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=law@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com BCC77C04BD51 Received: from localhost.localdomain (ovpn-117-12.phx2.redhat.com [10.3.117.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 69C409F379; Fri, 28 Apr 2017 16:36:59 +0000 (UTC) Subject: Re: [PATCH] have -Wformat-overflow handle -fexec-charset (PR 80503) To: Jakub Jelinek Cc: Martin Sebor , Joseph Myers , Gcc Patch List References: <055b63b9-2303-6031-021c-c216e94ed072@gmail.com> <20170426223418.GV1809@tucnak> <7b8f6999-942c-1540-c6e6-a6284d57baf5@gmail.com> <20170428162741.GJ1809@tucnak> From: Jeff Law Message-ID: <830706f9-bbb0-9497-86fb-a6a7d68cec40@redhat.com> Date: Fri, 28 Apr 2017 17:05:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.0 MIME-Version: 1.0 In-Reply-To: <20170428162741.GJ1809@tucnak> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2017-04/txt/msg01511.txt.bz2 On 04/28/2017 10:27 AM, Jakub Jelinek wrote: > On Fri, Apr 28, 2017 at 10:22:29AM -0600, Jeff Law wrote: >> So the initialization could be done once per translation unit rather than >> once per function -- assuming the target character set doesn't change within >> a translation unit. >> >> That seems like it ought to be easy. >> >> The table-lookup seems like a reasonable cost and I don't think we should >> litter the code with conditionals to conditionally lookup based on whether >> or not the charsets are the same. > > One option would be to have the cache array initialized say to 0 for > all chars except for % (which can be taken from target_percent or how is > that called), and then query (and cache) chars you need (you don't need > anything until % is seen, then obviously you need to translate chars > following that until end of the format string is recognized, then again > skip until next % etc. That seems like a significant over-complication for little real world benefit. Jeff