use ATTR_PRINTFALIKE

This commit is contained in:
Oswald Buddenhagen 2011-04-11 10:46:25 +02:00 committed by Oswald Buddenhagen
parent 7c815538ab
commit 06b303da88
2 changed files with 13 additions and 11 deletions

View File

@ -393,13 +393,13 @@ void cram( const char *challenge, const char *user, const char *pass,
extern int DFlags; extern int DFlags;
void debug( const char *, ... ); void ATTR_PRINTFLIKE(1, 2) debug( const char *, ... );
void debugn( const char *, ... ); void ATTR_PRINTFLIKE(1, 2) debugn( const char *, ... );
void info( const char *, ... ); void ATTR_PRINTFLIKE(1, 2) info( const char *, ... );
void infon( const char *, ... ); void ATTR_PRINTFLIKE(1, 2) infon( const char *, ... );
void warn( const char *, ... ); void ATTR_PRINTFLIKE(1, 2) warn( const char *, ... );
void error( const char *, ... ); void ATTR_PRINTFLIKE(1, 2) error( const char *, ... );
void sys_error( const char *, ... ); void ATTR_PRINTFLIKE(1, 2) sys_error( const char *, ... );
void flushn( void ); void flushn( void );
char *next_arg( char ** ); char *next_arg( char ** );
@ -414,8 +414,8 @@ void *nfcalloc( size_t sz );
void *nfrealloc( void *mem, size_t sz ); void *nfrealloc( void *mem, size_t sz );
char *nfstrdup( const char *str ); char *nfstrdup( const char *str );
int nfvasprintf( char **str, const char *fmt, va_list va ); int nfvasprintf( char **str, const char *fmt, va_list va );
int nfasprintf( char **str, const char *fmt, ... ); int ATTR_PRINTFLIKE(2, 3) nfasprintf( char **str, const char *fmt, ... );
int 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 );
char *expand_strdup( const char *s ); char *expand_strdup( const char *s );

View File

@ -37,8 +37,10 @@
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4) #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
# define ATTR_NORETURN __attribute__((noreturn)) # define ATTR_NORETURN __attribute__((noreturn))
# define ATTR_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
#else #else
# define ATTR_NORETURN # define ATTR_NORETURN
# define ATTR_PRINTFLIKE(fmt,var)
#endif #endif
static void ATTR_NORETURN static void ATTR_NORETURN
@ -48,7 +50,7 @@ oob( void )
abort(); abort();
} }
static void static void ATTR_PRINTFLIKE(1, 2)
sys_error( const char *msg, ... ) sys_error( const char *msg, ... )
{ {
va_list va; va_list va;
@ -61,7 +63,7 @@ sys_error( const char *msg, ... )
perror( buf ); perror( buf );
} }
static int static int ATTR_PRINTFLIKE(3, 4)
nfsnprintf( char *buf, int blen, const char *fmt, ... ) nfsnprintf( char *buf, int blen, const char *fmt, ... )
{ {
int ret; int ret;