Hi Joseph,

On Mon, Nov 17, 2025 at 10:21:27PM +0000, Joseph Myers wrote:
> On Sun, 16 Nov 2025, Alejandro Colomar wrote:
> 
> > Allow it syntactically, but diagnose it with a new -Wmaxof-bool, enabled
> > by -Wextra.
> 
> I don't see much reason for this option, and certainly not for including 
> it in -Wextra.


>  Warning for this feature implies someone might write code 
> that (a) uses this feature (probably in type-generic macros), (b) does so 
> on bool, and (c) does not in fact expect to get the answers 1 and 0 from 
> applying it to bool, or is somehow applying it to bool accidentally and 
> unintentionally in a context that won't actually work for bool.

I agree with a, b, and c.  From c, I think the second alternative is the
one I'm worried about: applying it accidentally and unintentionally in
a context that wouldn't work for bool.

> Warnings shouldn't be in -Wextra simply because of not seeing a use for a 
> particular feature or combination of features, there should be some reason 
> to believe that the use of the feature actually indicates a defect in the 
> code (whether one that makes it misbehave at runtime, or simply one that 
> indicates that code not using that feature would in some way be cleaner).

I'm okay with removing it from -Wextra.  After all, I don't expect this
feature to be common enough to matter that much.  A dangling warning
flag should be okay.

Also, macros that do type-generic stuff and use _Maxof() and/or _Minof
are likely to also use _Generic() for other parts of the macro.  That
_Generic() selector will likely reject bool if it doesn't belong there,
so maybe the diagnostic is superfluous.  I'll remove the diagnostic
entirely.


Have a lovely night!
Alex

-- 
<https://www.alejandro-colomar.es>
Use port 80 (that is, <...:80/>).

Attachment: signature.asc
Description: PGP signature

Reply via email to