From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29138 invoked by alias); 3 May 2011 18:35:36 -0000 Received: (qmail 29053 invoked by uid 22791); 3 May 2011 18:35:35 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from mel.act-europe.fr (HELO mel.act-europe.fr) (194.98.77.210) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 03 May 2011 18:35:19 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 6E077CB02D0; Tue, 3 May 2011 20:35:18 +0200 (CEST) Received: from mel.act-europe.fr ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id TMQphPlrFa4H; Tue, 3 May 2011 20:35:15 +0200 (CEST) Received: from new-host.home (ADijon-552-1-112-155.w90-33.abo.wanadoo.fr [90.33.191.155]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mel.act-europe.fr (Postfix) with ESMTP id 50C73CB0222; Tue, 3 May 2011 20:35:15 +0200 (CEST) From: Eric Botcazou To: Jan Hubicka Subject: Re: [google]: initialize language field for clone function struct Date: Tue, 03 May 2011 18:55:00 -0000 User-Agent: KMail/1.9.9 Cc: gcc-patches@gcc.gnu.org, Xinliang David Li References: <20110503164614.GB18705@kam.mff.cuni.cz> In-Reply-To: <20110503164614.GB18705@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Disposition: inline Message-Id: <201105032034.51751.ebotcazou@adacore.com> Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit 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 X-SW-Source: 2011-05/txt/msg00209.txt.bz2 > I am however completely missing the point of this langhook and doc is not > exactly informative either: > > /* Returns nonzero if we are in the global binding level. Ada > returns -1 for an undocumented reason used in stor-layout.c. */ > > What is the purpose of this hook? I've seen things far more undocumented in GCC than this one ;-) tree variable_size (tree size) { [...] /* If the language-processor is to take responsibility for variable-sized items (e.g., languages which have elaboration procedures like Ada), just return SIZE unchanged. */ if (lang_hooks.decls.global_bindings_p () < 0) return size; [...] if (lang_hooks.decls.global_bindings_p ()) { if (TREE_CONSTANT (size)) error ("type size can%'t be explicitly evaluated"); else error ("variable-size type declared outside of any function"); return size_one_node; } [...] } In Ada there are variable-sized types at global level so it isn't an error to call variable_size when lang_hooks.decls.global_bindings_p returns non-zero. -- Eric Botcazou