gcc complains (non-rightfully):

> include/common/buf.h: In function ‘br_head_pick’:
> include/common/debug.h:62:4: warning: ignoring return value of ‘write’, 
> declared with attribute warn_unused_result [-Wunused-result]
>     (void)write(2, msg, strlen(msg));                      \
>     ^
> include/common/debug.h:57:35: note: in expansion of macro ‘__BUG_ON’
>  #define _BUG_ON(cond, file, line) __BUG_ON(cond, file, line)
>                                    ^
> include/common/debug.h:56:22: note: in expansion of macro ‘_BUG_ON’
>  #define BUG_ON(cond) _BUG_ON(cond, __FILE__, __LINE__)
>                       ^
> include/common/buf.h:1011:2: note: in expansion of macro ‘BUG_ON’
>   BUG_ON(r->area != BUF_RING.area);
>   ^
---
 include/common/debug.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/common/debug.h b/include/common/debug.h
index df8552229..e748c9697 100644
--- a/include/common/debug.h
+++ b/include/common/debug.h
@@ -53,13 +53,14 @@
 #define CRASH_NOW()
 #endif
 
+extern int shut_your_big_mouth_gcc_int;
 #define BUG_ON(cond) _BUG_ON(cond, __FILE__, __LINE__)
 #define _BUG_ON(cond, file, line) __BUG_ON(cond, file, line)
 #define __BUG_ON(cond, file, line)                                             
\
        do {                                                                   \
                if (unlikely(cond)) {                                          \
                        const char msg[] = "\nFATAL: bug condition \"" #cond 
"\" matched at " file ":" #line "\n"; \
-                       (void)write(2, msg, strlen(msg));                      \
+                       shut_your_big_mouth_gcc_int = write(2, msg, 
strlen(msg));                      \
                        CRASH_NOW();                                           \
                }                                                              \
        } while (0)
-- 
2.25.1


Reply via email to