[RESEND] drbd: avoid clang warning about pointless switch statement

From: Philipp Klocke
Date: Mon Sep 17 2018 - 08:54:46 EST


The drbd code causes warnings that we cannot easily disable when
building with clang:

In file included from drivers/block/drbd/drbd_debugfs.c:10:
In file included from drivers/block/drbd/drbd_int.h:48:
In file included from include/linux/drbd_genl_api.h:53:
In file included from include/linux/genl_magic_struct.h:237:
include/linux/drbd_genl.h:300:1: warning: no case matching constant
switch condition '0'

There is nothing wrong with the code, and adding 'default:' labels
in the right place is enough to let clang shut up about the warning.

Fixes: ec2c35ac1ea2 ("drbd: prepare the transition from connector to
genetlink")
Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
--
was sent on Feb. 1, 2017, 4:55 p.m. UTC by Arnd Bergmann
was acked but not merged
resend
---
Âinclude/linux/genl_magic_struct.h | 3 +++
Â1 file changed, 3 insertions(+)

diff --git a/include/linux/genl_magic_struct.h
b/include/linux/genl_magic_struct.h
index 6270a56e5edc..c6fbafb834f1 100644
--- a/include/linux/genl_magic_struct.h
+++ b/include/linux/genl_magic_struct.h
@@ -190,6 +190,7 @@ static inline void ct_assert_unique_operations(void)
Â{
ÂÂÂÂ switch (0) {
Â#include GENL_MAGIC_INCLUDE_FILE
+ÂÂÂ default:
ÂÂÂÂ ÂÂÂ ;
ÂÂÂÂ }
Â}
@@ -208,6 +209,7 @@ static inline void
ct_assert_unique_top_level_attributes(void)
Â{
ÂÂÂÂ switch (0) {
Â#include GENL_MAGIC_INCLUDE_FILE
+ÂÂÂ default:
ÂÂÂÂ ÂÂÂ ;
ÂÂÂÂ }
Â}
@@ -218,6 +220,7 @@ static inline void ct_assert_unique_ ## s_name ##
_attributes(void)ÂÂÂ \
Â{ÂÂÂ ÂÂÂ ÂÂÂ ÂÂÂ ÂÂÂ ÂÂÂ ÂÂÂ ÂÂÂ ÂÂÂ \
ÂÂÂÂ switch (0) {ÂÂÂ ÂÂÂ ÂÂÂ ÂÂÂ ÂÂÂ ÂÂÂ ÂÂÂ \
ÂÂÂÂ ÂÂÂ s_fieldsÂÂÂ ÂÂÂ ÂÂÂ ÂÂÂ ÂÂÂ ÂÂÂ \
+ÂÂÂ ÂÂÂ default:ÂÂÂ ÂÂÂ ÂÂÂ ÂÂÂ ÂÂÂ ÂÂÂ \
ÂÂÂÂ ÂÂÂ ÂÂÂ ;ÂÂÂ ÂÂÂ ÂÂÂ ÂÂÂ ÂÂÂ ÂÂÂ \
ÂÂÂÂ }ÂÂÂ ÂÂÂ ÂÂÂ ÂÂÂ ÂÂÂ ÂÂÂ ÂÂÂ ÂÂÂ \
Â}