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