commit 33ee4a4ffed94164fd20c397b214101e07fcbe66
Author: Oswald Buddenhagen <[email protected]>
Date: Sun Oct 1 10:04:00 2017 +0200
fixes for -Wimplicit-fallthrough
src/common.h | 6 ++++++
src/compat/isync.h | 6 ++++++
src/compat/main.c | 8 ++++----
src/main.c | 6 +++---
src/socket.c | 2 +-
5 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/src/common.h b/src/common.h
index 18390f3..f876381 100644
--- a/src/common.h
+++ b/src/common.h
@@ -49,6 +49,12 @@ typedef unsigned int uint;
# define ATTR_PRINTFLIKE(fmt,var)
#endif
+#if __GNUC__ >= 7
+# define FALLTHROUGH __attribute__((fallthrough));
+#else
+# define FALLTHROUGH
+#endif
+
#ifdef __GNUC__
# define INLINE __inline__
#else
diff --git a/src/compat/isync.h b/src/compat/isync.h
index 0473900..71d19ea 100644
--- a/src/compat/isync.h
+++ b/src/compat/isync.h
@@ -34,6 +34,12 @@
# define ATTR_PRINTFLIKE(fmt,var)
#endif
+#if __GNUC__ >= 7
+# define FALLTHROUGH __attribute__((fallthrough));
+#else
+# define FALLTHROUGH
+#endif
+
typedef struct config {
struct config *next;
diff --git a/src/compat/main.c b/src/compat/main.c
index 2ad6f07..6b00547 100644
--- a/src/compat/main.c
+++ b/src/compat/main.c
@@ -64,14 +64,14 @@ struct option Opts[] = {
};
#endif
-static void
+static void ATTR_NORETURN
version( void )
{
puts( PACKAGE " " VERSION );
exit( 0 );
}
-static void
+static void ATTR_NORETURN
usage( int code )
{
fputs(
@@ -194,13 +194,13 @@ main( int argc, char **argv )
switch (i) {
case 'W':
outconfig = optarg;
- /* plopp */
+ FALLTHROUGH
case 'w':
writeout = 1;
break;
case 'l':
list = 1;
- /* plopp */
+ FALLTHROUGH
case 'a':
all = 1;
break;
diff --git a/src/main.c b/src/main.c
index 23b6931..27ef8d7 100644
--- a/src/main.c
+++ b/src/main.c
@@ -51,14 +51,14 @@ int new_total[2], new_done[2];
int flags_total[2], flags_done[2];
int trash_total[2], trash_done[2];
-static void
+static void ATTR_NORETURN
version( void )
{
puts( PACKAGE " " VERSION );
exit( 0 );
}
-static void
+static void ATTR_NORETURN
usage( int code )
{
fputs(
@@ -573,7 +573,7 @@ main( int argc, char **argv )
goto cop;
case 'F':
cops |= XOP_PULL|XOP_PUSH;
- /* fallthrough */
+ FALLTHROUGH
case '0':
ops[M] |= XOP_HAVE_TYPE;
break;
diff --git a/src/socket.c b/src/socket.c
index 9357b8c..65f51b6 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -72,7 +72,7 @@ ssl_return( const char *func, conn_t *conn, int ret )
return ret;
case SSL_ERROR_WANT_WRITE:
conf_notifier( &conn->notify, POLLIN, POLLOUT );
- /* fallthrough */
+ FALLTHROUGH
case SSL_ERROR_WANT_READ:
return 0;
case SSL_ERROR_SYSCALL:
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
isync-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/isync-devel