All of lore.kernel.org
 help / color / mirror / Atom feed
* [lustre-devel] [PATCH] staging: lustre: shut up clang warnings on CLASSERT()
@ 2017-02-01 16:52 ` Arnd Bergmann
  0 siblings, 0 replies; 12+ messages in thread
From: Arnd Bergmann @ 2017-02-01 16:52 UTC (permalink / raw)
  To: Oleg Drokin, Andreas Dilger, James Simmons, Greg Kroah-Hartman
  Cc: Arnd Bergmann, John L. Hammond, Dmitry Eremin, Kirill A. Shutemov,
	lustre-devel, devel, linux-kernel

lustre uses a fake switch() statement as a compile-time assert, but unfortunately
each use of that causes a warning when building with clang:

drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c:2907:2: warning: no case matching constant switch condition '42'
drivers/staging/lustre/lnet/klnds/socklnd/../../../include/linux/libcfs/libcfs_private.h:294:36: note: expanded from macro 'CLASSERT'
 #define CLASSERT(cond) do {switch (42) {case (cond): case 0: break; } } while (0)

Adding a 'default:' label in there shuts up the warning.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/staging/lustre/include/linux/libcfs/libcfs_private.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h
index aab15d8112a4..2d5435029185 100644
--- a/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h
+++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h
@@ -291,7 +291,7 @@ do {							    \
  *       value  after  conversion...
  *
  */
-#define CLASSERT(cond) do {switch (42) {case (cond): case 0: break; } } while (0)
+#define CLASSERT(cond) do {switch (42) {case (cond): case 0: default: break; } } while (0)
 
 /* max value for numeric network address */
 #define MAX_NUMERIC_VALUE 0xffffffff
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2017-02-02 11:23 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-01 16:52 [lustre-devel] [PATCH] staging: lustre: shut up clang warnings on CLASSERT() Arnd Bergmann
2017-02-01 16:52 ` Arnd Bergmann
2017-02-02  7:50 ` [lustre-devel] " Dilger, Andreas
2017-02-02  7:50   ` Dilger, Andreas
2017-02-02  9:54   ` [lustre-devel] " Greg Kroah-Hartman
2017-02-02  9:54     ` Greg Kroah-Hartman
2017-02-02 10:40     ` [lustre-devel] " Arnd Bergmann
2017-02-02 10:40       ` Arnd Bergmann
2017-02-02 10:43       ` [lustre-devel] " Greg Kroah-Hartman
2017-02-02 10:43         ` Greg Kroah-Hartman
2017-02-02 11:22         ` [lustre-devel] " Arnd Bergmann
2017-02-02 11:22           ` Arnd Bergmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.