From patchwork Wed May 27 13:56:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Martin_Li=C5=A1ka?= X-Patchwork-Id: 477129 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id AE6031402B2 for ; Thu, 28 May 2015 00:01:22 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=k2GAnVwr; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :resent-from:resent-to:resent-date:resent-message-id:message-id :in-reply-to:references:from:date:subject:to; q=dns; s=default; b= OR3Tppu8W80BKdjdn2hwYcHn77JPVzdcbHdgRtylFVCItd+syEbKtrv38Bmn5IoQ k+nJaV2PcrdWBgPWO8EWyyfbOKrlIR0ooSPYL4qjuBCJezsTjULlwQfFirAqZlnS RoMkrLtAigM+O45d6DI/U+E/qK1hrYMwxZx9Vkqsdeg= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :resent-from:resent-to:resent-date:resent-message-id:message-id :in-reply-to:references:from:date:subject:to; s=default; bh=zg03 icChVaRvVHRq9k66YQN9S5c=; b=k2GAnVwrwfuuVuhak/JMynlbgxXbeHYZXXRr 7XkzQDXuU19niAYqRG8abnhA03o0jdoT8eOgaAt4OfPSHLIQAJQTQRE+v/CWryf6 Ktzn+wV1t6Lf8jkWUMJvZgQClfy6lOz2gWea/fS3fqh16/7VOghXeMDq5+fPh1qV h9FGrhA= Received: (qmail 70239 invoked by alias); 27 May 2015 14:00:14 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 69835 invoked by uid 89); 27 May 2015 14:00:10 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.6 required=5.0 tests=AWL, BAYES_50, KAM_LAZY_DOMAIN_SECURITY autolearn=no version=3.3.2 X-HELO: mx2.suse.de Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Wed, 27 May 2015 14:00:06 +0000 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id DD1C3ADF3 for ; Wed, 27 May 2015 13:59:56 +0000 (UTC) Resent-From: =?UTF-8?B?TWFydGluIExpxaFrYQ==?= Resent-To: GCC Patches Resent-Date: Wed, 27 May 2015 15:59:56 +0200 Resent-Message-ID: <5565CDDC.5080407@suse.cz> Resent-User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 Message-Id: <4f9636543b3d7ea8537fb01a8c33df7703ec171a.1432735040.git.mliska@suse.cz> In-Reply-To: <83d59ba92a3c4b3ba831ebc2fce325f0416848d0.1432735040.git.mliska@suse.cz> References: <83d59ba92a3c4b3ba831ebc2fce325f0416848d0.1432735040.git.mliska@suse.cz> From: mliska Date: Wed, 27 May 2015 15:56:47 +0200 Subject: [PATCH 09/35] Change use to type-based pool allocator in c-format.c. To: gcc-patches@gcc.gnu.org X-IsSubscribed: yes gcc/c-family/ChangeLog: 2015-04-30 Martin Liska * c-format.c (check_format_arg):Use new type-based pool allocator. (check_format_info_main) Likewise. --- gcc/c-family/c-format.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/gcc/c-family/c-format.c b/gcc/c-family/c-format.c index 145bbfd..7b9bf38 100644 --- a/gcc/c-family/c-format.c +++ b/gcc/c-family/c-format.c @@ -1031,7 +1031,8 @@ static void check_format_arg (void *, tree, unsigned HOST_WIDE_INT); static void check_format_info_main (format_check_results *, function_format_info *, const char *, int, tree, - unsigned HOST_WIDE_INT, alloc_pool); + unsigned HOST_WIDE_INT, + pool_allocator &); static void init_dollar_format_checking (int, tree); static int maybe_read_dollar_number (const char **, int, @@ -1518,7 +1519,6 @@ check_format_arg (void *ctx, tree format_tree, const char *format_chars; tree array_size = 0; tree array_init; - alloc_pool fwt_pool; if (TREE_CODE (format_tree) == VAR_DECL) { @@ -1694,11 +1694,9 @@ check_format_arg (void *ctx, tree format_tree, will decrement it if it finds there are extra arguments, but this way need not adjust it for every return. */ res->number_other++; - fwt_pool = create_alloc_pool ("format_wanted_type pool", - sizeof (format_wanted_type), 10); + pool_allocator fwt_pool ("format_wanted_type pool", 10); check_format_info_main (res, info, format_chars, format_length, params, arg_num, fwt_pool); - free_alloc_pool (fwt_pool); } @@ -1713,7 +1711,8 @@ static void check_format_info_main (format_check_results *res, function_format_info *info, const char *format_chars, int format_length, tree params, - unsigned HOST_WIDE_INT arg_num, alloc_pool fwt_pool) + unsigned HOST_WIDE_INT arg_num, + pool_allocator &fwt_pool) { const char *orig_format_chars = format_chars; tree first_fillin_param = params; @@ -2424,8 +2423,7 @@ check_format_info_main (format_check_results *res, fci = fci->chain; if (fci) { - wanted_type_ptr = (format_wanted_type *) - pool_alloc (fwt_pool); + wanted_type_ptr = fwt_pool.allocate (); arg_num++; wanted_type = *fci->types[length_chars_val].type; wanted_type_name = fci->types[length_chars_val].name;