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

Kim Barrett kbarrett at openjdk.org
Sat Dec 21 16:14:39 UTC 2024


On Sat, 21 Dec 2024 03:34:34 GMT, SendaoYan <syan at 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 undefine `dprintf` before define dprintf macro, 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 incrementally with one additional commit since the last revision:
> 
>   add comments // GNU, POSIX.1-2008

Changes requested by kbarrett (Reviewer).

src/java.smartcardio/share/native/libj2pcsc/pcsc.c line 48:

> 46: #define dprintf3(s, p1, p2, p3) printf(s, p1, p2, p3)
> 47: #else
> 48: #undef dprintf // GNU, POSIX.1-2008

Shouldn't this be before the `#ifdef J2PSC_DEBUG`?  Otherwise, we'll get the same problem when
debugging is enabled.

src/jdk.crypto.cryptoki/share/native/libj2pkcs11/j2secmod.h line 45:

> 43: #define dprintf3(s, p1, p2, p3) printf(s, p1, p2, p3)
> 44: #else
> 45: #undef dprintf // GNU, POSIX.1-2008

Shouldn't this be before the #ifdef SECMOD_DEBUG? Otherwise, we'll get the same problem when
debugging is enabled.

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

PR Review: https://git.openjdk.org/jdk/pull/22630#pullrequestreview-2518682741
PR Review Comment: https://git.openjdk.org/jdk/pull/22630#discussion_r1894650837
PR Review Comment: https://git.openjdk.org/jdk/pull/22630#discussion_r1894650978


More information about the build-dev mailing list