diff options
author | Arnd Bergmann <arnd@arndb.de> | 2021-03-22 22:48:19 +0100 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2021-03-23 00:08:02 +0100 |
commit | 279d56abc67ed7568168cb31bf1c7d735efc89a7 (patch) | |
tree | 891e7ae36f9ae40330a4cd52e2b8d20c88c5adbd /arch/x86/math-emu | |
parent | 396a66aa1172ef2b78c21651f59b40b87b2e5e1e (diff) | |
download | linux-stable-279d56abc67ed7568168cb31bf1c7d735efc89a7.tar.gz linux-stable-279d56abc67ed7568168cb31bf1c7d735efc89a7.tar.bz2 linux-stable-279d56abc67ed7568168cb31bf1c7d735efc89a7.zip |
x86/fpu/math-emu: Fix function cast warning
Building with 'make W=1', gcc points out that casting between
incompatible function types can be dangerous:
arch/x86/math-emu/fpu_trig.c:1638:60: error: cast between incompatible function types from ‘int (*)(FPU_REG *, u_char)’ {aka ‘int (*)(struct fpu__reg *, unsigned char)’} to ‘void (*)(FPU_REG *, u_char)’ {aka ‘void (*)(struct fpu__reg *, unsigned char)’} [-Werror=cast-function-type]
1638 | fprem, fyl2xp1, fsqrt_, fsincos, frndint_, fscale, (FUNC_ST0) fsin, fcos
| ^
This one seems harmless, but it is easy enough to work around it by
adding an intermediate function that adjusts the return type.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20210322214824.974323-1-arnd@kernel.org
Diffstat (limited to 'arch/x86/math-emu')
-rw-r--r-- | arch/x86/math-emu/fpu_trig.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/arch/x86/math-emu/fpu_trig.c b/arch/x86/math-emu/fpu_trig.c index 4a9887851ad8..990d847ae902 100644 --- a/arch/x86/math-emu/fpu_trig.c +++ b/arch/x86/math-emu/fpu_trig.c @@ -547,7 +547,7 @@ static void frndint_(FPU_REG *st0_ptr, u_char st0_tag) single_arg_error(st0_ptr, st0_tag); } -static int fsin(FPU_REG *st0_ptr, u_char tag) +static int f_sin(FPU_REG *st0_ptr, u_char tag) { u_char arg_sign = getsign(st0_ptr); @@ -608,6 +608,11 @@ static int fsin(FPU_REG *st0_ptr, u_char tag) } } +static void fsin(FPU_REG *st0_ptr, u_char tag) +{ + f_sin(st0_ptr, tag); +} + static int f_cos(FPU_REG *st0_ptr, u_char tag) { u_char st0_sign; @@ -724,7 +729,7 @@ static void fsincos(FPU_REG *st0_ptr, u_char st0_tag) } reg_copy(st0_ptr, &arg); - if (!fsin(st0_ptr, st0_tag)) { + if (!f_sin(st0_ptr, st0_tag)) { push(); FPU_copy_to_reg0(&arg, st0_tag); f_cos(&st(0), st0_tag); @@ -1635,7 +1640,7 @@ void FPU_triga(void) } static FUNC_ST0 const trig_table_b[] = { - fprem, fyl2xp1, fsqrt_, fsincos, frndint_, fscale, (FUNC_ST0) fsin, fcos + fprem, fyl2xp1, fsqrt_, fsincos, frndint_, fscale, fsin, fcos }; void FPU_trigb(void) |