RFR: 8294594: Fix cast-function-type warnings in signal handling code

Kim Barrett kbarrett at openjdk.org
Sun Oct 9 01:46:16 UTC 2022


On Thu, 29 Sep 2022 16:12:11 GMT, Aleksey Shipilev <shade 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:

Changes requested by kbarrett (Reviewer).

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.

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

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



More information about the build-dev mailing list