summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2004-08-25 07:15:21 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:58:21 -0500
commit5e869b4eabaf428b36b5bc158ab4047d25e3eb5b (patch)
tree927baab313e642e2f2800e0d1439e7be7f3673b0 /source4
parent18797d8c70afc383aa7c67003646efb8ecfd7e4f (diff)
downloadsamba-5e869b4eabaf428b36b5bc158ab4047d25e3eb5b.tar.gz
samba-5e869b4eabaf428b36b5bc158ab4047d25e3eb5b.tar.bz2
samba-5e869b4eabaf428b36b5bc158ab4047d25e3eb5b.zip
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)
Diffstat (limited to 'source4')
-rw-r--r--source4/build/smb_build/check_path.m46
-rw-r--r--source4/lib/ldb/common/ldb_alloc.c2
-rw-r--r--source4/lib/ldb/common/ldb_debug.c2
-rw-r--r--source4/lib/ldb/common/ldb_ldif.c2
-rw-r--r--source4/lib/talloc.c9
-rw-r--r--source4/lib/tdb_helper.c2
-rw-r--r--source4/librpc/ndr/ndr.c4
-rw-r--r--source4/ntvfs/nbench/vfs_nbench.c3
-rw-r--r--source4/rpc_server/common/gendb.c2
-rw-r--r--source4/rpc_server/samr/samdb.c4
-rw-r--r--source4/rpc_server/spoolss/spoolssdb.c2
11 files changed, 26 insertions, 12 deletions
diff --git a/source4/build/smb_build/check_path.m4 b/source4/build/smb_build/check_path.m4
index 7a7ae12d41..37c30f6f32 100644
--- a/source4/build/smb_build/check_path.m4
+++ b/source4/build/smb_build/check_path.m4
@@ -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
diff --git a/source4/lib/ldb/common/ldb_alloc.c b/source4/lib/ldb/common/ldb_alloc.c
index 667759e832..6abd6fa8c3 100644
--- a/source4/lib/ldb/common/ldb_alloc.c
+++ b/source4/lib/ldb/common/ldb_alloc.c
@@ -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;
diff --git a/source4/lib/ldb/common/ldb_debug.c b/source4/lib/ldb/common/ldb_debug.c
index d59f9284b0..0a187cd62d 100644
--- a/source4/lib/ldb/common/ldb_debug.c
+++ b/source4/lib/ldb/common/ldb_debug.c
@@ -52,6 +52,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)
{
if (level <= LDB_DEBUG_WARNING) {
diff --git a/source4/lib/ldb/common/ldb_ldif.c b/source4/lib/ldb/common/ldb_ldif.c
index 8c912f76d4..c693d211a9 100644
--- a/source4/lib/ldb/common/ldb_ldif.c
+++ b/source4/lib/ldb/common/ldb_ldif.c
@@ -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;
diff --git a/source4/lib/talloc.c b/source4/lib/talloc.c
index 31b6584845..036d06a2c2 100644
--- a/source4/lib/talloc.c
+++ b/source4/lib/talloc.c
@@ -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;
diff --git a/source4/lib/tdb_helper.c b/source4/lib/tdb_helper.c
index 22c4d1bb45..2698e3cc71 100644
--- a/source4/lib/tdb_helper.c
+++ b/source4/lib/tdb_helper.c
@@ -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;
diff --git a/source4/librpc/ndr/ndr.c b/source4/librpc/ndr/ndr.c
index 32836c9411..13daac78c2 100644
--- a/source4/librpc/ndr/ndr.c
+++ b/source4/librpc/ndr/ndr.c
@@ -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;
diff --git a/source4/ntvfs/nbench/vfs_nbench.c b/source4/ntvfs/nbench/vfs_nbench.c
index dceaa9f45b..e4e5af4171 100644
--- a/source4/ntvfs/nbench/vfs_nbench.c
+++ b/source4/ntvfs/nbench/vfs_nbench.c
@@ -39,6 +39,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, ...)
{
va_list ap;
diff --git a/source4/rpc_server/common/gendb.c b/source4/rpc_server/common/gendb.c
index 76e9f72bb1..d20aef5ff8 100644
--- a/source4/rpc_server/common/gendb.c
+++ b/source4/rpc_server/common/gendb.c
@@ -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;
diff --git a/source4/rpc_server/samr/samdb.c b/source4/rpc_server/samr/samdb.c
index 7be75258af..d23118f1f0 100644
--- a/source4/rpc_server/samr/samdb.c
+++ b/source4/rpc_server/samr/samdb.c
@@ -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;
diff --git a/source4/rpc_server/spoolss/spoolssdb.c b/source4/rpc_server/spoolss/spoolssdb.c
index 94f91b4f16..a19ad14981 100644
--- a/source4/rpc_server/spoolss/spoolssdb.c
+++ b/source4/rpc_server/spoolss/spoolssdb.c
@@ -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) {