On 27.11.2025 15:06, Alejandro Vallejo wrote: > On Thu Nov 27, 2025 at 2:37 PM CET, Jan Beulich wrote: >> On 27.11.2025 14:15, Alejandro Vallejo wrote: >>> On Thu Nov 27, 2025 at 11:46 AM CET, Jan Beulich wrote: >>>> First: Would one ever pass X86_VENDOR_UNKNOWN for "vendor"? The next patch, >>>> for example, specifically doesn't. >>> >>> I don't think so. There's definitely not any existing case atm. Still, I >>> think >>> it's better to preserve the invariant that the follwing transformation: >>> >>> from: cp->x86_vendor == X86_VENDOR_X >>> to: x86_vendor_is(cp->x86_vendor, X86_VENDOR_X) >>> >>> holds for every vendor variant in the "everything compiled-in" case. >> >> Otoh the code could be simplified if you simply rejected the passing of >> X86_VENDOR_UNKNOWN. > > How would this rejection go? Something like this at the top? > > if ( vendor == X86_VENDOR_UNKNOWN ) > BUG(); > > I'd rather have something that causes a compile-time error, but I'm not sure > how to cause a compile time failure when a constant matches FOO. > > Surely there must be a way...
Take a look at BUILD_ERROR(), which I think may fit here. Jan
