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

Re: [PATCH] Add the GIT_SENTINEL macro

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Jul 18, 2013, 21:06 UTC
Message-ID
<20130718210652.GX14690@google.com>
In-Reply-To
<51E849C4.7020305@ramsay1.demon.co.uk>
Ramsay Jones wrote:
> This was built on the next branch

All the uses of the sentinel attribute seem to come from eccb6149 (use "sentinel" function attribute for variadic lists, 2013-07-09), so this should be okay to go on top of the jk/gcc-function-attributes branch.

Show 12 quoted lines
> --- a/git-compat-util.h
> +++ b/git-compat-util.h
> @@ -303,6 +303,13 @@ extern char *gitbasename(char *);
>  #endif
>  #endif
>  
> +/* The sentinel attribute is valid from gcc version 4.0 */
> +#if defined(__GNUC__) && (__GNUC__ >= 4)
> +#define GIT_SENTINEL(n) __attribute__((sentinel(n)))
> +#else
> +#define GIT_SENTINEL(n)
> +#endif
I'd mildly prefer
	#if ...
	#define GIT_SENTINEL __attribute__((sentinel))
	#else
	...

(without the numeric parameter). I don't know any function in git (or any other project for that matter) that takes extra parameters after the NULL sentinel.

But I don't care much, so
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>

Thanks for a pleasant patch. Jonathan

Previous: Jeff KingNext: Junio C Hamano
Message 3 of 7 in “Add the GIT_SENTINEL macro”
  1. Add the GIT_SENTINEL macroRamsay Jones, Jul 18, 2013
  2. Jeff KingJul 18, 2013
  3. Jonathan NiederJul 18, 2013
  4. Junio C HamanoJul 19, 2013
  5. Jonathan NiederJul 19, 2013
  6. Junio C HamanoJul 19, 2013
  7. Ramsay JonesJul 20, 2013

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.