From patchwork Tue Jul 24 10:17:57 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Bosscher X-Patchwork-Id: 172817 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]) by ozlabs.org (Postfix) with SMTP id D70582C007A for ; Tue, 24 Jul 2012 20:18:37 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1343729918; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: MIME-Version:Received:In-Reply-To:References:From:Date: Message-ID:Subject:To:Cc:Content-Type:Mailing-List:Precedence: List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=jDuP/UcsCs0hegGX3hcovQ5uLlI=; b=Vluqar6VWWdjLK5 CfKpC2esIeod1lPy7nhbjbsRvY0SMkTubJX7EKEgS/oagF8yP32DQbXs4Lq2pRCl s2GhibsSVM8Aiik8R/UHXpl3b0VfXCtHa/TIKnfMCMfrQQ6kgju5Dn8009Fbcvm2 JDAmSKKRSYzakO2CMSdm8S3Y/zuQ= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:MIME-Version:Received:In-Reply-To:References:From:Date:Message-ID:Subject:To:Cc:Content-Type:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=Rbc8GkRYFxCz4PA9tp5RM03Hw1N9ADwY/A5BvA4uCV5QxrmkPOngyeyJHPQAV2 MU4jBHf+3eCTqo2c2dJIOObXhF/7R4YqcMj1jgqFwFKo6KrJyAkM0Whe4ZdHi7rG c7D65SXZAMnXABArjglgzSnon64vfEgyTTTso/dUBqeW4=; Received: (qmail 15533 invoked by alias); 24 Jul 2012 10:18:32 -0000 Received: (qmail 15525 invoked by uid 22791); 24 Jul 2012 10:18:31 -0000 X-SWARE-Spam-Status: No, hits=-5.0 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, KHOP_RCVD_TRUST, KHOP_THREADED, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-lpp01m010-f47.google.com (HELO mail-lpp01m010-f47.google.com) (209.85.215.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 24 Jul 2012 10:18:19 +0000 Received: by lags15 with SMTP id s15so884324lag.20 for ; Tue, 24 Jul 2012 03:18:17 -0700 (PDT) Received: by 10.152.106.233 with SMTP id gx9mr20848695lab.48.1343125097606; Tue, 24 Jul 2012 03:18:17 -0700 (PDT) MIME-Version: 1.0 Received: by 10.112.4.229 with HTTP; Tue, 24 Jul 2012 03:17:57 -0700 (PDT) In-Reply-To: References: From: Steven Bosscher Date: Tue, 24 Jul 2012 12:17:57 +0200 Message-ID: Subject: Re: [patch] Stop gengtype from emitting empty loops To: Laurynas Biveinis Cc: Richard Guenther , GCC Patches X-IsSubscribed: yes 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 On Tue, Jul 24, 2012 at 12:11 PM, Laurynas Biveinis wrote: >> I think it merely points to a bogus GTY annotation, not sure if we want to >> gobble this kind of gengtype hacks which only benefit -O0 ... >> >> The annotation is libcpp/include/line-map.h >> >> In the example above x1 (for token "+") is going to be the same >> as y1. x0 is the spelling location for the argument token "1", >> and x2 is the spelling location for the argument token "2". */ >> source_location * GTY((length ("2 * %h.n_tokens"))) macro_locations; > > This one indeed looks redundant, are there others? Yes: ../../trunk/gcc/../libcpp/include/line-map.h:168: option `length' may not be applied to arrays of scalar types ../../trunk/gcc/emit-rtl.c:5913: option `length' may not be applied to arrays of scalar types ../../trunk/gcc/java/jcf.h:85: option `length' may not be applied to arrays of scalar types ../../trunk/gcc/java/jcf.h:94: option `length' may not be applied to arrays of scalar types The emit-rtl.c one is for DEF_VEC_O(location_t); && ISDIGIT (opt->name[5]) > I am wondering if > there is something that would produce an empty loop for GC but not for > PCH or the other way around. You're the one who's supposed to understand all of this best ;-) Ciao! Steven Index: gengtype.c =================================================================== --- gengtype.c (revision 189778) +++ gengtype.c (working copy) @@ -1256,7 +1256,17 @@ adjust_field_type (type_p t, options_p opt) for (; opt; opt = opt->next) if (strcmp (opt->name, "length") == 0) - length_p = 1; + { + if (length_p) + error_at_line (&lexer_line, "duplicate `%s' option", opt->name); + if (t->u.p->kind == TYPE_SCALAR && ! t->u.p->u.scalar_is_char) + { + error_at_line (&lexer_line, + "option `%s' may not be applied to arrays of scalar types", + opt->name); + } + length_p = 1; + } else if ((strcmp (opt->name, "param_is") == 0 || (strncmp (opt->name, "param", 5) == 0