Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp3392088lqp; Tue, 26 Mar 2024 08:03:02 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVN+t/ziRn0vgFI/LeGy22WkyAsEg7cQx4LBCePs3T+Te9IO96rWEX4xCr6xDWqjgTBiAsp8Wvr5MFuTqj/nWlv4xaWmuse01rLdIqTNg== X-Google-Smtp-Source: AGHT+IG7IoVGuUUrJHsgzgaFV3s7PRuNA+ceADBHvl/HdNmCgN0ufVJHpDuK5HkwXKtBhiXWqDF8 X-Received: by 2002:a0d:f745:0:b0:611:db2:f6c6 with SMTP id h66-20020a0df745000000b006110db2f6c6mr8069460ywf.5.1711465382482; Tue, 26 Mar 2024 08:03:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711465382; cv=pass; d=google.com; s=arc-20160816; b=gwXHS/bigS/b7TYwu7LIm/yf4iYAvKX9hOFoWGYCh/yvfrV4Knz/b60w/EnZa0pldu GXGIMlvdxkU059MQ2WDSxbl4ptIc4gxGu1Z97+CNuaRp3H6CEBZPHpzAHdN/O4udFzgP YoJMAtYhN6JTNTvDKnXGqXk9N7+d3NKTkAnJWjwgCnBeZKIEQ71ZM4Zmyfx538dJXVjw mUF8oXKYeDLlgFD2yBzj3e4jOQnyO5HizT1aG6NUD4IAFEfKm5QSBrdSEeeRXftEyKoI e95seTGHYUOw10CTXgQE4Q1bTIWNnh3VxHmLxQQGLAyZ97HJjSM3+lU863tX28u531uO OaaQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=nCUCrwJ1Pq86hrNLiRxEzHtvcasoGMMPnpTpVTcaAYw=; fh=sy3BMtItoZlhhhPurNJx7+bajGVxziaGbc0ITU3MLBE=; b=tIavsMIAwccBh1mypxialgElxJp347on7fX/KG6S5/mQtdxdznHsFWjcffBPuMiI6T 6gXspJbGEeb3VunU+X/+IOUxjBniHaXMGJfghRctLZB7n7fFZGnfIiqG3R/5z6SwGleg LbGFzhU6XWf46vOSxmQpRlEPpYTYgyDKtGAG+6lmYmblanvgpLCGj9MeSIm3hgAQoX4t 7Mbo8n+4wytQIrN866qHOVT4YR4zTkTqCiiUmEL/LuvKJ0ZoMLzbb2tMrW9a2ZcAwhS1 RuIwZLZnKKq/NKUGbYLtJW5hfVjBFKrmTRWb9wmrOrCji2R72nI9wgL07cr9iB9jKGR8 93OQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=aWTSU+g5; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-119230-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-119230-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id a124-20020a0df182000000b0060a56d2d5e6si2302886ywf.355.2024.03.26.08.03.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Mar 2024 08:03:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-119230-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=aWTSU+g5; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-119230-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-119230-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 573F01C643D0 for ; Tue, 26 Mar 2024 14:54:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C143313C8F9; Tue, 26 Mar 2024 14:53:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="aWTSU+g5" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C7C9913C8E6; Tue, 26 Mar 2024 14:53:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711464805; cv=none; b=jIUbuPoaVNcEAEfdIbqazevUpyRFJgdxqOwh40eCmMe/F3SuQergCmLsz/ZXazkvS0YNXrC6Mu2uoKxtdNEXYYjW8Rn8I7Hek1iSTSPimpJfpQ9iyj/W7QuIsnsedOLkjdwpjymtU15RaYYhzqgrECyYq2SFBoXHYmH7pnsZj3k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711464805; c=relaxed/simple; bh=FjV1aylvw54HgcRcPH+ncOEHfWZSF7cjGG7LKooAAck=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=n+5F2nmpA/5sq7WnNzKQyUx0pn75w3lP4bYuZxUI12hoMkN6z4r1r2POV+R4A83f+pwGh1eDOK9cYwTcWiVGSoPQ0iymUL3zuS6Pk8T+xFKFt7wlhV+RqbKvCyOyoh6culgagrBKY0nWlcFRJghXhytq361K2V3D7S6VwYcaa2M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=aWTSU+g5; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D02BC43390; Tue, 26 Mar 2024 14:53:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711464805; bh=FjV1aylvw54HgcRcPH+ncOEHfWZSF7cjGG7LKooAAck=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aWTSU+g5YT6X2/viOT6OSnsvQCMADUzH/G6N8TqRwDyL254fJ/riQrZHmhuCc2A+X 5o3HSqemY/camVxz1u9JrAWlkv3zwRBsaJeLlKw91UAC8jSwMUFh6O7mcKlaAU17Sg 0lUpJSnbWUnpzHwON08HffRzzuwD0pwOmTvoLqMvPLEoyExsicoc1LE1iJHUKA5n5x 2w+coKhaiq8CZRyQrZi5waTMSSC3MeGZuyExcMhQ5dfIqWNrYMFZ8SURu1C4TonES2 EpakXZD2yfAefCBpvLJu+AdTtoFmbewvwyRHisxe27AiA36hlufQn0uTi1/lxSNqXS Gs4X7JRpb3vpQ== From: Arnd Bergmann To: linux-kbuild@vger.kernel.org, Masahiro Yamada , Bill Metzenthen , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, Nathan Chancellor Cc: Nicolas Schier , Arnd Bergmann , "H. Peter Anvin" , Nick Desaulniers , Bill Wendling , Justin Stitt , linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH 08/12] x86: math-emu: fix function cast warnings Date: Tue, 26 Mar 2024 15:51:33 +0100 Message-Id: <20240326145140.3257163-7-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240326144741.3094687-1-arnd@kernel.org> References: <20240326144741.3094687-1-arnd@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Arnd Bergmann 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. Link: https://lore.kernel.org/lkml/20240213095631.454543-1-arnd@kernel.org/ Signed-off-by: Arnd Bergmann --- Resending the version from Feb 13, no changes --- arch/x86/math-emu/fpu_etc.c | 9 +++++++-- arch/x86/math-emu/fpu_trig.c | 6 +++--- arch/x86/math-emu/reg_constant.c | 7 ++++++- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/arch/x86/math-emu/fpu_etc.c b/arch/x86/math-emu/fpu_etc.c index 1b118fd93140..39423ec409e1 100644 --- a/arch/x86/math-emu/fpu_etc.c +++ b/arch/x86/math-emu/fpu_etc.c @@ -120,9 +120,14 @@ static void fxam(FPU_REG *st0_ptr, u_char st0tag) setcc(c); } +static void FPU_ST0_illegal(FPU_REG *st0_ptr, u_char st0_tag) +{ + FPU_illegal(); +} + static FUNC_ST0 const fp_etc_table[] = { - fchs, fabs, (FUNC_ST0) FPU_illegal, (FUNC_ST0) FPU_illegal, - ftst_, fxam, (FUNC_ST0) FPU_illegal, (FUNC_ST0) FPU_illegal + fchs, fabs, FPU_ST0_illegal, FPU_ST0_illegal, + ftst_, fxam, FPU_ST0_illegal, FPU_ST0_illegal, }; void FPU_etc(void) diff --git a/arch/x86/math-emu/fpu_trig.c b/arch/x86/math-emu/fpu_trig.c index 990d847ae902..85daf98c81c3 100644 --- a/arch/x86/math-emu/fpu_trig.c +++ b/arch/x86/math-emu/fpu_trig.c @@ -433,13 +433,13 @@ static void fxtract(FPU_REG *st0_ptr, u_char st0_tag) #endif /* PARANOID */ } -static void fdecstp(void) +static void fdecstp(FPU_REG *st0_ptr, u_char st0_tag) { clear_C1(); top--; } -static void fincstp(void) +static void fincstp(FPU_REG *st0_ptr, u_char st0_tag) { clear_C1(); top++; @@ -1631,7 +1631,7 @@ static void fscale(FPU_REG *st0_ptr, u_char st0_tag) static FUNC_ST0 const trig_table_a[] = { f2xm1, fyl2x, fptan, fpatan, - fxtract, fprem1, (FUNC_ST0) fdecstp, (FUNC_ST0) fincstp + fxtract, fprem1, fdecstp, fincstp, }; void FPU_triga(void) 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) -- 2.39.2