Re: [patch 01/10] compiler: define __attribute_unused__

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2007-05-01 at 23:06 -0700, David Rientjes wrote:
> On Wed, 2 May 2007, Rusty Russell wrote:
> 
> > Adding this macro doesn't give us anything that simply saying
> > "__attribute__((unused))" doesn't give.  But it does add a layer of
> > kernel-specific indirection.
> > 
> 
> That's obviously true since we're defining __attribute_unused__ to be 
> __attribute__((unused)).

Hi David,

	I'm horribly familiar with this issue, BTW, so we don't need so many
words 8)

> The patched version makes this:
> 
> 	int type __attribute_unused__ = 0;
>
> which definitely tells you that you're using a compiler attribute that 
> will be attached to that automatic.  In your case:
> 
> 	int type __unneeded = 0;
> 
> doesn't say anything in this case.  It doesn't resemble any attribute that 
> a programmer might be familiar with and begs the question of why we've 
> declared it if it's truly "unneeded"?

Your version makes one wonder why they didn't use
"__attribute__((unused))".  Obviously the __attribute_unused__ macro
exists for a reason, so they wonder what's the difference between that
and the attribute?  The answer: nothing.

OTOH, your point about "__unneeded" is well taken.  "__needed" and
"__optional" perhaps?  But their feature is *exactly* that the don't
look like the gcc attributes, hence avoid their semantic screwage.

> By the way, there are tons of these instances where __attribute__((used)) 
> needs to be added in driver code to suppress unreferenced warnings.

Sure; historically we refactor around it.  But warnings are now so
commonplace few people care 8(

Cheers,
Rusty.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux