Skip to contentSkip to conversation

staging: lustre: fix symbol redeclared with different type in libcfs

PATCH In review Maxime Lorrillere 2 participants 2 messages Aug 15, 2015 Staging

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 staging: lustre: fix symbol redeclared with different type in libcfs

lbug_with_loc is declared with __attribute__((noreturn)) in libcfs_private.h and without this attribute in linux-debug.c. This generates the following sparse error:

Quoted 1 line
Quoted 1 line
Quoted 1 line

drivers/staging/lustre/lustre/libcfs/linux/linux-debug.c:149:6: error: symbol 'lbug_with_loc' redeclared with different type (originally declared at drivers/staging/lustre/lustre/libcfs/linux/../../../include/linux/libcfs/libcfs_private.h:82) - different modifiers

This patches removes this attribute in libcfs_private.h as it seems to me that this optimization is not necessary.

---
 drivers/staging/lustre/include/linux/libcfs/libcfs_private.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/include/linux/libcfs/libcfs_private.h +1 -1
index 9544860..e60b92b 100644
@@ -79,7 +79,7 @@ do {									\
 
 #define KLASSERT(e) LASSERT(e)
 
-void lbug_with_loc(struct libcfs_debug_msg_data *)__attribute__((noreturn));
+void lbug_with_loc(struct libcfs_debug_msg_data *);
 
 #define LBUG()							  \
 do {								    \
Signature · 1 line
2.5.0
#1 lore raw
Quoted 7 lines · Maxime Lorrillere

lbug_with_loc is declared with __attribute__((noreturn)) in libcfs_private.h and without this attribute in linux-debug.c. This generates the following sparse error:

Quoted 1 line
Quoted 1 line
Quoted 1 line

drivers/staging/lustre/lustre/libcfs/linux/linux-debug.c:149:6: error: symbol 'lbug_with_loc' redeclared with different type (originally declared at drivers/staging/lustre/lustre/libcfs/linux/../../../include/linux/libcfs/libcfs_private.h:82) - different modifiers

This patches removes this attribute in libcfs_private.h as it seems to me that this optimization is not necessary.

Well, the whole idea is that the attribute tells the compiler and thing like static analysis tools that there's no return from this function.
This helps us to highlight dead code and also certain false positive warnings
abut stuff possibly used not-initialized and the like.
I'd rather prefer the actual function to be declared as no-return.

Thanks.

Quoted 22 lines

---
drivers/staging/lustre/include/linux/libcfs/libcfs_private.h | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/include/linux/libcfs/libcfs_private.h +1 -1
index 9544860..e60b92b 100644
@@ -79,7 +79,7 @@ do {									\
 
 #define KLASSERT(e) LASSERT(e)
 
-void lbug_with_loc(struct libcfs_debug_msg_data *)__attribute__((noreturn));
+void lbug_with_loc(struct libcfs_debug_msg_data *);
 
 #define LBUG()							  \
 do {								    \
Signature · 1 line
2.5.0