Ramkumar Ramachandra wrote:
+#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