commit 4f9472ac96e158b303eace60d30d7111f522f5f5
Author: Oswald Buddenhagen <[email protected]>
Date: Sun Jul 28 19:52:41 2019 +0200
add some ATTR_* (mostly)
mostly ATTR_PRINTFLIKE(*, 0) for functions with a va_list argument.
the one for maildir_again() doesn't actually work, probably because the
function doesn't take va_list. both gcc and clang behave like that, but
i'd still say that this is a bug.
also, explicit suppressions for format strings stored in variables.
also, one ATTR_NORETURN.
src/common.h | 8 ++++----
src/drv_imap.c | 3 +++
src/drv_maildir.c | 5 ++++-
src/main.c | 2 +-
src/sync.c | 6 +++---
src/util.c | 2 +-
6 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/src/common.h b/src/common.h
index a04e9f9..d1ade52 100644
--- a/src/common.h
+++ b/src/common.h
@@ -122,8 +122,8 @@ void stats( void );
/* util.c */
-void vdebug( int, const char *, va_list va );
-void vdebugn( int, const char *, va_list va );
+void ATTR_PRINTFLIKE(2, 0) vdebug( int, const char *, va_list va );
+void ATTR_PRINTFLIKE(2, 0) vdebugn( int, const char *, va_list va );
void ATTR_PRINTFLIKE(1, 2) info( const char *, ... );
void ATTR_PRINTFLIKE(1, 2) infon( const char *, ... );
void ATTR_PRINTFLIKE(1, 2) progress( const char *, ... );
@@ -162,7 +162,7 @@ void *nfcalloc( size_t sz );
void *nfrealloc( void *mem, size_t sz );
char *nfstrndup( const char *str, size_t nchars );
char *nfstrdup( const char *str );
-int nfvasprintf( char **str, const char *fmt, va_list va );
+int ATTR_PRINTFLIKE(2, 0) nfvasprintf( char **str, const char *fmt, va_list va
);
int ATTR_PRINTFLIKE(2, 3) nfasprintf( char **str, const char *fmt, ... );
int ATTR_PRINTFLIKE(3, 4) nfsnprintf( char *buf, int blen, const char *fmt,
... );
void ATTR_NORETURN oob( void );
@@ -243,7 +243,7 @@ typedef struct {
void init_wakeup( wakeup_t *tmr, void (*cb)( void * ), void *aux );
void conf_wakeup( wakeup_t *tmr, int timeout );
void wipe_wakeup( wakeup_t *tmr );
-static INLINE int pending_wakeup( wakeup_t *tmr ) { return tmr->links.next !=
0; }
+static INLINE int ATTR_UNUSED pending_wakeup( wakeup_t *tmr ) { return
tmr->links.next != 0; }
void main_loop( void );
diff --git a/src/drv_imap.c b/src/drv_imap.c
index 07ffbea..d5214c4 100644
--- a/src/drv_imap.c
+++ b/src/drv_imap.c
@@ -300,8 +300,11 @@ send_imap_cmd( imap_store_t *ctx, imap_cmd_t *cmd )
buffmt = "%d %s{%d+}\r\n";
litplus = 1;
}
+DIAG_PUSH
+DIAG_DISABLE("-Wformat-nonliteral")
bufl = nfsnprintf( buf, sizeof(buf), buffmt,
cmd->tag, cmd->cmd, cmd->param.data_len );
+DIAG_POP
if (DFlags & DEBUG_NET) {
if (ctx->num_in_progress)
printf( "(%d in progress) ", ctx->num_in_progress );
diff --git a/src/drv_maildir.c b/src/drv_maildir.c
index c9b3c42..b39f314 100644
--- a/src/drv_maildir.c
+++ b/src/drv_maildir.c
@@ -1499,14 +1499,17 @@ maildir_rescan( maildir_store_t *ctx )
return DRV_OK;
}
-static int
+static int ATTR_PRINTFLIKE(3, 0)
maildir_again( maildir_store_t *ctx, maildir_message_t *msg,
const char *err, const char *fn, const char *fn2 )
{
int ret;
if (errno != ENOENT) {
+DIAG_PUSH
+DIAG_DISABLE("-Wformat-nonliteral")
sys_error( err, fn, fn2 );
+DIAG_POP
return DRV_BOX_BAD;
}
if ((ret = maildir_rescan( ctx )) != DRV_OK)
diff --git a/src/main.c b/src/main.c
index eadd81f..548fc60 100644
--- a/src/main.c
+++ b/src/main.c
@@ -131,7 +131,7 @@ debug( const char *msg, ... )
}
#ifdef __linux__
-static void
+static void ATTR_NORETURN
crashHandler( int n )
{
int dpid;
diff --git a/src/sync.c b/src/sync.c
index 40512f2..de4e1e2 100644
--- a/src/sync.c
+++ b/src/sync.c
@@ -74,7 +74,7 @@ Fclose( FILE *f, int safe )
}
}
-void
+void ATTR_PRINTFLIKE(2, 0)
vFprintf( FILE *f, const char *msg, va_list va )
{
int r;
@@ -86,7 +86,7 @@ vFprintf( FILE *f, const char *msg, va_list va )
}
}
-void
+void ATTR_PRINTFLIKE(2, 3)
Fprintf( FILE *f, const char *msg, ... )
{
va_list va;
@@ -213,7 +213,7 @@ static int check_cancel( sync_vars_t *svars );
#define ST_SENDING_NEW (1<<15)
-void
+void ATTR_PRINTFLIKE(2, 3)
jFprintf( sync_vars_t *svars, const char *msg, ... )
{
va_list va;
diff --git a/src/util.c b/src/util.c
index 8c56a28..6e0592b 100644
--- a/src/util.c
+++ b/src/util.c
@@ -42,7 +42,7 @@ flushn( void )
}
}
-static void
+static void ATTR_PRINTFLIKE(1, 0)
printn( const char *msg, va_list va )
{
if (*msg == '\v')
_______________________________________________
isync-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/isync-devel