From: Michael Jeanson Date: Fri, 30 Nov 2018 19:28:51 +0000 (-0500) Subject: Add -Wextra to CFLAGS X-Git-Tag: v0.11.0~19 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=447c9339d4f21fe5bba1aa77eccc9f94745e6447;p=userspace-rcu.git Add -Wextra to CFLAGS Edited by Mathieu Desnoyers: Use /* fall through */ rather than __attribute__((fallthrough)) to stay compatible with clang and gcc < 7. The fallthrough attribute was introduced in gcc 7. Signed-off-by: Michael Jeanson Signed-off-by: Mathieu Desnoyers --- diff --git a/configure.ac b/configure.ac index 8e7ff4c..4d1a1df 100644 --- a/configure.ac +++ b/configure.ac @@ -373,7 +373,7 @@ AC_CHECK_FUNCS([sched_setaffinity],[ AM_CPPFLAGS="-include config.h" AC_SUBST(AM_CPPFLAGS) -AM_CFLAGS="-Wall $AM_CFLAGS" +AM_CFLAGS="-Wall -Wextra -Wno-unused-parameter -Wno-sign-compare $AM_CFLAGS" AC_SUBST(AM_CFLAGS) AC_CONFIG_LINKS([ diff --git a/doc/examples/rculfhash/jhash.h b/doc/examples/rculfhash/jhash.h index 673989d..5e8b288 100644 --- a/doc/examples/rculfhash/jhash.h +++ b/doc/examples/rculfhash/jhash.h @@ -226,17 +226,17 @@ uint32_t hashlittle(const void *key, size_t length, uint32_t initval) /*-------------------------------- last block: affect all 32 bits of (c) */ switch (length) { /* all the case statements fall through */ - case 12: c+=((uint32_t) k[11])<<24; - case 11: c+=((uint32_t) k[10])<<16; - case 10: c+=((uint32_t) k[9])<<8; - case 9 : c+=k[8]; - case 8 : b+=((uint32_t) k[7])<<24; - case 7 : b+=((uint32_t) k[6])<<16; - case 6 : b+=((uint32_t) k[5])<<8; - case 5 : b+=k[4]; - case 4 : a+=((uint32_t) k[3])<<24; - case 3 : a+=((uint32_t) k[2])<<16; - case 2 : a+=((uint32_t) k[1])<<8; + case 12: c+=((uint32_t) k[11])<<24; /* fall through */ + case 11: c+=((uint32_t) k[10])<<16; /* fall through */ + case 10: c+=((uint32_t) k[9])<<8; /* fall through */ + case 9 : c+=k[8]; /* fall through */ + case 8 : b+=((uint32_t) k[7])<<24; /* fall through */ + case 7 : b+=((uint32_t) k[6])<<16; /* fall through */ + case 6 : b+=((uint32_t) k[5])<<8; /* fall through */ + case 5 : b+=k[4]; /* fall through */ + case 4 : a+=((uint32_t) k[3])<<24; /* fall through */ + case 3 : a+=((uint32_t) k[2])<<16; /* fall through */ + case 2 : a+=((uint32_t) k[1])<<8; /* fall through */ case 1 : a+=k[0]; break; case 0 : return c; diff --git a/tests/benchmark/test_urcu_hash.h b/tests/benchmark/test_urcu_hash.h index 2f708a1..023ae1c 100644 --- a/tests/benchmark/test_urcu_hash.h +++ b/tests/benchmark/test_urcu_hash.h @@ -285,10 +285,11 @@ void hashword2( /*----------------------------------- handle the last 3 uint32_t's */ switch (length) { /* all the case statements fall through */ - case 3: c += k[2]; - case 2: b += k[1]; + case 3: c += k[2]; /* fall through */ + case 2: b += k[1]; /* fall through */ case 1: a += k[0]; final(a, b, c); + /* fall through */ case 0: /* case 0: nothing left to add */ break; } diff --git a/tests/regression/rcutorture.h b/tests/regression/rcutorture.h index db3dfad..9a2f9a1 100644 --- a/tests/regression/rcutorture.h +++ b/tests/regression/rcutorture.h @@ -113,13 +113,13 @@ volatile int goflag __attribute__((__aligned__(CAA_CACHE_LINE_SIZE))) #endif #ifndef mark_rcu_quiescent_state -#define mark_rcu_quiescent_state() do ; while (0) +#define mark_rcu_quiescent_state() do {} while (0) #endif /* #ifdef mark_rcu_quiescent_state */ #ifndef put_thread_offline -#define put_thread_offline() do ; while (0) -#define put_thread_online() do ; while (0) -#define put_thread_online_delay() do ; while (0) +#define put_thread_offline() do {} while (0) +#define put_thread_online() do {} while (0) +#define put_thread_online_delay() do {} while (0) #else /* #ifndef put_thread_offline */ #define put_thread_online_delay() synchronize_rcu() #endif /* #else #ifndef put_thread_offline */