[PATCH 1/3] objcopy: avoid gcc extension using __VA_ARGS__
Jan Beulich
jbeulich@suse.com
Mon Dec 8 07:25:38 GMT 2025
On 05.12.2025 16:14, Jens Remus wrote:
> On 12/5/2025 2:32 PM, Jan Beulich wrote:
>> We shouldn't be using extensions when we don't have a suitable fallback in
>> place. Introduce a sibling macro taking a plain string, without any
>> arguments to format.
>> ---
>> On the grounds that this is (generally disabled) debugging code only, we
>> could of course consider this use of an extension acceptable.
>>
>> --- a/binutils/objcopy.c
>> +++ b/binutils/objcopy.c
>> @@ -2023,9 +2023,11 @@ typedef struct objcopy_internal_note
>> #define DEBUG_MERGE 0
>>
>> #if DEBUG_MERGE
>> -#define merge_debug(format, ...) fprintf (stderr, format, ## __VA_ARGS__)
>> +#define merge_debug(format, ...) fprintf (stderr, format, __VA_ARGS__)
>> +#define merge_debug0(msg) fprintf (stderr, "%s", msg)
>
> Using the following would make all other changes unnecessary:
>
> #define merge_debug(...) fprintf (stderr, __VA_ARGS__)
>
> Not sure which variant is cleaner though. I don't like that format is
> then "hidden" in the variable argument list.
Yeah, I did think of this as a possible alternative, but I didn't like it
clearly better than what I posted.
Jan
More information about the Binutils
mailing list