From 6d532b823e350c574cad9c97e93a0e1ecfb9bbee Mon Sep 17 00:00:00 2001 From: Reuben Thomas Date: Tue, 30 Jan 2018 19:17:52 +0000 Subject: [PATCH] Fix fallthrough warnings from gcc using gnulib's FALLTHROUGH macro --- src/common.h | 8 ++++++++ src/endline.c | 8 ++++---- src/ibmpc.c | 4 ++-- src/iconqnx.c | 6 +++--- src/recode.c | 1 + 5 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/common.h b/src/common.h index 9865dd0..54ecae0 100644 --- a/src/common.h +++ b/src/common.h @@ -42,6 +42,14 @@ #endif #define N_(Text) Text +#ifndef FALLTHROUGH +# if __GNUC__ < 7 +# define FALLTHROUGH ((void) 0) +# else +# define FALLTHROUGH __attribute__ ((__fallthrough__)) +# endif +#endif + /* Generate a mask of LENGTH one-bits, right justified in a word. */ #define BIT_MASK(Length) ((1U << (Length)) - 1) diff --git a/src/endline.c b/src/endline.c index a52455a..0128243 100644 --- a/src/endline.c +++ b/src/endline.c @@ -44,7 +44,7 @@ transform_data_cr (RECODE_SUBTASK subtask) break; } RETURN_IF_NOGO (RECODE_AMBIGUOUS_OUTPUT, subtask); - /* Fall through. */ + FALLTHROUGH; default: put_byte (character, subtask); @@ -73,7 +73,7 @@ transform_cr_data (RECODE_SUBTASK subtask) break; } RETURN_IF_NOGO (RECODE_AMBIGUOUS_OUTPUT, subtask); - /* Fall through. */ + FALLTHROUGH; default: put_byte (character, subtask); @@ -105,7 +105,7 @@ transform_data_crlf (RECODE_SUBTASK subtask) case OLD_EOF: RETURN_IF_NOGO (RECODE_AMBIGUOUS_OUTPUT, subtask); - /* Fall through. */ + FALLTHROUGH; default: put_byte (character, subtask); @@ -140,7 +140,7 @@ transform_crlf_data (RECODE_SUBTASK subtask) case LF: RETURN_IF_NOGO (RECODE_AMBIGUOUS_OUTPUT, subtask); - /* Fall through. */ + FALLTHROUGH; default: put_byte (character, subtask); diff --git a/src/ibmpc.c b/src/ibmpc.c index 11f5510..068cc3e 100644 --- a/src/ibmpc.c +++ b/src/ibmpc.c @@ -236,7 +236,7 @@ transform_ibmpc_latin1 (RECODE_SUBTASK subtask) case DOS_LF: RETURN_IF_NOGO (RECODE_AMBIGUOUS_OUTPUT, subtask); - /* Fall through. */ + FALLTHROUGH; default: put_byte (table[input_char], subtask); @@ -272,7 +272,7 @@ transform_ibmpc_latin1 (RECODE_SUBTASK subtask) case DOS_LF: RETURN_IF_NOGO (RECODE_AMBIGUOUS_OUTPUT, subtask); - /* Fall through. */ + FALLTHROUGH; default: if (table[input_char]) diff --git a/src/iconqnx.c b/src/iconqnx.c index 6ca1f32..cab5066 100644 --- a/src/iconqnx.c +++ b/src/iconqnx.c @@ -45,7 +45,7 @@ transform_ibmpc_iconqnx (RECODE_SUBTASK subtask) { case DOS_EOF: RETURN_IF_NOGO (RECODE_NOT_CANONICAL, subtask); - /* Fall through. */ + FALLTHROUGH; case EOF: SUBTASK_RETURN (subtask); @@ -80,7 +80,7 @@ transform_ibmpc_iconqnx (RECODE_SUBTASK subtask) case ENDLINE: case ESCAPE: RETURN_IF_NOGO (RECODE_AMBIGUOUS_OUTPUT, subtask); - /* Fall through. */ + FALLTHROUGH; default: put_byte (input_char, subtask); @@ -208,7 +208,7 @@ transform_iconqnx_ibmpc (RECODE_SUBTASK subtask) if (input_char == EOF) SUBTASK_RETURN (subtask); } - /* Fall through. */ + FALLTHROUGH; default: put_byte (input_char, subtask); diff --git a/src/recode.c b/src/recode.c index 427ba4a..6866992 100644 --- a/src/recode.c +++ b/src/recode.c @@ -680,6 +680,7 @@ recode_format_table (RECODE_REQUEST request, column += 2; break; } + FALLTHROUGH; default: if (isprint (*cursor2)) -- 2.40.0