RFR: 8345757: [ASAN] clang17 report 'dprintf' macro redefined [v4]

SendaoYan syan at openjdk.org
Tue Dec 24 02:08:45 UTC 2024


On Mon, 23 Dec 2024 21:28:41 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

>> SendaoYan has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains five additional commits since the last revision:
>> 
>>  - Merge branch 'openjdk:master' into jbs8345757
>>  - rename dprintf to debug_printf and make it variadic
>>  - add comments // GNU, POSIX.1-2008
>>  - Merge branch 'openjdk:master' into jbs8345757
>>  - 8345757: [ASAN] clang17 report dprintf macro redefined
>
> src/java.smartcardio/share/native/libj2pcsc/pcsc.c line 43:
> 
>> 41: 
>> 42: #ifdef J2PCSC_DEBUG
>> 43: #define debug_printf(format, ...) printf(format, ##__VA_ARGS__)
> 
> `##__VA_ARGS__` is a gcc extension that is also supported by clang and MSVC++
> (for MSVC++, maybe only with recent versions or necessary flags that we're
> using?). The standard way to accomplish this sort of thing is `__VA_OPT__`,
> but that's a C++20/C23 feature, so not available to us. It seems we're already
> using that extension in over 50 places in the JDK (nearly a dozon in HotSpot).
> So okay.
> 
> Though I think `debug_printf(...) printf(__VA_ARGS__)` instead would work in
> this case.  It's not quite as nicely self-documenting though.

Thanks for the detailed explanation and analysis.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22630#discussion_r1896286428


More information about the build-dev mailing list