From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 81333 invoked by alias); 16 Jun 2015 21:23:41 -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 81323 invoked by uid 89); 16 Jun 2015 21:23:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 16 Jun 2015 21:23:39 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-01.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1Z4yKV-0005bW-AD from joseph_myers@mentor.com ; Tue, 16 Jun 2015 14:23:35 -0700 Received: from digraph.polyomino.org.uk (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.3.224.2; Tue, 16 Jun 2015 22:23:33 +0100 Received: from jsm28 (helo=localhost) by digraph.polyomino.org.uk with local-esmtp (Exim 4.82) (envelope-from ) id 1Z4yKS-0004dd-IW; Tue, 16 Jun 2015 21:23:32 +0000 Date: Tue, 16 Jun 2015 21:25:00 -0000 From: Joseph Myers To: Eric Botcazou CC: Subject: Re: [patch 2/6] scalar-storage-order merge: C front-end In-Reply-To: <2396877.AqT21tpnmO@polaris> Message-ID: References: <3247494.5bgQPARZRk@polaris> <2396877.AqT21tpnmO@polaris> User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" X-SW-Source: 2015-06/txt/msg01168.txt.bz2 On Tue, 16 Jun 2015, Eric Botcazou wrote: > +@item unused > +@cindex @code{unused} type attribute > +When attached to a type (including a @code{union} or a @code{struct}), > +this attribute means that variables of that type are meant to appear > +possibly unused. GCC does not produce a warning for any variables of > +that type, even if the variable appears to do nothing. This is often > +the case with lock or thread classes, which are usually defined and then > +not referenced, but contain constructors and destructors that have > +nontrivial bookkeeping functions. You appear to be duplicating the documentation of an unrelated attribute. What happens when typeof is applied to a field with reversed storage order? > + else if (TYPE_REVERSE_STORAGE_ORDER (t) > + && TREE_CODE (field) == FIELD_DECL > + && TREE_CODE (TREE_TYPE (field)) == ARRAY_TYPE) > + { > + tree ftype = TREE_TYPE (field); > + do > + ftype = TREE_TYPE (ftype); > + while (TREE_CODE (ftype) == ARRAY_TYPE); > + if (!RECORD_OR_UNION_TYPE_P (ftype)) > + { > + tree *ftypep = &TREE_TYPE (field); > + do { > + *ftypep = build_distinct_type_copy (*ftypep); > + TYPE_REVERSE_STORAGE_ORDER (*ftypep) = 1; > + ftypep = &TREE_TYPE (*ftypep); > + } while (TREE_CODE (*ftypep) == ARRAY_TYPE); I don't think this type construction is safe when the array type has qualified element type. The following invariant is meant to hold: for an array type whose element type (possibly after going down through several levels of array types) is qualified, the TYPE_MAIN_VARIANT is a corresponding array type whose element type is unqualified. So in that case you need to build two sequences of array types, not one: the main variants with unqualified element type, and the versions with qualified element type. See c_build_qualified_type. -- Joseph S. Myers joseph@codesourcery.com