commit 1ccf311e3074beae39b71aa029ec56492c333f57
Author: Oswald Buddenhagen <o...@users.sf.net>
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, one explicit suppression for a format string stored in a variable.
    
    also, one ATTR_NORETURN.

 src/common.h      | 8 ++++----
 src/drv_imap.c    | 3 +++
 src/drv_maildir.c | 2 +-
 src/main.c        | 2 +-
 src/sync.c        | 6 +++---
 src/util.c        | 2 +-
 6 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/src/common.h b/src/common.h
index a383c3c..7ae30b2 100644
--- a/src/common.h
+++ b/src/common.h
@@ -117,8 +117,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 *, ... );
@@ -157,7 +157,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 );
@@ -238,7 +238,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 5620aa9..23e40cb 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..c45d691 100644
--- a/src/drv_maildir.c
+++ b/src/drv_maildir.c
@@ -1499,7 +1499,7 @@ 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 )
 {
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 7397db2..23c008f 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
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel

Reply via email to