mirror of
https://github.com/samba-team/samba.git
synced 2025-01-25 06:04:04 +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 used to be commit 8115e44d47bcd65edba08d10117180ae508cdbc1)
This commit is contained in:
parent
18797d8c70
commit
5e869b4eab
@ -129,7 +129,7 @@ AC_ARG_ENABLE(developer, [ --enable-developer Turn on developer warnings a
|
|||||||
debug=yes
|
debug=yes
|
||||||
CFLAGS="${CFLAGS} -g -Wall"
|
CFLAGS="${CFLAGS} -g -Wall"
|
||||||
developer=yes
|
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])
|
fi])
|
||||||
|
|
||||||
AC_ARG_ENABLE(krb5developer, [ --enable-krb5developer Turn on developer warnings and debugging, except -Wstrict-prototypes (default=no)],
|
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
|
debug=yes
|
||||||
CFLAGS="${CFLAGS} -g -Wall"
|
CFLAGS="${CFLAGS} -g -Wall"
|
||||||
developer=yes
|
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])
|
fi])
|
||||||
|
|
||||||
AC_ARG_ENABLE(gtkdeveloper, [ --enable-gtkdeveloper Turn on developer warnings and debugging, except -Wstrict-prototypes and -Wshadow (default=no)],
|
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
|
debug=yes
|
||||||
CFLAGS="${CFLAGS} -g -Wall"
|
CFLAGS="${CFLAGS} -g -Wall"
|
||||||
developer=yes
|
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])
|
fi])
|
||||||
|
|
||||||
experimental=no
|
experimental=no
|
||||||
|
@ -122,7 +122,7 @@ void *ldb_strdup(struct ldb_context *ldb, const char *str)
|
|||||||
/*
|
/*
|
||||||
a ldb wrapper for asprintf(), using ldb_malloc()
|
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;
|
int len, len2;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
@ -51,6 +51,8 @@ int ldb_set_debug(struct ldb_context *ldb,
|
|||||||
/*
|
/*
|
||||||
debug function for ldb_set_debug_stderr
|
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,
|
static void ldb_debug_stderr(void *context, enum ldb_debug_level level,
|
||||||
const char *fmt, va_list ap)
|
const char *fmt, va_list ap)
|
||||||
{
|
{
|
||||||
|
@ -640,6 +640,8 @@ struct ldif_write_file_state {
|
|||||||
FILE *f;
|
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, ...)
|
static int fprintf_file(void *private_data, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
struct ldif_write_file_state *state = private_data;
|
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
|
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)
|
static void talloc_set_name_v(void *ptr, const char *fmt, va_list ap)
|
||||||
{
|
{
|
||||||
struct talloc_chunk *tc = talloc_chunk_from_ptr(ptr);
|
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;
|
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;
|
int len;
|
||||||
char *ret;
|
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
|
* and return @p s, which may have moved. Good for gradually
|
||||||
* accumulating output into a string buffer.
|
* accumulating output into a string buffer.
|
||||||
**/
|
**/
|
||||||
|
|
||||||
char *talloc_vasprintf_append(char *s,
|
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;
|
int len, s_len;
|
||||||
va_list ap2;
|
va_list ap2;
|
||||||
|
@ -29,6 +29,8 @@
|
|||||||
Log tdb messages via DEBUG().
|
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, ...)
|
static void tdb_log(TDB_CONTEXT *tdb, int level, const char *format, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
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;
|
va_list ap;
|
||||||
char *s = NULL;
|
char *s = NULL;
|
||||||
@ -394,7 +394,7 @@ NTSTATUS ndr_pull_error(struct ndr_pull *ndr,
|
|||||||
/*
|
/*
|
||||||
return and possibly log an NDR error
|
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;
|
char *s=NULL;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
@ -38,6 +38,9 @@ struct nbench_private {
|
|||||||
/*
|
/*
|
||||||
log one request to the nbench log
|
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,
|
static void nbench_log(struct nbench_private *private,
|
||||||
const char *format, ...)
|
const char *format, ...)
|
||||||
{
|
{
|
||||||
|
@ -32,7 +32,7 @@ int gendb_search_v(struct ldb_context *ldb,
|
|||||||
struct ldb_message ***res,
|
struct ldb_message ***res,
|
||||||
const char * const *attrs,
|
const char * const *attrs,
|
||||||
const char *format,
|
const char *format,
|
||||||
va_list ap)
|
va_list ap) _PRINTF_ATTRIBUTE(6,0)
|
||||||
{
|
{
|
||||||
char *expr = NULL;
|
char *expr = NULL;
|
||||||
int count;
|
int count;
|
||||||
|
@ -30,7 +30,7 @@ struct samdb_context {
|
|||||||
/*
|
/*
|
||||||
this is used to catch debug messages from ldb
|
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;
|
char *s = NULL;
|
||||||
if (DEBUGLEVEL < 4 && level > LDB_DEBUG_WARNING) {
|
if (DEBUGLEVEL < 4 && level > LDB_DEBUG_WARNING) {
|
||||||
@ -128,7 +128,7 @@ const char *samdb_search_string_v(void *ctx,
|
|||||||
TALLOC_CTX *mem_ctx,
|
TALLOC_CTX *mem_ctx,
|
||||||
const char *basedn,
|
const char *basedn,
|
||||||
const char *attr_name,
|
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;
|
struct samdb_context *sam_ctx = ctx;
|
||||||
int count;
|
int count;
|
||||||
|
@ -30,7 +30,7 @@ struct spoolssdb_context {
|
|||||||
/*
|
/*
|
||||||
this is used to catch debug messages from ldb
|
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;
|
char *s = NULL;
|
||||||
if (DEBUGLEVEL < 4 && level > LDB_DEBUG_WARNING) {
|
if (DEBUGLEVEL < 4 && level > LDB_DEBUG_WARNING) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user