On Sun, 22 Dec 2024 02:38:31 GMT, SendaoYan <s...@openjdk.org> wrote:
>> Hi all, >> File src/java.smartcardio/share/native/libj2pcsc/pcsc.c and >> src/jdk.crypto.cryptoki/share/native/libj2pkcs11/j2secmod.h generate compile >> warning `'dprintf' macro redefined` by clang17/llvm17 with fastdebug >> configure. This PR rename dprintf to debug_printf and make it variadic, to >> avoid deplication macro definition to linux header >> `/usr/include/bits/stdio2.h`, risk is low. >> >> Additional testing: >> >> - [x] build with fastdebug and release configure by gcc14 on linux-x64 >> - [x] jtreg tests(include tier1/2/3 etc.) on linux-x64 with release build >> - [x] jtreg tests(include tier1/2/3 etc.) on linux-x64 with fastdebug build >> - [x] jtreg tests(include tier1/2/3 etc.) on linux-aarch64 with release build >> - [x] jtreg tests(include tier1/2/3 etc.) on linux-aarch64 with fastdebug >> build > > 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 Looks good to me, but you should get reviews from folks directly involved in the relevant areas. 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. ------------- Marked as reviewed by kbarrett (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/22630#pullrequestreview-2521159879 PR Review Comment: https://git.openjdk.org/jdk/pull/22630#discussion_r1896134688