RFR: 8355904: Use variadic macros for J2dTrace [v2]
Alexey Ushakov
avu at openjdk.org
Mon May 12 07:58:53 UTC 2025
On Wed, 30 Apr 2025 06:15:33 GMT, Nikita Gubarkov <ngubarkov at openjdk.org> wrote:
>> src/java.desktop/share/native/libawt/java2d/Trace.h line 58:
>>
>>> 56: #ifndef DEBUG
>>> 57: #define J2dTrace(level, ...)
>>> 58: #define J2dTraceLn(level, ...)
>>
>> This looks fine, but maybe the string argument could be included as a parameter? Would that improve usability, like better error messages when no arguments are provided, or enhance auto-completion in the IDE?"
>
> There is a trailing comma problem when passing no extra args. I didn't figure out how to solve it without `__VA_OPT__` or compiler-specific tricks, so I moved the string into variadic part, so that it always has at least one parameter.
I think that the benefits (having an arbitrary number of arguments) outweigh the lack of a check for the string argument type. So, I'd let's put some comments here about future use of __VA_OPT__ and integrate this change.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24949#discussion_r2084052837
More information about the client-libs-dev
mailing list