diff mbox

Fix -Wimplicit-fallthrough in soft-fp (Re: implicit-fallthrough warnings in powerpc64le-linux GCC build)

Message ID 20170124103016.GC1867@tucnak
State New
Headers show

Commit Message

Jakub Jelinek Jan. 24, 2017, 10:30 a.m. UTC
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.



	Jakub

Comments

Joseph Myers Jan. 24, 2017, 4:48 p.m. UTC | #1
On Tue, 24 Jan 2017, Jakub Jelinek wrote:

> 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.

OK for glibc.
diff mbox

Patch

--- 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;					\