git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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
Previous: Ramkumar RamachandraNext: Ramkumar Ramachandra
Message 3 of 19 in “Another attempt to get the SVN exporter merged”
  1. 0/6 Another attempt to get the SVN exporter mergedRamkumar Ramachandra, Jun 10, 2010
  2. 1/6 Add memory pool libraryRamkumar Ramachandra, Jun 10, 2010
  3. Jonathan NiederJun 12, 2010
  4. Ramkumar RamachandraJun 14, 2010
  5. Andreas EricssonJun 14, 2010
  6. 2/6 Add cpp macro implementation of treapsRamkumar Ramachandra, Jun 10, 2010
  7. 3/6 Add library for string-specific memory poolRamkumar Ramachandra, Jun 10, 2010
  8. Junio C HamanoJun 11, 2010
  9. Ramkumar RamachandraJun 14, 2010
  10. Junio C HamanoJun 14, 2010
  11. Ramkumar RamachandraJun 14, 2010
  12. David Michael BarrJun 14, 2010
  13. 4/6 Add stream helper libraryRamkumar Ramachandra, Jun 10, 2010
  14. 5/6 Add infrastructure to write revisions in fast-export formatRamkumar Ramachandra, Jun 10, 2010
  15. 6/6 Add SVN dump parserRamkumar Ramachandra, Jun 10, 2010
  16. Ramkumar RamachandraJun 10, 2010
  17. Jonathan NiederJun 12, 2010
  18. Ramkumar RamachandraJun 14, 2010
  19. Ramkumar RamachandraJun 10, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.