Thread (15 messages) flat view 15 messages, 4 authors, 2016-06-15

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

From: Jonathan Nieder <hidden>
Date: 2016-06-15 22:48:57

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help