Skip to contentSkip to conversation

Remove "#define unlikely(cond) (cond)"

PATCH In review H.J. Lu 2 participants 2 messages Apr 1, 2025 x86

lore
Share & tools
lore

H.J. Lu

author
#0 lore raw

PATCH 1/1 Remove "#define unlikely(cond) (cond)"

commit c104c16073b7fdb3e4eae18f66f4009f6b073d6f

Author: Sergio González Collado <[email protected]>
Date:   Sun Mar 2 23:15:18 2025 +0100

Kunit to check the longest symbol length

included <linux/kallsyms.h> which triggered

arch/x86/tools/insn_decoder_test.c:15:9: warning: "unlikely" redefined
15 | #define unlikely(cond) (cond)

      |         ^~~~~~~~
In file included from ./tools/include/linux/build_bug.h:5,
                 from ./tools/include/linux/kernel.h:8,
                 from ./tools/include/linux/kallsyms.h:5,
                 from arch/x86/tools/insn_decoder_test.c:13:

./tools/include/linux/compiler.h:128:10: note: this is the location of the previous definition
128 | # define unlikely(x) __builtin_expect(!!(x), 0)

Remove "#define unlikely(cond) (cond)" to silence the compiler warning.

---
 arch/x86/tools/insn_decoder_test.c | 2 --
 1 file changed, 2 deletions(-)
arch/x86/tools/insn_decoder_test.c +0 -2
index 6c2986d2ad11..08cd913cbd4e 100644
@@ -12,8 +12,6 @@
 #include <stdarg.h>
 #include <linux/kallsyms.h>
 
-#define unlikely(cond) (cond)
-
 #include <asm/insn.h>
 #include <inat.c>
 #include <insn.c>
Signature · 1 line
2.49.0
#1 lore raw
Quoted 30 lines · H.J. Lu

commit c104c16073b7fdb3e4eae18f66f4009f6b073d6f

Author: Sergio González Collado <[email protected]>
Date:   Sun Mar 2 23:15:18 2025 +0100

Kunit to check the longest symbol length

included <linux/kallsyms.h> which triggered

arch/x86/tools/insn_decoder_test.c:15:9: warning: "unlikely" redefined
15 | #define unlikely(cond) (cond)
| ^~~~~~~~
In file included from ./tools/include/linux/build_bug.h:5,

                  from ./tools/include/linux/kernel.h:8,
                  from ./tools/include/linux/kallsyms.h:5,
                  from arch/x86/tools/insn_decoder_test.c:13:

./tools/include/linux/compiler.h:128:10: note: this is the location of the previous definition
128 | # define unlikely(x) __builtin_expect(!!(x), 0)

Remove "#define unlikely(cond) (cond)" to silence the compiler warning.

---
  arch/x86/tools/insn_decoder_test.c | 2 --
  1 file changed, 2 deletions(-)
arch/x86/tools/insn_decoder_test.c +0 -0
index 6c2986d2ad11..08cd913cbd4e 100644

arch/x86/tools/insn_decoder_test.c line 17

Quoted 8 lines
arch/x86/tools/insn_decoder_test.c +0 -2
@@ -12,8 +12,6 @@
  #include <stdarg.h>
  #include <linux/kallsyms.h>
 
-#define unlikely(cond) (cond)
-
  #include <asm/insn.h>
  #include <inat.c>
  #include <insn.c>

Sorry I didn't notice when I suggested to submit, but this same patch was submitted a week ago.

https://lkml.org/lkml/2025/3/18/1606