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
This commit is contained in:
Junio C Hamano
2013-07-22 11:23:59 -07:00
10 changed files with 21 additions and 5 deletions

View File

@ -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