mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
r2055: Add PRINTF_ATTRIBUTE to many more parts of the code, and a new
--enable-developer warning for when they are missing. Andrew Bartlett
This commit is contained in:
parent
2cbbf123d2
commit
8115e44d47
@ -129,7 +129,7 @@ AC_ARG_ENABLE(developer, [ --enable-developer Turn on developer warnings a
|
||||
debug=yes
|
||||
CFLAGS="${CFLAGS} -g -Wall"
|
||||
developer=yes
|
||||
DEVELOPER_CFLAGS="-Wshadow -Werror-implicit-function-declaration -Wstrict-prototypes -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wdeclaration-after-statement -DDEBUG_PASSWORD -DDEVELOPER"
|
||||
DEVELOPER_CFLAGS="-Wshadow -Werror-implicit-function-declaration -Wstrict-prototypes -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wdeclaration-after-statement -Wmissing-format-attribute -Wformat=2 -DDEBUG_PASSWORD -DDEVELOPER"
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(krb5developer, [ --enable-krb5developer Turn on developer warnings and debugging, except -Wstrict-prototypes (default=no)],
|
||||
@ -137,7 +137,7 @@ AC_ARG_ENABLE(krb5developer, [ --enable-krb5developer Turn on developer warnin
|
||||
debug=yes
|
||||
CFLAGS="${CFLAGS} -g -Wall"
|
||||
developer=yes
|
||||
DEVELOPER_CFLAGS="-Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wdeclaration-after-statement -DDEBUG_PASSWORD -DDEVELOPER"
|
||||
DEVELOPER_CFLAGS="-Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wdeclaration-after-statement -Wmissing-format-attribute -DDEBUG_PASSWORD -DDEVELOPER"
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(gtkdeveloper, [ --enable-gtkdeveloper Turn on developer warnings and debugging, except -Wstrict-prototypes and -Wshadow (default=no)],
|
||||
@ -145,7 +145,7 @@ AC_ARG_ENABLE(gtkdeveloper, [ --enable-gtkdeveloper Turn on developer warnings
|
||||
debug=yes
|
||||
CFLAGS="${CFLAGS} -g -Wall"
|
||||
developer=yes
|
||||
DEVELOPER_CFLAGS="-Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wdeclaration-after-statement -DDEBUG_PASSWORD -DDEVELOPER"
|
||||
DEVELOPER_CFLAGS="-Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wdeclaration-after-statement -Wmissing-format-attribute -DDEBUG_PASSWORD -DDEVELOPER"
|
||||
fi])
|
||||
|
||||
experimental=no
|
||||
|
@ -122,7 +122,7 @@ void *ldb_strdup(struct ldb_context *ldb, const char *str)
|
||||
/*
|
||||
a ldb wrapper for asprintf(), using ldb_malloc()
|
||||
*/
|
||||
int ldb_asprintf(struct ldb_context *ldb, char **strp, const char *fmt, ...)
|
||||
int ldb_asprintf(struct ldb_context *ldb, char **strp, const char *fmt, ...) _PRINTF_ATTRIBUTE(3, 4)
|
||||
{
|
||||
int len, len2;
|
||||
va_list ap;
|
||||
|
@ -51,6 +51,8 @@ int ldb_set_debug(struct ldb_context *ldb,
|
||||
/*
|
||||
debug function for ldb_set_debug_stderr
|
||||
*/
|
||||
static void ldb_debug_stderr(void *context, enum ldb_debug_level level,
|
||||
const char *fmt, va_list ap) PRINTF_ATTRIBUTE(3,0);
|
||||
static void ldb_debug_stderr(void *context, enum ldb_debug_level level,
|
||||
const char *fmt, va_list ap)
|
||||
{
|
||||
|
@ -640,6 +640,8 @@ struct ldif_write_file_state {
|
||||
FILE *f;
|
||||
};
|
||||
|
||||
static int fprintf_file(void *private_data, const char *fmt, ...) PRINTF_ATTRIBUTE(2, 3);
|
||||
|
||||
static int fprintf_file(void *private_data, const char *fmt, ...)
|
||||
{
|
||||
struct ldif_write_file_state *state = private_data;
|
||||
|
@ -122,6 +122,8 @@ void talloc_increase_ref_count(void *ptr)
|
||||
/*
|
||||
add a name to an existing pointer - va_list version
|
||||
*/
|
||||
static void talloc_set_name_v(void *ptr, const char *fmt, va_list ap) PRINTF_ATTRIBUTE(2,0);
|
||||
|
||||
static void talloc_set_name_v(void *ptr, const char *fmt, va_list ap)
|
||||
{
|
||||
struct talloc_chunk *tc = talloc_chunk_from_ptr(ptr);
|
||||
@ -393,7 +395,8 @@ char *talloc_strndup(void *t, const char *p, size_t n)
|
||||
return ret;
|
||||
}
|
||||
|
||||
char *talloc_vasprintf(void *t, const char *fmt, va_list ap)
|
||||
static char *talloc_vasprintf(void *t, const char *fmt, va_list ap) PRINTF_ATTRIBUTE(2,0);
|
||||
static char *talloc_vasprintf(void *t, const char *fmt, va_list ap)
|
||||
{
|
||||
int len;
|
||||
char *ret;
|
||||
@ -434,8 +437,10 @@ char *talloc_asprintf(void *t, const char *fmt, ...) _PRINTF_ATTRIBUTE(2,3)
|
||||
* and return @p s, which may have moved. Good for gradually
|
||||
* accumulating output into a string buffer.
|
||||
**/
|
||||
|
||||
char *talloc_vasprintf_append(char *s,
|
||||
const char *fmt, va_list ap)
|
||||
const char *fmt, va_list ap) _PRINTF_ATTRIBUTE(2,0)
|
||||
|
||||
{
|
||||
int len, s_len;
|
||||
va_list ap2;
|
||||
|
@ -29,6 +29,8 @@
|
||||
Log tdb messages via DEBUG().
|
||||
****************************************************************************/
|
||||
|
||||
static void tdb_log(TDB_CONTEXT *tdb, int level, const char *format, ...) PRINTF_ATTRIBUTE(3,4);
|
||||
|
||||
static void tdb_log(TDB_CONTEXT *tdb, int level, const char *format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
@ -282,7 +282,7 @@ void ndr_print_array(struct ndr_print *ndr, const char *name, void *base,
|
||||
|
||||
|
||||
|
||||
void ndr_print_debug_helper(struct ndr_print *ndr, const char *format, ...)
|
||||
void ndr_print_debug_helper(struct ndr_print *ndr, const char *format, ...) _PRINTF_ATTRIBUTE(2,3)
|
||||
{
|
||||
va_list ap;
|
||||
char *s = NULL;
|
||||
@ -394,7 +394,7 @@ NTSTATUS ndr_pull_error(struct ndr_pull *ndr,
|
||||
/*
|
||||
return and possibly log an NDR error
|
||||
*/
|
||||
NTSTATUS ndr_push_error(struct ndr_push *ndr, enum ndr_err_code err, const char *format, ...)
|
||||
NTSTATUS ndr_push_error(struct ndr_push *ndr, enum ndr_err_code err, const char *format, ...) _PRINTF_ATTRIBUTE(3,4)
|
||||
{
|
||||
char *s=NULL;
|
||||
va_list ap;
|
||||
|
@ -38,6 +38,9 @@ struct nbench_private {
|
||||
/*
|
||||
log one request to the nbench log
|
||||
*/
|
||||
static void nbench_log(struct nbench_private *private,
|
||||
const char *format, ...) PRINTF_ATTRIBUTE(2, 3);
|
||||
|
||||
static void nbench_log(struct nbench_private *private,
|
||||
const char *format, ...)
|
||||
{
|
||||
|
@ -32,7 +32,7 @@ int gendb_search_v(struct ldb_context *ldb,
|
||||
struct ldb_message ***res,
|
||||
const char * const *attrs,
|
||||
const char *format,
|
||||
va_list ap)
|
||||
va_list ap) _PRINTF_ATTRIBUTE(6,0)
|
||||
{
|
||||
char *expr = NULL;
|
||||
int count;
|
||||
|
@ -30,7 +30,7 @@ struct samdb_context {
|
||||
/*
|
||||
this is used to catch debug messages from ldb
|
||||
*/
|
||||
void samdb_debug(void *context, enum ldb_debug_level level, const char *fmt, va_list ap)
|
||||
void samdb_debug(void *context, enum ldb_debug_level level, const char *fmt, va_list ap) _PRINTF_ATTRIBUTE(3,0)
|
||||
{
|
||||
char *s = NULL;
|
||||
if (DEBUGLEVEL < 4 && level > LDB_DEBUG_WARNING) {
|
||||
@ -128,7 +128,7 @@ const char *samdb_search_string_v(void *ctx,
|
||||
TALLOC_CTX *mem_ctx,
|
||||
const char *basedn,
|
||||
const char *attr_name,
|
||||
const char *format, va_list ap)
|
||||
const char *format, va_list ap) _PRINTF_ATTRIBUTE(5,0)
|
||||
{
|
||||
struct samdb_context *sam_ctx = ctx;
|
||||
int count;
|
||||
|
@ -30,7 +30,7 @@ struct spoolssdb_context {
|
||||
/*
|
||||
this is used to catch debug messages from ldb
|
||||
*/
|
||||
void spoolssdb_debug(void *context, enum ldb_debug_level level, const char *fmt, va_list ap)
|
||||
void spoolssdb_debug(void *context, enum ldb_debug_level level, const char *fmt, va_list ap) _PRINTF_ATTRIBUTE(3, 0)
|
||||
{
|
||||
char *s = NULL;
|
||||
if (DEBUGLEVEL < 4 && level > LDB_DEBUG_WARNING) {
|
||||
|
Loading…
Reference in New Issue
Block a user