RFR: 8294594: Fix cast-function-type warnings in signal handling code
Kim Barrett
kbarrett at openjdk.org
Sun Oct 9 03:00:09 UTC 2022
On Sun, 9 Oct 2022 01:43:26 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:
>> After [JDK-8294314](https://bugs.openjdk.org/browse/JDK-8294314), we would have signals_posix.cpp excluded with cast-function-type warning:
>
> test/hotspot/gtest/runtime/test_signals.cpp line 49:
>
>> 47: static void check_handlers() {
>> 48: struct sigaction act, old_SIGFPE_act, old_SIGILL_act;
>> 49: act.sa_handler = CAST_FROM_FN_PTR(sa_handler_t, sig_handler);
>
> This is similarly wrong code that should be fixed instead of doing weird casting dances. The problem here is that sig_handler has the wrong signature. It should be just `void sig_handler(int)`. Fix that and not casts needed.
This one is even worse than the other. Here we're installing a handler function taking 3 arguments in such a way that it will only be called with one. Weee!
-------------
PR: https://git.openjdk.org/jdk/pull/10494
More information about the build-dev
mailing list