RFR: 8339120: Use more fine-granular gcc unused warnings [v2]
Magnus Ihse Bursie
ihse at openjdk.org
Wed Aug 28 12:34:29 UTC 2024
On Wed, 28 Aug 2024 11:26:01 GMT, Magnus Ihse Bursie <ihse at openjdk.org> wrote:
>> make/autoconf/flags-cflags.m4 line 239:
>>
>>> 237: # Additional warnings that are not activated by -Wall and -Wextra
>>> 238: WARNINGS_ENABLE_ADDITIONAL="-Wpointer-arith -Wreturn-type -Wsign-compare \
>>> 239: -Wtrampolines -Wundef -Wunused-const-variable -Wunused-function \
>>
>> I think we don't want `-Wunused-const-variable=2` (eqv. `-Wunused-const-variable`) for C++
>> code. Recall that C++ const variables default to internal linkage (e.g. implicitly static). It's normal
>> to have a non-local constant in a header file that isn't used by every translation unit. For C++ use
>> `-Wunused-const-variable=1`. I think doing this might eliminate the need for disabling this warning
>> in a bunch of other places in this PR.
>
> Good point, I'll try that.
It turned out to be sort-of okay-ish. I explicitly listed like 6 or so per-file exclusions in Hotspot (even though my normal cutoff for just setting a component-wide exclude is 3-4) since it seems that you will want to look at and fix those.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20733#discussion_r1734588979
More information about the build-dev
mailing list