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

Re: [PATCH 2/2] commit-slab.h: avoid duplicated global static variables

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 9, 2016, 17:17 UTC
Message-ID
<xmqqpophc15o.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<57A9E614.6050601@kdbg.org>
Johannes Sixt <j6t@kdbg.org> writes:
Show 9 quoted lines
>   * like function declarations.  I.e., the expansion of
>   *
>   *    define_commit_slab(indegree, int);
>   *
> - * ends in 'static int stat_indegreerealloc;'.  This would otherwise
> + * ends in 'struct indegree;'.  This would otherwise
>   * be a syntax error according (at least) to ISO C.  It's hard to
>   * catch because GCC silently parses it by default.
>   */

I briefly wondered what "otherwise" and "it" in "silently parses it" refer to; it is having a hanging semicolon after the definition of the *_peek() function, i.e.

	...
        static int *indegree_peek(...)
        {
		return indegree_at_peek(s, c, 0);
	}
	;
so all is fine.

Needless to say, using "struct slabname;" is indeed a much nicer solution you found to the original issue. Thanks.

Previous: Johannes Sixt
Message 4 of 4 in “config.c: avoid duplicated global static variables”
  1. 1/2 config.c: avoid duplicated global static variablesJohannes Sixt, Aug 9, 2016
  2. 2/2 commit-slab.h: avoid duplicated global static variablesJohannes Sixt, Aug 9, 2016
  3. Johannes SixtAug 9, 2016
  4. Junio C HamanoAug 9, 2016

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.