This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][ARM] Add support for "noinit" attribute
- From: Segher Boessenkool <segher at kernel dot crashing dot org>
- To: Christophe Lyon <christophe dot lyon at linaro dot org>
- Cc: Kyrill Tkachov <kyrylo dot tkachov at foss dot arm dot com>, gcc Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 2 Jul 2019 12:12:10 -0500
- Subject: Re: [PATCH][ARM] Add support for "noinit" attribute
- References: <CAKdteOZOBwhFSgbt2N6Ft8JNwuGSYToNUc2moii65CG+weGtOA@mail.gmail.com> <b44490f1-0c1b-94eb-9e54-0edb4de72bc3@foss.arm.com> <CAKdteOZSZDeCgMDFj5rj=1aGx6topGaW7NKyC6=aC8HqBfQr4w@mail.gmail.com>
On Tue, Jul 02, 2019 at 05:01:33PM +0200, Christophe Lyon wrote:
> On Mon, 1 Jul 2019 at 17:58, Kyrill Tkachov <kyrylo.tkachov@foss.arm.com> wrote:
> > +static tree
> > +arm_data_attr (tree * node,
> > + tree name,
> > + tree args ATTRIBUTE_UNUSED,
> > + int flags ATTRIBUTE_UNUSED,
> > + bool * no_add_attrs ATTRIBUTE_UNUSED)
> > +{
> >
> > no_add_attrs is set in this function, so should not be ATTRIBUTE_UNUSED?
> Right! Guess what? There's the same mistake in msp430.c :-)
This attribute means that parameter is *possibly* unused. It doesn't have
to be.
Now that we have C++ you could write this as
static tree
arm_data_attr (tree *node, tree name, tree /*args*/, int /*flags*/,
bool */*no_add_attrs*/)
{
(or leave the names completely away where that makes sense), and then
the parameter *has* to be unused (you *cannot* refer to it ;-) )
Segher