This is the mail archive of the
mailing list for the GCC project.
Re: nonnull attribute (was: Re: Couldn't `function(arg[static 3])` imply nonnull and array size in C?)
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Martin Uecker <uecker at eecs dot berkeley dot edu>
- Cc: Manuel López-Ibáñez <lopezibanez at gmail dot com>, GCC Development <gcc at gcc dot gnu dot org>, Jason Merrill <jason at redhat dot com>
- Date: Fri, 8 May 2015 20:15:18 +0000
- Subject: Re: nonnull attribute (was: Re: Couldn't `function(arg[static 3])` imply nonnull and array size in C?)
- Authentication-results: sourceware.org; auth=none
- References: <CAEcf3Nzxt=uATHYdYu+aLBoKaB8Wyy=AztF=ZXn-atKpKhVU3Q at mail dot gmail dot com> <20150503224039 dot 28ab0404 at lemur> <55479E41 dot 2070108 at gmail dot com> <20150507105144 dot 277cc59b at lemur> <CAESRpQDGdrshKp21GrZEJsOTST5C530=j=VR=116NVEyvj-ieA at mail dot gmail dot com> <alpine dot DEB dot 2 dot 10 dot 1505081056080 dot 20373 at digraph dot polyomino dot org dot uk> <20150508115945 dot 377f1b5b at lemur>
On Fri, 8 May 2015, Martin Uecker wrote:
> From reading the documentation, it seems that attributes originally
> were supposed to only go with declarations and were not meant to be a
> general extension to the type system. But then there is the example:
> char *__attribute__((aligned(8))) *f;
> which implies that now (some) attributes could work similar to type
> qualifiers. Is this the idea?
Yes (keeping in mind that many type attributes can only apply to a limited
subset of types - if the attribute is only meaningful for structures or
unions, for example, the syntactic binding inside nested declarators is
fairly irrelevant to it). Make sure to distinguish the binding of GNU
attributes (as defined in the manual) and the binding of C++11 attributes
(as defined in C++11).
Joseph S. Myers