RFR: 8339714: Delete tedious bool type define
Julian Waters
jwaters at openjdk.org
Mon Sep 9 12:10:09 UTC 2024
On Mon, 9 Sep 2024 09:50:59 GMT, SendaoYan <syan at openjdk.org> wrote:
> Hi all,
> This PR delete tedious bool type define in `src/java.base/unix/native/libjsig/jsig.c` and `src/utils/hsdis/binutils/hsdis-binutils.c`. After JEP 347([JDK-8246032](https://bugs.openjdk.org/browse/JDK-8246032)), I think we can "#include <stdbool.h>" to use bool type directly, like [string.h](https://github.com/openjdk/jdk/blob/master/src/java.desktop/unix/native/libpipewire/include/spa/utils/string.h#L13) do.
> Make code more concision, the risk is quite low.
>
> Additional testing:
>
> - [x] Local build with --with-hsdis=binutils --with-binutils=$HOME/software/binutils
> - [ ] Jtreg tests(include tier1/tier2/tier3 etc.) on linux x64
> - [ ] Jtreg tests(include tier1/tier2/tier3 etc.) on linux aarch64
Hmm. While I want to put my support behind this change, I recall that an earlier proposal that I made to implement jbooleans with stdbool.h being rejected due to backwards incompatibility, and some places really do expect an int and not a bool type. What are the likelihoods that a place in the code here is actually expecting an int due to ABI issues?
src/java.base/unix/native/libjsig/jsig.c line 46:
> 44: #include <string.h>
> 45:
> 46: #if (__STDC_VERSION__ >= 199901L)
Since this does include stdbool.h already, this change looks ok
src/utils/hsdis/binutils/hsdis-binutils.c line 67:
> 65: #include "hsdis.h"
> 66:
> 67: #ifndef bool
I'm a little worried about this change. hsdis may really need an int here. If that turns out to not be the case then I'll retract my concerns
-------------
PR Comment: https://git.openjdk.org/jdk/pull/20909#issuecomment-2337942768
PR Review Comment: https://git.openjdk.org/jdk/pull/20909#discussion_r1750135891
PR Review Comment: https://git.openjdk.org/jdk/pull/20909#discussion_r1750137910
More information about the core-libs-dev
mailing list