[PATCH v9 04/19] gas: implement parsing of object attributes v2

Matthieu Longo matthieu.longo@arm.com
Thu Nov 20 15:08:43 GMT 2025


On  06/11/2025 17:05, Jan Beulich wrote:
>>>> +  return true;
>>>> +}
>>>> +#endif /* TC_OBJ_ATTR_v2 */
>>>> +
>>>> +#if (TC_OBJ_ATTR_v1)
>>>> +/* Look up attribute tags defined in the backend (object attribute v1).  */
>>>> +static bool
>>>> +obj_attr_v1_lookup_known_attr_tag_symbol (const char *identifier,
>>>> +					  arg_token_t token_type,
>>>> +					  arg_t *val_out)
>>>> +{
>>>> +#ifndef CONVERT_SYMBOLIC_ATTRIBUTE
>>>> +#define CONVERT_SYMBOLIC_ATTRIBUTE(a) -1
>>>> +  (void) identifier;
>>> As indicated in v8 review - the common way is use of ATTRIBUTE_UNUSED.
>> Fixed but unsure about the formatting (see below).
>>
>> diff --git a/gas/config/obj-elf-attr.c b/gas/config/obj-elf-attr.c
>> index 82ec6a79783..b574d46b80c 100644
>> --- a/gas/config/obj-elf-attr.c
>> +++ b/gas/config/obj-elf-attr.c
>> @@ -354,15 +354,16 @@ resolve_if_matching (const char *identifier,
>>    #if (TC_OBJ_ATTR_v1)
>>    /* Look up attribute tags defined in the backend (object attribute
>> v1).  */
>>    static bool
>> -obj_attr_v1_lookup_known_attr_tag_symbol (const char *identifier,
>> -                                         arg_token_t token_type,
>> -                                         arg_t *val_out)
>> -{
>> +obj_attr_v1_lookup_known_attr_tag_symbol (
>>    #ifndef CONVERT_SYMBOLIC_ATTRIBUTE
>> -#define CONVERT_SYMBOLIC_ATTRIBUTE(a) -1
>> -  (void) identifier;
>> +  #define CONVERT_SYMBOLIC_ATTRIBUTE(a) -1
>> +  const char *identifier ATTRIBUTE_UNUSED,
>> +#else
>> +  const char *identifier,
> Well, no. See other uses of ATTRIBUTE_UNUSED: It's applied if any build
> configuration would leave a parameter unused. No #ifdef-ary like this.

If you absolutely want me to not use ATTRIBUTE_UNUSED in this case, how am I supposed to do for targets that don't define CONVERT_SYMBOLIC_ATTRIBUTE like m68k ?
Should I add an empty handle returning -1 in the backend ?

Matthieu


More information about the Binutils mailing list