From: Nathan Chancellor <nathan@kernel.org>
To: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Michael Ellerman <mpe@ellerman.id.au>,
Nicholas Piggin <npiggin@gmail.com>,
linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH v2 2/2] powerpc/math-emu: Remove -w build flag and fix warnings
Date: Fri, 2 Sep 2022 08:37:23 -0700 [thread overview]
Message-ID: <YxIjM/jdLajq4dFk@dev-arch.thelio-3990X> (raw)
In-Reply-To: <35c86b7ca823954c6cd593acc3690dc3748da9b1.1662113301.git.christophe.leroy@csgroup.eu>
Hi Christophe,
On Fri, Sep 02, 2022 at 12:08:55PM +0200, Christophe Leroy wrote:
> As reported by Nathan, the module_init() macro was not taken into
> account because the header was missing. That means spe_mathemu_init()
> was never called.
>
> This should have been detected by gcc at build time, but due to
> '-w' flag it went undetected.
>
> Removing that flag leads to many warnings hence errors.
>
> Fix those warnings then remove the -w flag.
>
> Reported-by: Nathan Chancellor <nathan@kernel.org>
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Thanks for figuring out what was going on here! I took this patch for a
spin with clang and it has a few more errors around
-Wimplicit-fallthrough:
arch/powerpc/math-emu/fctiw.c:18:2: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
FP_TO_INT_D(r, B, 32, 1);
^
./include/math-emu/double.h:120:34: note: expanded from macro 'FP_TO_INT_D'
#define FP_TO_INT_D(r,X,rsz,rsg) _FP_TO_INT(D,2,r,X,rsz,rsg)
^
./include/math-emu/op-common.h:665:4: note: expanded from macro '_FP_TO_INT'
case FP_CLS_ZERO: \
^
arch/powerpc/math-emu/fctiw.c:18:2: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
./include/math-emu/double.h:120:34: note: expanded from macro 'FP_TO_INT_D'
#define FP_TO_INT_D(r,X,rsz,rsg) _FP_TO_INT(D,2,r,X,rsz,rsg)
^
./include/math-emu/op-common.h:671:4: note: expanded from macro '_FP_TO_INT'
case FP_CLS_NAN: \
^
2 errors generated.
arch/powerpc/math-emu/fctiwz.c:23:2: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
FP_TO_INT_D(r, B, 32, 1);
^
./include/math-emu/double.h:120:34: note: expanded from macro 'FP_TO_INT_D'
#define FP_TO_INT_D(r,X,rsz,rsg) _FP_TO_INT(D,2,r,X,rsz,rsg)
^
./include/math-emu/op-common.h:665:4: note: expanded from macro '_FP_TO_INT'
case FP_CLS_ZERO: \
^
arch/powerpc/math-emu/fctiwz.c:23:2: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
./include/math-emu/double.h:120:34: note: expanded from macro 'FP_TO_INT_D'
#define FP_TO_INT_D(r,X,rsz,rsg) _FP_TO_INT(D,2,r,X,rsz,rsg)
^
./include/math-emu/op-common.h:671:4: note: expanded from macro '_FP_TO_INT'
case FP_CLS_NAN: \
^
2 errors generated.
make[3]: *** [scripts/Makefile.build:249: arch/powerpc/math-emu/fctiw.o] Error 1
make[3]: *** [scripts/Makefile.build:249: arch/powerpc/math-emu/fctiwz.o] Error 1
arch/powerpc/math-emu/math_efp.c:282:5: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
FP_TO_INT_ROUND_S(vc.wp[1], SB, 32,
^
./include/math-emu/single.h:110:40: note: expanded from macro 'FP_TO_INT_ROUND_S'
#define FP_TO_INT_ROUND_S(r,X,rsz,rsg) _FP_TO_INT_ROUND(S,1,r,X,rsz,rsg)
^
./include/math-emu/op-common.h:770:4: note: expanded from macro '_FP_TO_INT_ROUND'
case FP_CLS_NAN: \
^
arch/powerpc/math-emu/math_efp.c:305:5: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
FP_TO_INT_ROUND_S(vc.wp[1], SB, 32,
^
./include/math-emu/single.h:110:40: note: expanded from macro 'FP_TO_INT_ROUND_S'
#define FP_TO_INT_ROUND_S(r,X,rsz,rsg) _FP_TO_INT_ROUND(S,1,r,X,rsz,rsg)
^
./include/math-emu/op-common.h:770:4: note: expanded from macro '_FP_TO_INT_ROUND'
case FP_CLS_NAN: \
^
arch/powerpc/math-emu/math_efp.c:316:5: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
FP_TO_INT_S(vc.wp[1], SB, 32,
^
./include/math-emu/single.h:109:34: note: expanded from macro 'FP_TO_INT_S'
#define FP_TO_INT_S(r,X,rsz,rsg) _FP_TO_INT(S,1,r,X,rsz,rsg)
^
./include/math-emu/op-common.h:665:4: note: expanded from macro '_FP_TO_INT'
case FP_CLS_ZERO: \
^
arch/powerpc/math-emu/math_efp.c:316:5: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
./include/math-emu/single.h:109:34: note: expanded from macro 'FP_TO_INT_S'
#define FP_TO_INT_S(r,X,rsz,rsg) _FP_TO_INT(S,1,r,X,rsz,rsg)
^
./include/math-emu/op-common.h:671:4: note: expanded from macro '_FP_TO_INT'
case FP_CLS_NAN: \
^
arch/powerpc/math-emu/math_efp.c:413:5: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
FP_TO_INT_ROUND_D(vc.wp[1], DB, 32,
^
./include/math-emu/double.h:121:40: note: expanded from macro 'FP_TO_INT_ROUND_D'
#define FP_TO_INT_ROUND_D(r,X,rsz,rsg) _FP_TO_INT_ROUND(D,2,r,X,rsz,rsg)
^
./include/math-emu/op-common.h:770:4: note: expanded from macro '_FP_TO_INT_ROUND'
case FP_CLS_NAN: \
^
arch/powerpc/math-emu/math_efp.c:436:5: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
FP_TO_INT_D(vc.dp[0], DB, 64,
^
./include/math-emu/double.h:120:34: note: expanded from macro 'FP_TO_INT_D'
#define FP_TO_INT_D(r,X,rsz,rsg) _FP_TO_INT(D,2,r,X,rsz,rsg)
^
./include/math-emu/op-common.h:665:4: note: expanded from macro '_FP_TO_INT'
case FP_CLS_ZERO: \
^
arch/powerpc/math-emu/math_efp.c:436:5: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
./include/math-emu/double.h:120:34: note: expanded from macro 'FP_TO_INT_D'
#define FP_TO_INT_D(r,X,rsz,rsg) _FP_TO_INT(D,2,r,X,rsz,rsg)
^
./include/math-emu/op-common.h:671:4: note: expanded from macro '_FP_TO_INT'
case FP_CLS_NAN: \
^
arch/powerpc/math-emu/math_efp.c:447:5: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
FP_TO_INT_ROUND_D(vc.wp[1], DB, 32,
^
./include/math-emu/double.h:121:40: note: expanded from macro 'FP_TO_INT_ROUND_D'
#define FP_TO_INT_ROUND_D(r,X,rsz,rsg) _FP_TO_INT_ROUND(D,2,r,X,rsz,rsg)
^
./include/math-emu/op-common.h:770:4: note: expanded from macro '_FP_TO_INT_ROUND'
case FP_CLS_NAN: \
^
arch/powerpc/math-emu/math_efp.c:458:5: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
FP_TO_INT_D(vc.wp[1], DB, 32,
^
./include/math-emu/double.h:120:34: note: expanded from macro 'FP_TO_INT_D'
#define FP_TO_INT_D(r,X,rsz,rsg) _FP_TO_INT(D,2,r,X,rsz,rsg)
^
./include/math-emu/op-common.h:665:4: note: expanded from macro '_FP_TO_INT'
case FP_CLS_ZERO: \
^
arch/powerpc/math-emu/math_efp.c:458:5: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
./include/math-emu/double.h:120:34: note: expanded from macro 'FP_TO_INT_D'
#define FP_TO_INT_D(r,X,rsz,rsg) _FP_TO_INT(D,2,r,X,rsz,rsg)
^
./include/math-emu/op-common.h:671:4: note: expanded from macro '_FP_TO_INT'
case FP_CLS_NAN: \
^
arch/powerpc/math-emu/math_efp.c:573:5: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
FP_TO_INT_ROUND_S(vc.wp[0], SB0, 32,
^
./include/math-emu/single.h:110:40: note: expanded from macro 'FP_TO_INT_ROUND_S'
#define FP_TO_INT_ROUND_S(r,X,rsz,rsg) _FP_TO_INT_ROUND(S,1,r,X,rsz,rsg)
^
./include/math-emu/op-common.h:770:4: note: expanded from macro '_FP_TO_INT_ROUND'
case FP_CLS_NAN: \
^
arch/powerpc/math-emu/math_efp.c:581:5: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
FP_TO_INT_ROUND_S(vc.wp[1], SB1, 32,
^
./include/math-emu/single.h:110:40: note: expanded from macro 'FP_TO_INT_ROUND_S'
#define FP_TO_INT_ROUND_S(r,X,rsz,rsg) _FP_TO_INT_ROUND(S,1,r,X,rsz,rsg)
^
./include/math-emu/op-common.h:770:4: note: expanded from macro '_FP_TO_INT_ROUND'
case FP_CLS_NAN: \
^
arch/powerpc/math-emu/math_efp.c:592:5: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
FP_TO_INT_ROUND_S(vc.wp[0], SB0, 32,
^
./include/math-emu/single.h:110:40: note: expanded from macro 'FP_TO_INT_ROUND_S'
#define FP_TO_INT_ROUND_S(r,X,rsz,rsg) _FP_TO_INT_ROUND(S,1,r,X,rsz,rsg)
^
./include/math-emu/op-common.h:770:4: note: expanded from macro '_FP_TO_INT_ROUND'
case FP_CLS_NAN: \
^
arch/powerpc/math-emu/math_efp.c:599:5: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
FP_TO_INT_ROUND_S(vc.wp[1], SB1, 32,
^
./include/math-emu/single.h:110:40: note: expanded from macro 'FP_TO_INT_ROUND_S'
#define FP_TO_INT_ROUND_S(r,X,rsz,rsg) _FP_TO_INT_ROUND(S,1,r,X,rsz,rsg)
^
./include/math-emu/op-common.h:770:4: note: expanded from macro '_FP_TO_INT_ROUND'
case FP_CLS_NAN: \
^
arch/powerpc/math-emu/math_efp.c:610:5: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
FP_TO_INT_S(vc.wp[0], SB0, 32,
^
./include/math-emu/single.h:109:34: note: expanded from macro 'FP_TO_INT_S'
#define FP_TO_INT_S(r,X,rsz,rsg) _FP_TO_INT(S,1,r,X,rsz,rsg)
^
./include/math-emu/op-common.h:665:4: note: expanded from macro '_FP_TO_INT'
case FP_CLS_ZERO: \
^
arch/powerpc/math-emu/math_efp.c:610:5: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
./include/math-emu/single.h:109:34: note: expanded from macro 'FP_TO_INT_S'
#define FP_TO_INT_S(r,X,rsz,rsg) _FP_TO_INT(S,1,r,X,rsz,rsg)
^
./include/math-emu/op-common.h:671:4: note: expanded from macro '_FP_TO_INT'
case FP_CLS_NAN: \
^
arch/powerpc/math-emu/math_efp.c:617:5: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
FP_TO_INT_S(vc.wp[1], SB1, 32,
^
./include/math-emu/single.h:109:34: note: expanded from macro 'FP_TO_INT_S'
#define FP_TO_INT_S(r,X,rsz,rsg) _FP_TO_INT(S,1,r,X,rsz,rsg)
^
./include/math-emu/op-common.h:665:4: note: expanded from macro '_FP_TO_INT'
case FP_CLS_ZERO: \
^
arch/powerpc/math-emu/math_efp.c:617:5: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
./include/math-emu/single.h:109:34: note: expanded from macro 'FP_TO_INT_S'
#define FP_TO_INT_S(r,X,rsz,rsg) _FP_TO_INT(S,1,r,X,rsz,rsg)
^
./include/math-emu/op-common.h:671:4: note: expanded from macro '_FP_TO_INT'
case FP_CLS_NAN: \
^
18 errors generated.
The following diff resolves it and does not introduce any new issues
with GCC. Would you mind squashing it in for a v2? With that:
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Cheers,
Nathan
diff --git a/include/math-emu/op-common.h b/include/math-emu/op-common.h
index 4b57bbba588a..ae73a30bf1a0 100644
--- a/include/math-emu/op-common.h
+++ b/include/math-emu/op-common.h
@@ -662,12 +662,14 @@ do { \
if (X##_e < 0) \
{ \
FP_SET_EXCEPTION(FP_EX_INEXACT); \
+ fallthrough; \
case FP_CLS_ZERO: \
r = 0; \
} \
else if (X##_e >= rsize - (rsigned > 0 || X##_s) \
|| (!rsigned && X##_s)) \
{ /* overflow */ \
+ fallthrough; \
case FP_CLS_NAN: \
case FP_CLS_INF: \
if (rsigned == 2) \
@@ -767,6 +769,7 @@ do { \
if (X##_e >= rsize - (rsigned > 0 || X##_s) \
|| (!rsigned && X##_s)) \
{ /* overflow */ \
+ fallthrough; \
case FP_CLS_NAN: \
case FP_CLS_INF: \
if (!rsigned) \
next prev parent reply other threads:[~2022-09-02 15:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-02 10:08 [PATCH v2 1/2] powerpc/math_emu/efp: Include module.h Christophe Leroy
2022-09-02 10:08 ` [PATCH v2 2/2] powerpc/math-emu: Remove -w build flag and fix warnings Christophe Leroy
2022-09-02 15:37 ` Nathan Chancellor [this message]
2022-09-02 15:59 ` Segher Boessenkool
2022-09-02 16:11 ` Christophe Leroy
2022-09-02 16:11 ` Nathan Chancellor
2022-09-02 16:27 ` Segher Boessenkool
2022-09-02 16:00 [PATCH v2 1/2] powerpc/math_emu/efp: Include module.h Christophe Leroy
2022-09-02 16:00 ` [PATCH v2 2/2] powerpc/math-emu: Remove -w build flag and fix warnings Christophe Leroy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YxIjM/jdLajq4dFk@dev-arch.thelio-3990X \
--to=nathan@kernel.org \
--cc=christophe.leroy@csgroup.eu \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®