[PATCH] x86/tools: Drop unlikely definition from insn_decoder_test

Nathan Chancellor posted 1 patch 9 months ago
arch/x86/tools/insn_decoder_test.c | 2 --
1 file changed, 2 deletions(-)
[PATCH] x86/tools: Drop unlikely definition from insn_decoder_test
Posted by Nathan Chancellor 9 months ago
After commit c104c16073b7 ("Kunit to check the longest symbol length"),
there is a warning when building with clang because there is now a
definition of unlikely from compiler.h in tools/include/linux, which
conflicts with the one in the instruction decoder selftest.

  arch/x86/tools/insn_decoder_test.c:15:9: warning: 'unlikely' macro redefined [-Wmacro-redefined]
     15 | #define unlikely(cond) (cond)
        |         ^
  tools/include/linux/compiler.h:128:10: note: previous definition is here
    128 | # define unlikely(x)            __builtin_expect(!!(x), 0)
        |          ^
  1 warning generated.

Remove the second unlikely definition, as it is no longer necessary,
clearing up the warning.

Fixes: c104c16073b7 ("Kunit to check the longest symbol length")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
 arch/x86/tools/insn_decoder_test.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/x86/tools/insn_decoder_test.c b/arch/x86/tools/insn_decoder_test.c
index 6c2986d2ad11..08cd913cbd4e 100644
--- a/arch/x86/tools/insn_decoder_test.c
+++ b/arch/x86/tools/insn_decoder_test.c
@@ -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>

---
base-commit: 2e0cf2b32f72b20b0db5cc665cd8465d0f257278
change-id: 20250318-x86-decoder-test-fix-unlikely-redef-1636897e4fe7

Best regards,
-- 
Nathan Chancellor <nathan@kernel.org>
Re: [PATCH] x86/tools: Drop unlikely definition from insn_decoder_test
Posted by Ingo Molnar 9 months ago
* Nathan Chancellor <nathan@kernel.org> wrote:

> After commit c104c16073b7 ("Kunit to check the longest symbol length"),
> there is a warning when building with clang because there is now a
> definition of unlikely from compiler.h in tools/include/linux, which
> conflicts with the one in the instruction decoder selftest.
> 
>   arch/x86/tools/insn_decoder_test.c:15:9: warning: 'unlikely' macro redefined [-Wmacro-redefined]
>      15 | #define unlikely(cond) (cond)
>         |         ^
>   tools/include/linux/compiler.h:128:10: note: previous definition is here
>     128 | # define unlikely(x)            __builtin_expect(!!(x), 0)
>         |          ^
>   1 warning generated.
> 
> Remove the second unlikely definition, as it is no longer necessary,
> clearing up the warning.
> 
> Fixes: c104c16073b7 ("Kunit to check the longest symbol length")
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
>  arch/x86/tools/insn_decoder_test.c | 2 --
>  1 file changed, 2 deletions(-)

I suppose this should be merged into the Kunit tree? The c104c16073b7 
commit is in -next currently.

Anyway:

  Acked-by: Ingo Molnar <mingo@kernel.org>

Thanks,

	Ingo
Re: [PATCH] x86/tools: Drop unlikely definition from insn_decoder_test
Posted by Shuah Khan 8 months, 3 weeks ago
On 3/19/25 14:31, Ingo Molnar wrote:
> 
> * Nathan Chancellor <nathan@kernel.org> wrote:
> 
>> After commit c104c16073b7 ("Kunit to check the longest symbol length"),
>> there is a warning when building with clang because there is now a
>> definition of unlikely from compiler.h in tools/include/linux, which
>> conflicts with the one in the instruction decoder selftest.
>>
>>    arch/x86/tools/insn_decoder_test.c:15:9: warning: 'unlikely' macro redefined [-Wmacro-redefined]
>>       15 | #define unlikely(cond) (cond)
>>          |         ^
>>    tools/include/linux/compiler.h:128:10: note: previous definition is here
>>      128 | # define unlikely(x)            __builtin_expect(!!(x), 0)
>>          |          ^
>>    1 warning generated.
>>
>> Remove the second unlikely definition, as it is no longer necessary,
>> clearing up the warning.
>>
>> Fixes: c104c16073b7 ("Kunit to check the longest symbol length")
>> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
>> ---
>>   arch/x86/tools/insn_decoder_test.c | 2 --
>>   1 file changed, 2 deletions(-)
> 
> I suppose this should be merged into the Kunit tree? The c104c16073b7
> commit is in -next currently.
> 
> Anyway:
> 
>    Acked-by: Ingo Molnar <mingo@kernel.org>
> 

Thanks Ingo.

David/Brendan, Okay to apply this for the next rc?

thanks,
-- Shuah
Re: [PATCH] x86/tools: Drop unlikely definition from insn_decoder_test
Posted by Ingo Molnar 8 months, 3 weeks ago
* Shuah Khan <skhan@linuxfoundation.org> wrote:

> On 3/19/25 14:31, Ingo Molnar wrote:
> > 
> > * Nathan Chancellor <nathan@kernel.org> wrote:
> > 
> > > After commit c104c16073b7 ("Kunit to check the longest symbol length"),
> > > there is a warning when building with clang because there is now a
> > > definition of unlikely from compiler.h in tools/include/linux, which
> > > conflicts with the one in the instruction decoder selftest.
> > > 
> > >    arch/x86/tools/insn_decoder_test.c:15:9: warning: 'unlikely' macro redefined [-Wmacro-redefined]
> > >       15 | #define unlikely(cond) (cond)
> > >          |         ^
> > >    tools/include/linux/compiler.h:128:10: note: previous definition is here
> > >      128 | # define unlikely(x)            __builtin_expect(!!(x), 0)
> > >          |          ^
> > >    1 warning generated.
> > > 
> > > Remove the second unlikely definition, as it is no longer necessary,
> > > clearing up the warning.
> > > 
> > > Fixes: c104c16073b7 ("Kunit to check the longest symbol length")
> > > Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> > > ---
> > >   arch/x86/tools/insn_decoder_test.c | 2 --
> > >   1 file changed, 2 deletions(-)
> > 
> > I suppose this should be merged into the Kunit tree? The c104c16073b7
> > commit is in -next currently.
> > 
> > Anyway:
> > 
> >    Acked-by: Ingo Molnar <mingo@kernel.org>
> > 
> 
> Thanks Ingo.
> 
> David/Brendan, Okay to apply this for the next rc?

Since the original commit is now upstream, I've picked up this fix for 
x86/urgent and we'll send it to Linus in a day or two.

I've added your Ack:

  Acked-by: Shuah Khan <skhan@linuxfoundation.org>

if that's OK to you.

Thanks,

	Ingo