Fix GCC7 warnings about switch-case fallthroughs

GCC7 with -Wextra warns about switch-case blocks which fallthrough with
"this statement may fall through [-Werror=implicit-fallthrough=]". This
can be fixed by adding "special" comments: "/* fallthrough */".

See https://gcc.gnu.org/gcc-7/changes.html

Change-Id: Iba0be791dbdd86984489b2d9a0592bb59828da1e
Signed-off-by: Freddie Chopin <freddie.chopin@gmail.com>
Reviewed-on: http://openocd.zylin.com/4174
Tested-by: jenkins
fence_i_fix_for_release
Freddie Chopin 2017-06-29 23:48:19 +02:00
parent ef49b34b2a
commit 9364b0dba4
10 changed files with 17 additions and 4 deletions

View File

@ -259,11 +259,11 @@ static int mg_dsk_wait(mg_io_type_wait wait_local, uint32_t time_var)
case mg_io_wait_rdy: case mg_io_wait_rdy:
if (status & mg_io_rbit_status_ready) if (status & mg_io_rbit_status_ready)
return ERROR_OK; return ERROR_OK;
/* fallthrough */
case mg_io_wait_drq: case mg_io_wait_drq:
if (status & mg_io_rbit_status_data_req) if (status & mg_io_rbit_status_data_req)
return ERROR_OK; return ERROR_OK;
/* fallthrough */
default: default:
break; break;
} }

View File

@ -281,6 +281,7 @@ static int imx31_command(struct nand_device *nand, uint8_t command)
* offset == one half of page size * offset == one half of page size
*/ */
in_sram_address = MX3_NF_MAIN_BUFFER0 + (nand->page_size >> 1); in_sram_address = MX3_NF_MAIN_BUFFER0 + (nand->page_size >> 1);
break;
default: default:
in_sram_address = MX3_NF_MAIN_BUFFER0; in_sram_address = MX3_NF_MAIN_BUFFER0;
} }

View File

@ -2126,6 +2126,7 @@ static int kinetis_probe_chip(struct kinetis_chip *k_chip)
case KINETIS_SDID_FAMILYID_K6X | KINETIS_SDID_SUBFAMID_KX1: /* errata 7534 - should be K63 */ case KINETIS_SDID_FAMILYID_K6X | KINETIS_SDID_SUBFAMID_KX1: /* errata 7534 - should be K63 */
case KINETIS_SDID_FAMILYID_K6X | KINETIS_SDID_SUBFAMID_KX2: /* errata 7534 - should be K64 */ case KINETIS_SDID_FAMILYID_K6X | KINETIS_SDID_SUBFAMID_KX2: /* errata 7534 - should be K64 */
subfamid += 2; /* errata 7534 fix */ subfamid += 2; /* errata 7534 fix */
/* fallthrough */
case KINETIS_SDID_FAMILYID_K6X | KINETIS_SDID_SUBFAMID_KX3: case KINETIS_SDID_FAMILYID_K6X | KINETIS_SDID_SUBFAMID_KX3:
/* K63FN1M0 */ /* K63FN1M0 */
case KINETIS_SDID_FAMILYID_K6X | KINETIS_SDID_SUBFAMID_KX4: case KINETIS_SDID_FAMILYID_K6X | KINETIS_SDID_SUBFAMID_KX4:

View File

@ -1456,8 +1456,8 @@ COMMAND_HELPER(handle_command_parse_bool, bool *out, const char *label)
LOG_ERROR("%s: argument '%s' is not valid", CMD_NAME, in); LOG_ERROR("%s: argument '%s' is not valid", CMD_NAME, in);
return ERROR_COMMAND_SYNTAX_ERROR; return ERROR_COMMAND_SYNTAX_ERROR;
} }
/* fall through */
} }
/* fallthrough */
case 0: case 0:
LOG_INFO("%s is %s", label, *out ? "enabled" : "disabled"); LOG_INFO("%s is %s", label, *out ? "enabled" : "disabled");
break; break;

View File

@ -855,6 +855,7 @@ COMMAND_HANDLER(ftdi_handle_set_signal_command)
ftdi_set_signal(sig, *CMD_ARGV[1]); ftdi_set_signal(sig, *CMD_ARGV[1]);
break; break;
} }
/* fallthrough */
default: default:
LOG_ERROR("unknown signal level '%s', use 0, 1 or z", CMD_ARGV[1]); LOG_ERROR("unknown signal level '%s', use 0, 1 or z", CMD_ARGV[1]);
return ERROR_COMMAND_SYNTAX_ERROR; return ERROR_COMMAND_SYNTAX_ERROR;

View File

@ -657,6 +657,7 @@ static int kitprog_swd_switch_seq(enum swd_special_seq seq)
LOG_DEBUG("JTAG to SWD not supported"); LOG_DEBUG("JTAG to SWD not supported");
/* Fall through to fix target reset issue */ /* Fall through to fix target reset issue */
} }
/* fallthrough */
case LINE_RESET: case LINE_RESET:
LOG_DEBUG("SWD line reset"); LOG_DEBUG("SWD line reset");
if (kitprog_swd_seq(SEQUENCE_LINE_RESET) != ERROR_OK) if (kitprog_swd_seq(SEQUENCE_LINE_RESET) != ERROR_OK)

View File

@ -661,11 +661,13 @@ static int svf_read_command_from_file(FILE *fd)
if (svf_getline(&svf_read_line, &svf_read_line_size, svf_fd) <= 0) if (svf_getline(&svf_read_line, &svf_read_line_size, svf_fd) <= 0)
return ERROR_FAIL; return ERROR_FAIL;
i = -1; i = -1;
/* fallthrough */
case '\r': case '\r':
slash = 0; slash = 0;
/* Don't save '\r' and '\n' if no data is parsed */ /* Don't save '\r' and '\n' if no data is parsed */
if (!cmd_pos) if (!cmd_pos)
break; break;
/* fallthrough */
default: default:
/* The parsing code currently expects a space /* The parsing code currently expects a space
* before parentheses -- "TDI (123)". Also a * before parentheses -- "TDI (123)". Also a

View File

@ -346,8 +346,10 @@ static int mem_ap_write(struct adiv5_ap *ap, const uint8_t *buffer, uint32_t siz
case 4: case 4:
outvalue |= (uint32_t)*buffer++ << 8 * (address++ & 3); outvalue |= (uint32_t)*buffer++ << 8 * (address++ & 3);
outvalue |= (uint32_t)*buffer++ << 8 * (address++ & 3); outvalue |= (uint32_t)*buffer++ << 8 * (address++ & 3);
/* fallthrough */
case 2: case 2:
outvalue |= (uint32_t)*buffer++ << 8 * (address++ & 3); outvalue |= (uint32_t)*buffer++ << 8 * (address++ & 3);
/* fallthrough */
case 1: case 1:
outvalue |= (uint32_t)*buffer++ << 8 * (address++ & 3); outvalue |= (uint32_t)*buffer++ << 8 * (address++ & 3);
} }
@ -509,8 +511,10 @@ static int mem_ap_read(struct adiv5_ap *ap, uint8_t *buffer, uint32_t size, uint
case 4: case 4:
*buffer++ = *read_ptr >> 8 * (3 - (address++ & 3)); *buffer++ = *read_ptr >> 8 * (3 - (address++ & 3));
*buffer++ = *read_ptr >> 8 * (3 - (address++ & 3)); *buffer++ = *read_ptr >> 8 * (3 - (address++ & 3));
/* fallthrough */
case 2: case 2:
*buffer++ = *read_ptr >> 8 * (3 - (address++ & 3)); *buffer++ = *read_ptr >> 8 * (3 - (address++ & 3));
/* fallthrough */
case 1: case 1:
*buffer++ = *read_ptr >> 8 * (3 - (address++ & 3)); *buffer++ = *read_ptr >> 8 * (3 - (address++ & 3));
} }
@ -519,8 +523,10 @@ static int mem_ap_read(struct adiv5_ap *ap, uint8_t *buffer, uint32_t size, uint
case 4: case 4:
*buffer++ = *read_ptr >> 8 * (address++ & 3); *buffer++ = *read_ptr >> 8 * (address++ & 3);
*buffer++ = *read_ptr >> 8 * (address++ & 3); *buffer++ = *read_ptr >> 8 * (address++ & 3);
/* fallthrough */
case 2: case 2:
*buffer++ = *read_ptr >> 8 * (address++ & 3); *buffer++ = *read_ptr >> 8 * (address++ & 3);
/* fallthrough */
case 1: case 1:
*buffer++ = *read_ptr >> 8 * (address++ & 3); *buffer++ = *read_ptr >> 8 * (address++ & 3);
} }

View File

@ -3299,6 +3299,7 @@ static int t2ev_data_immed(uint32_t opcode, uint32_t address,
case 0x10: case 0x10:
case 0x12: case 0x12:
is_signed = true; is_signed = true;
/* fallthrough */
case 0x18: case 0x18:
case 0x1a: case 0x1a:
/* signed/unsigned saturated add */ /* signed/unsigned saturated add */

View File

@ -3684,7 +3684,7 @@ COMMAND_HANDLER(handle_bp_command)
addr = 0; addr = 0;
return handle_bp_command_set(CMD_CTX, addr, asid, length, hw); return handle_bp_command_set(CMD_CTX, addr, asid, length, hw);
} }
/* fallthrough */
case 4: case 4:
hw = BKPT_HARD; hw = BKPT_HARD;
COMMAND_PARSE_ADDRESS(CMD_ARGV[0], addr); COMMAND_PARSE_ADDRESS(CMD_ARGV[0], addr);