Re: [PATCH] MIPS: Drop unused positional parameter in local_irq_{dis,en}able

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 4 Apr 2023, Nathan Chancellor wrote:

> When building with clang's integrated assembler, it points out that the
> CONFIG_CPU_HAS_DIEI versions of local_irq_enable and local_irq_disable
> have a named parameter that is not used in the body of the macro and it
> thinks that $8 is a positional parameter, rather than a register:
> 
>   arch/mips/include/asm/asmmacro.h:48:2: warning: macro defined with named
> parameters which are not used in macro body, possible positional parameter found
> in body which will have no effect
>    .macro local_irq_enable reg=$8
>    ^
> 
> The comment above the function that performs this check in LLVM notes
> that the warning may trigger in this case, even though it is not
> problematic. It is easy enough to clean this up by just omitting the
> named parameter for this version of the macro, as it is entirely unused.

 You need to remove the argument from the !CONFIG_CPU_HAS_DIEI versions of 
the macros then too or otherwise we now have an inconsistent API between 
kernel configurations.

 AFAICT the only call site is in arch/mips/kernel/entry.S (and for
`local_irq_enable' only), and it doesn't supply the argument, which is why 
you could have removed it for CONFIG_CPU_HAS_DIEI at all.

 FWIW I find your reported warning questionable, there are valid reasons, 
such as the very situation here, why an argument might not be used.  It is 
only a macro after all, effectively a source code transformation tool.  
Similarly the C preprocessor does not warn about unused macro arguments.

 So IMHO your change has crippled reasonable code just to paper over a 
tool's deficiency.

  Maciej



[Index of Archives]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux