On Fri Aug 7, 2026 at 1:33 PM CEST, Jakub Jelinek wrote:
> On Mon, Aug 03, 2026 at 04:13:02PM +0200, Josef Melcr wrote:
>> This patch replaces some of the manual bounds checking done in the
>> callback_only attribute handler with calls to positional_argument.
>> Since positional_argument issues warnings and the attribute handler
>> issues errors, I decided to downgrade the errors to warnings for
>> consistency.
>> 
>> gcc/c-family/ChangeLog:
>> 
>>      * c-attribs.cc (handle_callback_only_attribute): Use
>>      positional_argument for bounds checking in callback_only
>>      attribute handler, downgrade errors to warnings for
>>      consistency.
>> 
>> gcc/testsuite/ChangeLog:
>> 
>>      * gcc.dg/attr-callback.c: Expect warnings instead of errors,
>>      adjust expected messages.
>> 
>> Signed-off-by: Josef Melcr <[email protected]>
>
> LGTM, except a nit.
>
>>        if (!types_compatible_p (expected_type, arg_type))
>>      {
>> -      error_at (DECL_SOURCE_LOCATION (decl),
>> -                "argument type at index %d is not compatible with callback "
>> -                "argument type at index %d",
>> -                arg_idx + 1, curr + 1);
>> +      warning_at (
>> +        DECL_SOURCE_LOCATION (decl), OPT_Wattributes,
>> +        "argument type at index %d is not compatible with callback "
>> +        "argument type at index %d",
>> +        arg_idx + 1, curr + 1);
>
> Please avoid formatting like this unless really necessary (too long
> function name and no way to easily fit it).
> In this case,
>         warning_at (DECL_SOURCE_LOCATION (decl), OPT_Wattributes,
>                     "argument type at index %d is not compatible with "
>                     "callback argument type at index %d",
>                     arg_idx + 1, curr + 1);
> fits just fine.

Commited with the above fixed as r17-3181-g37807a10d8816f, thanks :)

>
>       Jakub

Josef


Reply via email to