Browse Source

add some ATTR_* (mostly)

mostly ATTR_PRINTFLIKE(*, 0) for functions with a va_list argument.

also, one ATTR_NORETURN and one ATTR_UNUSED, both on functions.

also, an explicit suppression for a format string stored in a variable.
1.4
Oswald Buddenhagen 5 years ago
parent
commit
71d7d3e6df
  1. 8
      src/common.h
  2. 3
      src/drv_imap.c
  3. 2
      src/main.c
  4. 6
      src/sync.c
  5. 2
      src/util.c

8
src/common.h

@ -122,8 +122,8 @@ void stats( void );
/* util.c */ /* util.c */
void vdebug( int, const char *, va_list va ); void ATTR_PRINTFLIKE(2, 0) vdebug( int, const char *, va_list va );
void vdebugn( 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) info( const char *, ... );
void ATTR_PRINTFLIKE(1, 2) infon( const char *, ... ); void ATTR_PRINTFLIKE(1, 2) infon( const char *, ... );
void ATTR_PRINTFLIKE(1, 2) progress( const char *, ... ); void ATTR_PRINTFLIKE(1, 2) progress( const char *, ... );
@ -163,7 +163,7 @@ void *nfcalloc( size_t sz );
void *nfrealloc( void *mem, size_t sz ); void *nfrealloc( void *mem, size_t sz );
char *nfstrndup( const char *str, size_t nchars ); char *nfstrndup( const char *str, size_t nchars );
char *nfstrdup( const char *str ); 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(2, 3) nfasprintf( char **str, const char *fmt, ... );
int ATTR_PRINTFLIKE(3, 4) nfsnprintf( char *buf, int blen, const char *fmt, ... ); int ATTR_PRINTFLIKE(3, 4) nfsnprintf( char *buf, int blen, const char *fmt, ... );
void ATTR_NORETURN oob( void ); void ATTR_NORETURN oob( void );
@ -244,7 +244,7 @@ typedef struct {
void init_wakeup( wakeup_t *tmr, void (*cb)( void * ), void *aux ); void init_wakeup( wakeup_t *tmr, void (*cb)( void * ), void *aux );
void conf_wakeup( wakeup_t *tmr, int timeout ); void conf_wakeup( wakeup_t *tmr, int timeout );
void wipe_wakeup( wakeup_t *tmr ); 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 ); void main_loop( void );

3
src/drv_imap.c

@ -306,8 +306,11 @@ send_imap_cmd( imap_store_t *ctx, imap_cmd_t *cmd )
buffmt = "%d %s{%d+}\r\n"; buffmt = "%d %s{%d+}\r\n";
litplus = 1; litplus = 1;
} }
DIAG_PUSH
DIAG_DISABLE("-Wformat-nonliteral")
bufl = nfsnprintf( buf, sizeof(buf), buffmt, bufl = nfsnprintf( buf, sizeof(buf), buffmt,
cmd->tag, cmd->cmd, cmd->param.data_len ); cmd->tag, cmd->cmd, cmd->param.data_len );
DIAG_POP
if (DFlags & DEBUG_NET) { if (DFlags & DEBUG_NET) {
if (ctx->num_in_progress) if (ctx->num_in_progress)
printf( "(%d in progress) ", ctx->num_in_progress ); printf( "(%d in progress) ", ctx->num_in_progress );

2
src/main.c

@ -136,7 +136,7 @@ debug( const char *msg, ... )
} }
#ifdef __linux__ #ifdef __linux__
static void static void ATTR_NORETURN
crashHandler( int n ) crashHandler( int n )
{ {
int dpid; int dpid;

6
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 ) vFprintf( FILE *f, const char *msg, va_list va )
{ {
int r; 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, ... ) Fprintf( FILE *f, const char *msg, ... )
{ {
va_list va; va_list va;
@ -217,7 +217,7 @@ static int check_cancel( sync_vars_t *svars );
#define ST_SENDING_NEW (1<<15) #define ST_SENDING_NEW (1<<15)
void void ATTR_PRINTFLIKE(2, 3)
jFprintf( sync_vars_t *svars, const char *msg, ... ) jFprintf( sync_vars_t *svars, const char *msg, ... )
{ {
va_list va; va_list va;

2
src/util.c

@ -42,7 +42,7 @@ flushn( void )
} }
} }
static void static void ATTR_PRINTFLIKE(1, 0)
printn( const char *msg, va_list va ) printn( const char *msg, va_list va )
{ {
if (*msg == '\v') if (*msg == '\v')

Loading…
Cancel
Save