Subject: Re: [PATCH] Add the GIT_SENTINEL macro

From: Jonathan Nieder <[email-masked]>
Date: Thu, 18 Jul 2013 14:06:52 -0700

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.

> --- 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 <[email-masked]>

Thanks for a pleasant patch.
Jonathan