Subject: Re: [PATCH 1/6] Add memory pool library

From: Andreas Ericsson <[email-masked]>
Date: Mon, 14 Jun 2010 16:44:15 +0200

On 06/14/2010 04:25 PM, Ramkumar Ramachandra wrote:
> Hi Jonathan,
> 
> Jonathan Nieder wrote:
>>   #ifdef __GNUC__
>>   #define MAYBE_UNUSED __attribute__((__unused__))
>>   #else
>>   #define MAYBE_UNUSED
>>   #endif
> 
> You'd suggested this earlier, but I was looking more for something
> that we could use to mark some specific functions as unused instead of
> marking everything as unused in the generation macro. Anyway, I have a
> patch ready, and svn-fe compiles fine with -Wall -Werror.
> 
>> Could that work here?
>>
>> The “unused” attribute was added in gcc 2.7.
> 
> Junio? Is this a good solution, or should we think of something else?
> What about other compilers?
> 

__attribute__((stuff)) is gcc-specific. It's usually macro'd away with
#ifndef __GNUC__
#define __attribute__(x)
#endif
which is why it requires double parantheses. gcc warns for but doesn't
fail on unknown attributes, so it should be safe to use this with
gcc older than 2.7 as well. Or you make it conditional to __GNUC__
being >= 2 and __GNUC_MINOR__ being >= 7.

-- 
Andreas Ericsson                   [email-masked]
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.