RFR: 8339156: Use more fine-granular clang unused warnings

Kim Barrett kbarrett at openjdk.org
Thu Aug 29 18:48:20 UTC 2024


On Thu, 29 Aug 2024 13:14:35 GMT, Magnus Ihse Bursie <ihse at openjdk.org> wrote:

> Currently, we issue -Wno-unused for all files in clang, which is a rather big sledgehammer to get rid of some warnings that proliferate in a few areas of the build.
> 
> We should instead leave -Wunused turned on (as done by -Wall) and use a much more fine-grained approach to disabling specific warnings in specific files or libraries.
> 
> This is similar to what has been done for gcc in JDK-8339120.

Looks good.

make/autoconf/flags-cflags.m4 line 266:

> 264:       # These warnings will never be turned on, since they generate too many
> 265:       # false positives.
> 266:       DISABLED_WARNINGS="unknown-warning-option unused-parameter"

JDK-8339120 added -Wunused-const-variable=1 and -Wunused-result to gcc's
WARNINGS_ENABLE_ADDITIONAL, to "make up" for the corresponding removal of
disabling -Wunused. That isn't done here. I assume that was intentional,
probably to avoid needing more of the specific disables in this PR. That's
fine. We can do more warning option cleanups later in conjunction with
corresponding code changes.

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

Marked as reviewed by kbarrett (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/20770#pullrequestreview-2269819308
PR Review Comment: https://git.openjdk.org/jdk/pull/20770#discussion_r1736918417


More information about the core-libs-dev mailing list