Re: [PATCH] x86/percpu: fix cast in __pcpu_cast_* macros

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

 



On Mon, May 27 2024 at 08:51, Alexey Dobriyan wrote:
> Fix compile failure
>
> 	this_cpu_add(*p, x = 1);
>
> kernel/test.c:7:29: error: lvalue required as left operand of assignment
>     7 |         this_cpu_add(*p, x = 1);
>       |                            ^
> arch/x86/include/asm/percpu.h:134:51: note: in definition of macro '__pcpu_cast_1'
>   134 | #define __pcpu_cast_1(val) ((u8)(((unsigned long) val) & 0xff))
>
>
> This pattern is almost always wrong:
>
> 	#define M(x)	((T)x)
>
> also because it can't be used with assignment expressions: cast makes
> left part of it non-lvalue and assignment to non-lvalue has to break
> compilation.

In principle I agree with the change itself, but I really don't see the
point for

	 this_cpu_add(*p, x = 1);

Even if C supports it, it's just nasty and tasteless.

Thanks,

        tglx




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux