RFR: 8355904: Use variadic macros for J2dTrace [v2]

Sergey Bylokhov serb at openjdk.org
Wed Apr 30 03:19:46 UTC 2025


On Tue, 29 Apr 2025 14:04:07 GMT, Nikita Gubarkov <ngubarkov at openjdk.org> wrote:

>> J2dTrace macros have multiple overloads specifying number of arguments, making it less convent to change number of arguments. There were cases when existing macros were not enough and people had to add new variants with even more arguments. We could simply use variadic macros instead.
>> 
>> Also, currently those macros expand to a { code block }, which doesn't require a semicolon at the end, so it can sometimes be missed, leading to an inconsistent code style. We could expand it directly to the function, forcing user to insert a semicolon after that, in a function-like style.
>
> Nikita Gubarkov has updated the pull request incrementally with one additional commit since the last revision:
> 
>   fixup! 8355904: Use variadic macros for J2dTrace

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?"

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/24949#discussion_r2067790343


More information about the client-libs-dev mailing list