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.
This commit is contained in:
Oswald Buddenhagen 2019-07-28 19:52:41 +02:00
parent df22514ced
commit 71d7d3e6df
5 changed files with 12 additions and 9 deletions

View File

@ -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 *, ... );
@ -163,7 +163,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 );
@ -244,7 +244,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 );

View File

@ -306,8 +306,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 );

View File

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

View File

@ -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;
@ -217,7 +217,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;

View File

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