fixes for -Wimplicit-fallthrough

This commit is contained in:
Oswald Buddenhagen 2017-10-01 10:04:00 +02:00
parent 8bab938f69
commit 33ee4a4ffe
5 changed files with 20 additions and 8 deletions

View File

@ -49,6 +49,12 @@ typedef unsigned int uint;
# define ATTR_PRINTFLIKE(fmt,var) # define ATTR_PRINTFLIKE(fmt,var)
#endif #endif
#if __GNUC__ >= 7
# define FALLTHROUGH __attribute__((fallthrough));
#else
# define FALLTHROUGH
#endif
#ifdef __GNUC__ #ifdef __GNUC__
# define INLINE __inline__ # define INLINE __inline__
#else #else

View File

@ -34,6 +34,12 @@
# define ATTR_PRINTFLIKE(fmt,var) # define ATTR_PRINTFLIKE(fmt,var)
#endif #endif
#if __GNUC__ >= 7
# define FALLTHROUGH __attribute__((fallthrough));
#else
# define FALLTHROUGH
#endif
typedef struct config { typedef struct config {
struct config *next; struct config *next;

View File

@ -64,14 +64,14 @@ struct option Opts[] = {
}; };
#endif #endif
static void static void ATTR_NORETURN
version( void ) version( void )
{ {
puts( PACKAGE " " VERSION ); puts( PACKAGE " " VERSION );
exit( 0 ); exit( 0 );
} }
static void static void ATTR_NORETURN
usage( int code ) usage( int code )
{ {
fputs( fputs(
@ -194,13 +194,13 @@ main( int argc, char **argv )
switch (i) { switch (i) {
case 'W': case 'W':
outconfig = optarg; outconfig = optarg;
/* plopp */ FALLTHROUGH
case 'w': case 'w':
writeout = 1; writeout = 1;
break; break;
case 'l': case 'l':
list = 1; list = 1;
/* plopp */ FALLTHROUGH
case 'a': case 'a':
all = 1; all = 1;
break; break;

View File

@ -51,14 +51,14 @@ int new_total[2], new_done[2];
int flags_total[2], flags_done[2]; int flags_total[2], flags_done[2];
int trash_total[2], trash_done[2]; int trash_total[2], trash_done[2];
static void static void ATTR_NORETURN
version( void ) version( void )
{ {
puts( PACKAGE " " VERSION ); puts( PACKAGE " " VERSION );
exit( 0 ); exit( 0 );
} }
static void static void ATTR_NORETURN
usage( int code ) usage( int code )
{ {
fputs( fputs(
@ -573,7 +573,7 @@ main( int argc, char **argv )
goto cop; goto cop;
case 'F': case 'F':
cops |= XOP_PULL|XOP_PUSH; cops |= XOP_PULL|XOP_PUSH;
/* fallthrough */ FALLTHROUGH
case '0': case '0':
ops[M] |= XOP_HAVE_TYPE; ops[M] |= XOP_HAVE_TYPE;
break; break;

View File

@ -72,7 +72,7 @@ ssl_return( const char *func, conn_t *conn, int ret )
return ret; return ret;
case SSL_ERROR_WANT_WRITE: case SSL_ERROR_WANT_WRITE:
conf_notifier( &conn->notify, POLLIN, POLLOUT ); conf_notifier( &conn->notify, POLLIN, POLLOUT );
/* fallthrough */ FALLTHROUGH
case SSL_ERROR_WANT_READ: case SSL_ERROR_WANT_READ:
return 0; return 0;
case SSL_ERROR_SYSCALL: case SSL_ERROR_SYSCALL: