RFR: 8308286 Fix clang warnings in linux code

Kim Barrett kbarrett at openjdk.org
Sun May 28 04:14:04 UTC 2023

On Wed, 17 May 2023 12:28:47 GMT, Artem Semenov <asemenov at openjdk.org> wrote:

> When using the clang compiler to build OpenJDk on Linux, we encounter various "warnings as errors".
> They can be fixed with small changes.

All of the -Wformat-nonliteral changes make me wonder why we're seeing these
with clang but not with gcc.  Figuring that out will likely give a better
chance of acceptance.

src/java.desktop/unix/native/libawt_xawt/awt/gtk2_interface.c line 1163:

> 1161: #if defined(__clang__)
> 1162: #pragma clang diagnostic push
> 1163: #pragma clang diagnostic ignored "-Wparentheses"

I think this warning is because of the several `if (init_result = ...)`?  Better would be to just add the extra parens.

src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c line 575:

> 573: if (ps_pdread(ph, (char *)link_map_addr + LINK_MAP_LD_OFFSET,
> 574:                &lib_ld, sizeof(uintptr_t)) != PS_OK) {
> 575: #else

What problem is being "fixed" by these?  I'm dubious that this is the best solution to whatever the problem
is, but can't evaluate or suggest alternatives without knowing what it is.


Changes requested by kbarrett (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/14033#pullrequestreview-1447852014
PR Review Comment: https://git.openjdk.org/jdk/pull/14033#discussion_r1208298799
PR Review Comment: https://git.openjdk.org/jdk/pull/14033#discussion_r1208302906

More information about the security-dev mailing list