<i18n dev> RFR: 8289768: Clean up unused code [v2]

Chris Plummer cjplummer at openjdk.org
Thu Jul 7 19:16:48 UTC 2022


On Wed, 6 Jul 2022 05:32:29 GMT, Daniel Jeliński <djelinski at openjdk.org> wrote:

>> This patch removes many unused variables and one unused label reported by the compilers when relevant warnings are enabled. 
>> 
>> The unused code was found by compiling after removing `unused` from the list of disabled warnings for [gcc](https://github.com/openjdk/jdk/blob/master/make/autoconf/flags-cflags.m4#L190) and [clang](https://github.com/openjdk/jdk/blob/master/make/autoconf/flags-cflags.m4#L203), and enabling [C4189](https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-4-c4189?view=msvc-170) MSVC warning.
>> 
>> I only removed variables that were uninitialized or initialized without side effects. I verified that the removed variables were not used in any `#ifdef`'d code. I checked that the changed code still compiles on Windows, Linux and Mac, both in release and debug versions.
>
> Daniel Jeliński 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 four additional commits since the last revision:
> 
>  - Merge remote-tracking branch 'origin' into unused-variables
>  - Remove unused variables (windows)
>  - Remove unused variables (macos)
>  - Remove unused variables (linux)

Are you going to update copyrights?

I reviewed src/jdk.hotspot.agent, src/jdk.jdi/, src/jdk.jdwp.agent, and src/jdk.management. Looks good other than copyrights and the suggestion I made for additional cleanup in symtab.c.

src/jdk.hotspot.agent/linux/native/libsaproc/symtab.c line 308:

> 306:   ELF_SHDR* shbuf = NULL;
> 307:   ELF_SHDR* cursct = NULL;
> 308:   ELF_PHDR* phbuf = NULL;

phbuf is also essentially unused. The only reference is to free it if non-null, but it's always NULL, so that code can be removed too.

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

Changes requested by cjplummer (Reviewer).

PR: https://git.openjdk.org/jdk/pull/9383


More information about the i18n-dev mailing list