Re: [PATCH] workqueue: fix enum type for gcc-13
From: Tejun Heo
Date: Wed Jan 18 2023 - 20:49:45 EST
On Wed, Jan 18, 2023 at 09:32:45PM +0100, Arnd Bergmann wrote:
> the enum type has to be compatible with 'long long' because
> anything shorter would not fit both -1 and -1u (UINT_MAX).
> A and B were both signed types to match the signedness of the
> enum type, but A was actually a 32-bit integer since that is
> sufficient, while B was also a 64-bit type since it exceeds
> INT_MAX. Now they are both the same type.
Yeah, the new behavior makes total sense.
> I don't think there is a chance they will revert to the old behavior,
> though we could try asking for an command line flag to warn about
> cases where this changes code generation.
but the way that it's transitioning doesn't really make sense to me. We do
phase out support for old compilers, so it isn't that difficult to manage
this transition smoothly - add a compat option in the new versions, switch
code later once old compilers are phased out and drop the compat flag.
The way it's currently done causes situations which can't be handled
logically - we end up having to regroup enums based on their value range
rather than the logical type they need to be because there's no way to
override the enum type on older compilers.
Thanks.
--
tejun