mirror of
https://github.com/kdave/btrfs-progs
synced 2024-12-25 07:32:22 +00:00
btrfs-progs: mark BUG() as unreachable
Marking BUG() unreachable helps us silence unnecessary warnings e.g. "warning: control reaches end of non-void function [-Wreturn-type]" like the code below. int foo() { ... if (XXX) return 0; else if (YYY) return 1; else BUG(); } Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
4a9b83c7a4
commit
c6b585034f
@ -333,7 +333,11 @@ static inline void assert_trace(const char *assertion, const char *filename,
|
||||
#endif
|
||||
|
||||
#define BUG_ON(c) bugon_trace(#c, __FILE__, __func__, __LINE__, (long)(c))
|
||||
#define BUG() BUG_ON(1)
|
||||
#define BUG() \
|
||||
do { \
|
||||
BUG_ON(1); \
|
||||
__builtin_unreachable(); \
|
||||
} while (0)
|
||||
#define WARN_ON(c) warning_trace(#c, __FILE__, __func__, __LINE__, (long)(c))
|
||||
|
||||
#define container_of(ptr, type, member) ({ \
|
||||
|
Loading…
Reference in New Issue
Block a user