Skip to content

Commit c837de3

Browse files
author
Peter Zijlstra
committed
unreachable: Unify
Since barrier_before_unreachable() is empty for !GCC it is trivial to unify the two definitions. Less is more. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Acked-by: Josh Poimboeuf <jpoimboe@kernel.org> Link: https://lore.kernel.org/r/20241128094311.924381359@infradead.org
1 parent bb81700 commit c837de3

File tree

2 files changed

+7
-15
lines changed

2 files changed

+7
-15
lines changed

include/linux/compiler-gcc.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,6 @@
5252
*/
5353
#define barrier_before_unreachable() asm volatile("")
5454

55-
/*
56-
* Mark a position in code as unreachable. This can be used to
57-
* suppress control flow warnings after asm blocks that transfer
58-
* control elsewhere.
59-
*/
60-
#define unreachable() \
61-
do { \
62-
annotate_unreachable(); \
63-
barrier_before_unreachable(); \
64-
__builtin_unreachable(); \
65-
} while (0)
66-
6755
#if defined(CONFIG_ARCH_USE_BUILTIN_BSWAP)
6856
#define __HAVE_BUILTIN_BSWAP32__
6957
#define __HAVE_BUILTIN_BSWAP64__

include/linux/compiler.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,16 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
141141
#define __annotate_jump_table
142142
#endif /* CONFIG_OBJTOOL */
143143

144-
#ifndef unreachable
145-
# define unreachable() do { \
144+
/*
145+
* Mark a position in code as unreachable. This can be used to
146+
* suppress control flow warnings after asm blocks that transfer
147+
* control elsewhere.
148+
*/
149+
#define unreachable() do { \
146150
annotate_unreachable(); \
151+
barrier_before_unreachable(); \
147152
__builtin_unreachable(); \
148153
} while (0)
149-
#endif
150154

151155
/*
152156
* KENTRY - kernel entry point

0 commit comments

Comments
 (0)