From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18861 invoked by alias); 10 Feb 2011 15:44:48 -0000 Received: (qmail 18533 invoked by uid 22791); 10 Feb 2011 15:44:47 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.44.51) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 10 Feb 2011 15:44:39 +0000 Received: from kpbe20.cbf.corp.google.com (kpbe20.cbf.corp.google.com [172.25.105.84]) by smtp-out.google.com with ESMTP id p1AFibWu014712 for ; Thu, 10 Feb 2011 07:44:37 -0800 Received: from pzk27 (pzk27.prod.google.com [10.243.19.155]) by kpbe20.cbf.corp.google.com with ESMTP id p1AFiZM4023432 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Thu, 10 Feb 2011 07:44:36 -0800 Received: by pzk27 with SMTP id 27so266868pzk.28 for ; Thu, 10 Feb 2011 07:44:35 -0800 (PST) Received: by 10.142.187.12 with SMTP id k12mr4192037wff.46.1297352675364; Thu, 10 Feb 2011 07:44:35 -0800 (PST) Received: from coign.google.com ([67.218.109.241]) by mx.google.com with ESMTPS id y42sm171916wfd.10.2011.02.10.07.44.33 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 10 Feb 2011 07:44:34 -0800 (PST) From: Ian Lance Taylor To: Uwe =?utf-8?Q?Kleine-K=C3=B6nig?= Cc: gcc-help@gcc.gnu.org Subject: Re: about function attributes for functions returning a pointer References: <20101004090407.GA11737@pengutronix.de> <20110210094740.GX27982@pengutronix.de> Date: Thu, 10 Feb 2011 18:45:00 -0000 In-Reply-To: <20110210094740.GX27982@pengutronix.de> ("Uwe =?utf-8?Q?Klein?= =?utf-8?Q?e-K=C3=B6nig=22's?= message of "Thu, 10 Feb 2011 10:47:40 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-System-Of-Record: true X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2011-02/txt/msg00177.txt.bz2 Uwe Kleine-K=C3=B6nig writes: >> I think the differences you are seeing are because some attributes can >> apply to types and some can only apply to declarations. Moving the >> location of the __attribute__ affects which type it applies to. In >> particular __attribute__ ((unused)) may be used with a type, but >> __attribute__ ((section (...))) may only be used with a declaration. > > As far as I got it both section() and unused are variable/function > attributes and not type attributes. So I think this explanation doesn't > match, does it? The unused attribute can be used on a type. typedef int I1 __attribute__ ((unused)); typedef int I2 __attribute__ ((section (".sec"))); foo.c:2: error: section attribute not allowed for =E2=80=98I2=E2=80=99 There is no error for I1. What the unused attribute means for a type I decline to speculate. But it is accepted where type attributes are accepted. Perhaps this is a bug. I'm really not sure. Ian