Re: [PATCH 1/6] Add memory pool library
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Jun 12, 2010, 06:42 UTC
- Message-ID
- <20100612064250.GB2549@burratino>
- In-Reply-To
- <1276175389-6185-2-git-send-email-artagnon@gmail.com>
Ramkumar Ramachandra wrote:
Show 10 quoted lines
> +#define obj_pool_gen(pre, obj_t, initial_capacity) \
> +static struct { \
> + uint32_t committed; \
> + uint32_t size; \
> + uint32_t capacity; \
> + obj_t *base; \
> + FILE *file; \
> +} pre##_pool = { 0, 0, 0, NULL, NULL}; \
> +static void pre##_init(void) \
> +{ \[...]
This defines a family of functions and not all pools use them all. One workaround is to annotate them, like this:
#ifdef __GNUC__ #define MAYBE_UNUSED __attribute__((__unused__)) #else #define MAYBE_UNUSED #endif
#define obj_pool_gen(pre, obj_t, initial_capacity) \
... \
static MAYBE_UNUSED void pre##_init(void) \
{ \
...Could that work here?
The “unused” attribute was added in gcc 2.7.
Jonathan