[PATCH 26/59] stdio: Fix -Wtautological-constant-out-of-range-compare on clang

Collin Funk collin.funk1@gmail.com
Mon Oct 20 19:16:19 GMT 2025


Adhemerval Zanella Netto <adhemerval.zanella@linaro.org> writes:

>>> -	  if (spec <= UCHAR_MAX
>>> +# ifdef COMPILE_WPRINTF
>>> +#  define CHECK_SPEC(spec) ((spec) <= UCHAR_MAX)
>>> +# else
>>> +#  define CHECK_SPEC(spec) (true)
>>> +# endif
>>> +	  if (CHECK_SPEC (spec)
>>>  	      && __printf_function_table != NULL
>>>  	      && __printf_function_table[(size_t) spec] != NULL)
>>>  	    {
>> 
>> Can we just disable this warning? Anecdotally, it is only triggered in
>> Gnulib in code that is needed for portability. I can't recall a time
>> where I found it useful.
>
> I think we can, but we only disable some specific warnings for testing
> (like stack protector or fortify sources), and I have added for some warnings 
> that are not supported by clang (like -Wno-ignored-attributes).
>
> But I think we should try to cope with the compiler defaults from -Wall instead
> of messing with warning specifically.  The managements of what enable/disable
> becomes quite complex with different gcc version and possible now with different 
> clang version as well.

Sure, makes sense. Your patch is fine with me then.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>

Thanks,
Collin


More information about the Libc-alpha mailing list