This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] Fix -Wimplicit-fallthrough in soft-fp (Re: implicit-fallthrough warnings in powerpc64le-linux GCC build)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Sebastian Huber <sebastian dot huber at embedded-brains dot de>, "Joseph S. Myers" <joseph at codesourcery dot com>
- Cc: gcc-patches at gcc dot gnu dot org, libc-alpha at sourceware dot org
- Date: Tue, 24 Jan 2017 11:30:16 +0100
- Subject: [PATCH] Fix -Wimplicit-fallthrough in soft-fp (Re: implicit-fallthrough warnings in powerpc64le-linux GCC build)
- Authentication-results: sourceware.org; auth=none
- References: <5887258A.7010702@embedded-brains.de>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
On Tue, Jan 24, 2017 at 10:59:38AM +0100, Sebastian Huber wrote:
...
> mulkf3-sw.c:48:3: note: in expansion of macro ‘FP_MUL_Q’
> FP_MUL_Q (R, A, B);
> ^~~~~~~~
> /home/sh/gcc-git/libgcc/soft-fp/op-common.h:913:10: warning: this statement
> may fall through [-Wimplicit-fallthrough=]
> R##_s = Y##_s; \
> /home/sh/gcc-git/libgcc/soft-fp/quad.h:308:29: note: in expansion of macro
> ‘_FP_MUL’
> # define FP_MUL_Q(R, X, Y) _FP_MUL (Q, 2, R, X, Y)
> ^~~~~~~
> mulkf3-sw.c:48:3: note: in expansion of macro ‘FP_MUL_Q’
> FP_MUL_Q (R, A, B);
> ^~~~~~~~
> /home/sh/gcc-git/libgcc/soft-fp/op-common.h:915:2: note: here
> case _FP_CLS_COMBINE (FP_CLS_NORMAL, FP_CLS_INF): \
> ^
> /home/sh/gcc-git/libgcc/soft-fp/quad.h:308:29: note: in expansion of macro
> ‘_FP_MUL’
> # define FP_MUL_Q(R, X, Y) _FP_MUL (Q, 2, R, X, Y)
> ^~~~~~~
> mulkf3-sw.c:48:3: note: in expansion of macro ‘FP_MUL_Q’
> FP_MUL_Q (R, A, B);
> ^~~~~~~
>
> I don't know this code enough to fix them.
The following patch fixes the warnings (all the 5 fallthrus are intentional)
for me on x86_64-linux. But I assume it needs to go into glibc first,
right?
2017-01-24 Jakub Jelinek <jakub@redhat.com>
* soft-fp/op-common.h (_FP_MUL, _FP_FMA, _FP_DIV): Add
/* FALLTHRU */ comments.
--- libgcc/soft-fp/op-common.h.jj 2016-08-17 10:22:22.000000000 +0200
+++ libgcc/soft-fp/op-common.h 2017-01-24 11:18:40.284703176 +0100
@@ -1,5 +1,5 @@
/* Software floating-point emulation. Common operations.
- Copyright (C) 1997-2016 Free Software Foundation, Inc.
+ Copyright (C) 1997-2017 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson (rth@cygnus.com),
Jakub Jelinek (jj@ultra.linux.cz),
@@ -898,6 +898,7 @@
case _FP_CLS_COMBINE (FP_CLS_NAN, FP_CLS_INF): \
case _FP_CLS_COMBINE (FP_CLS_NAN, FP_CLS_ZERO): \
R##_s = X##_s; \
+ /* FALLTHRU */ \
\
case _FP_CLS_COMBINE (FP_CLS_INF, FP_CLS_INF): \
case _FP_CLS_COMBINE (FP_CLS_INF, FP_CLS_NORMAL): \
@@ -911,6 +912,7 @@
case _FP_CLS_COMBINE (FP_CLS_INF, FP_CLS_NAN): \
case _FP_CLS_COMBINE (FP_CLS_ZERO, FP_CLS_NAN): \
R##_s = Y##_s; \
+ /* FALLTHRU */ \
\
case _FP_CLS_COMBINE (FP_CLS_NORMAL, FP_CLS_INF): \
case _FP_CLS_COMBINE (FP_CLS_NORMAL, FP_CLS_ZERO): \
@@ -1063,6 +1065,7 @@
case _FP_CLS_COMBINE (FP_CLS_NAN, FP_CLS_INF): \
case _FP_CLS_COMBINE (FP_CLS_NAN, FP_CLS_ZERO): \
_FP_FMA_T##_s = X##_s; \
+ /* FALLTHRU */ \
\
case _FP_CLS_COMBINE (FP_CLS_INF, FP_CLS_INF): \
case _FP_CLS_COMBINE (FP_CLS_INF, FP_CLS_NORMAL): \
@@ -1076,6 +1079,7 @@
case _FP_CLS_COMBINE (FP_CLS_INF, FP_CLS_NAN): \
case _FP_CLS_COMBINE (FP_CLS_ZERO, FP_CLS_NAN): \
_FP_FMA_T##_s = Y##_s; \
+ /* FALLTHRU */ \
\
case _FP_CLS_COMBINE (FP_CLS_NORMAL, FP_CLS_INF): \
case _FP_CLS_COMBINE (FP_CLS_NORMAL, FP_CLS_ZERO): \
@@ -1198,6 +1202,7 @@
\
case _FP_CLS_COMBINE (FP_CLS_NORMAL, FP_CLS_ZERO): \
FP_SET_EXCEPTION (FP_EX_DIVZERO); \
+ /* FALLTHRU */ \
case _FP_CLS_COMBINE (FP_CLS_INF, FP_CLS_ZERO): \
case _FP_CLS_COMBINE (FP_CLS_INF, FP_CLS_NORMAL): \
R##_c = FP_CLS_INF; \
Jakub