diff options
author | Junio C Hamano <gitster@pobox.com> | 2013-07-22 11:23:59 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-07-22 11:23:59 -0700 |
commit | e9f1a6c189c34a7ea98cbdb92acc677a72a5b4ea (patch) | |
tree | 54a4008e527cd1094e14cc9914c0cc55ac46a0a6 /git-compat-util.h | |
parent | d0b3fa8fd9faf5d18d54e2beb04741fff88af358 (diff) | |
parent | 9fe3edc47f1f17a53272671c572c90ba71eb4f74 (diff) | |
download | git-e9f1a6c189c34a7ea98cbdb92acc677a72a5b4ea.tar.gz |
Merge branch 'jk/gcc-function-attributes'
Use the function attributes extension to catch mistakes in use of
our own variadic functions that use NULL sentinel at the end
(i.e. like execl(3)) and format strings (i.e. like printf(3)).
* jk/gcc-function-attributes:
Add the LAST_ARG_MUST_BE_NULL macro
wt-status: use "format" function attribute for status_printf
use "sentinel" function attribute for variadic lists
add missing "format" function attributes
Diffstat (limited to 'git-compat-util.h')
-rw-r--r-- | git-compat-util.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/git-compat-util.h b/git-compat-util.h index ff193f4aa2..cc4ba4d18f 100644 --- 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 LAST_ARG_MUST_BE_NULL __attribute__((sentinel)) +#else +#define LAST_ARG_MUST_BE_NULL +#endif + #include "compat/bswap.h" #ifdef USE_WILDMATCH |