RFR: 8294594: Fix cast-function-type warnings in signal handling code [v2]
Aleksey Shipilev
shade at openjdk.org
Mon Oct 10 12:44:57 UTC 2022
On Sun, 9 Oct 2022 02:57:36 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:
>> 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!
:facepalm:
-------------
PR: https://git.openjdk.org/jdk/pull/10494
More information about the build-dev
mailing list