On Fri, Jun 27, 2025, Kees Cook wrote: > On Tue, Jun 24, 2025 at 04:19:30PM -0700, Sean Christopherson wrote: > > Rename is_signed_type() to is_signed_var() to avoid colliding with a macro > > of the same name defined by linux/overflow.h. Note, overflow.h's version > > takes a type as the input, whereas the harness's version takes a variable! > > Can we just update compiler.h to use typeof() and drop duplicates?
I have no objection to doing so, but I'd prefer any such change go on top. I'd like to get this fixed in 6.16, and as your diff alludes to, I think tools' version of compiler.h should follow the kernel's version (and presumably the below isn't an rc6+ candidate :-) ). > (typeof() a type is a pass-thru). Totally untested: > > diff --git a/include/linux/compiler.h b/include/linux/compiler.h > index 6f04a1d8c720..cb925b883806 100644 > --- a/include/linux/compiler.h > +++ b/include/linux/compiler.h > @@ -347,7 +347,7 @@ static inline void *offset_to_ptr(const int *off) > * Whether 'type' is a signed type or an unsigned type. Supports scalar > types, > * bool and also pointer types. > */ > -#define is_signed_type(type) (((type)(-1)) < (__force type)1) > +#define is_signed_type(type) (((typeof(type))(-1)) < (__force typeof(type))1) > #define is_unsigned_type(type) (!is_signed_type(type)) > > /* > > > -- > Kees Cook