summaryrefslogtreecommitdiff
path: root/arch/x86/math-emu/reg_constant.c
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2024-04-04 19:17:24 +0300
committerBorislav Petkov (AMD) <bp@alien8.de>2024-04-08 17:06:22 +0300
commite0ca9353a86c0459a9c3fc8d65f7c88e96217cea (patch)
tree4ab1f632edf4336d32744c3b4aa290ff51fba39e /arch/x86/math-emu/reg_constant.c
parentcb517619f96718a4c3c2534a3124177633f8998d (diff)
downloadlinux-e0ca9353a86c0459a9c3fc8d65f7c88e96217cea.tar.xz
x86/math-emu: Fix function cast warnings
clang-16 warns about casting function pointers with incompatible prototypes. The x86 math-emu code does this in a number of places to call some trivial functions that need no arguments: arch/x86/math-emu/fpu_etc.c:124:14: error: cast from 'void (*)(void)' to 'FUNC_ST0' \ (aka 'void (*)(struct fpu__reg *, unsigned char)') converts to incompatible function \ type [-Werror,-Wcast-function-type-strict] 124 | fchs, fabs, (FUNC_ST0) FPU_illegal, (FUNC_ST0) FPU_illegal, | ^~~~~~~~~~~~~~~~~~~~~~ arch/x86/math-emu/fpu_trig.c:1634:19: error: cast from 'void (*)(void)' to 'FUNC_ST0' \ (aka 'void (*)(struct fpu__reg *, unsigned char)') converts to incompatible function \ type [-Werror,-Wcast-function-type-strict] 1634 | fxtract, fprem1, (FUNC_ST0) fdecstp, (FUNC_ST0) fincstp | ^~~~~~~~~~~~~~~~~~ arch/x86/math-emu/reg_constant.c:112:53: error: cast from 'void (*)(void)' to 'FUNC_RC' \ (aka 'void (*)(int)') converts to incompatible function \ type [-Werror,-Wcast-function-type-strict] 112 | fld1, fldl2t, fldl2e, fldpi, fldlg2, fldln2, fldz, (FUNC_RC) FPU_illegal Change the fdecstp() and fincstp() functions to actually have the correct prototypes based on the caller, and add wrappers around FPU_illegal() for adapting those. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Link: https://lore.kernel.org/lkml/20240213095631.454543-1-arnd@kernel.org
Diffstat (limited to 'arch/x86/math-emu/reg_constant.c')
-rw-r--r--arch/x86/math-emu/reg_constant.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/arch/x86/math-emu/reg_constant.c b/arch/x86/math-emu/reg_constant.c
index 742619e94bdf..003a0b2753e6 100644
--- a/arch/x86/math-emu/reg_constant.c
+++ b/arch/x86/math-emu/reg_constant.c
@@ -108,8 +108,13 @@ static void fldz(int rc)
typedef void (*FUNC_RC) (int);
+static void FPU_RC_illegal(int unused)
+{
+ FPU_illegal();
+}
+
static FUNC_RC constants_table[] = {
- fld1, fldl2t, fldl2e, fldpi, fldlg2, fldln2, fldz, (FUNC_RC) FPU_illegal
+ fld1, fldl2t, fldl2e, fldpi, fldlg2, fldln2, fldz, FPU_RC_illegal
};
void fconst(void)