Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 1 | From 8f85163b030e7b957648f90cd8fa599fb04d5d65 Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Fri, 16 Jun 2017 23:32:49 -0700 |
| 4 | Subject: [PATCH 1/5] Add fallthrough comments |
| 5 | |
| 6 | Fixes |
| 7 | |
| 8 | src/svf/svf.c:663:7: error: this statement may fall through [-Werror=implicit-fallthrough=] |
| 9 | i = -1; |
| 10 | ~~^~~~ |
| 11 | |
| 12 | Upstream-Status: Pending |
| 13 | |
| 14 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 15 | --- |
| 16 | src/flash/mflash.c | 3 ++- |
| 17 | src/flash/nand/mx3.c | 1 + |
| 18 | src/jtag/drivers/ftdi.c | 1 + |
| 19 | src/svf/svf.c | 2 ++ |
| 20 | src/target/arm_adi_v5.c | 9 +++++++++ |
| 21 | src/target/arm_disassembler.c | 1 + |
| 22 | src/target/target.c | 1 + |
| 23 | 7 files changed, 17 insertions(+), 1 deletion(-) |
| 24 | |
| 25 | diff --git a/src/flash/mflash.c b/src/flash/mflash.c |
| 26 | index b69995542..3254a3d56 100644 |
| 27 | --- a/src/flash/mflash.c |
| 28 | +++ b/src/flash/mflash.c |
| 29 | @@ -259,10 +259,11 @@ static int mg_dsk_wait(mg_io_type_wait wait_local, uint32_t time_var) |
| 30 | case mg_io_wait_rdy: |
| 31 | if (status & mg_io_rbit_status_ready) |
| 32 | return ERROR_OK; |
| 33 | - |
| 34 | + /* fallthru */ |
| 35 | case mg_io_wait_drq: |
| 36 | if (status & mg_io_rbit_status_data_req) |
| 37 | return ERROR_OK; |
| 38 | + /* fallthru */ |
| 39 | |
| 40 | default: |
| 41 | break; |
| 42 | diff --git a/src/flash/nand/mx3.c b/src/flash/nand/mx3.c |
| 43 | index b61e47535..0a55929ed 100644 |
| 44 | --- a/src/flash/nand/mx3.c |
| 45 | +++ b/src/flash/nand/mx3.c |
| 46 | @@ -281,6 +281,7 @@ static int imx31_command(struct nand_device *nand, uint8_t command) |
| 47 | * offset == one half of page size |
| 48 | */ |
| 49 | in_sram_address = MX3_NF_MAIN_BUFFER0 + (nand->page_size >> 1); |
| 50 | + /* fallthru */ |
| 51 | default: |
| 52 | in_sram_address = MX3_NF_MAIN_BUFFER0; |
| 53 | } |
| 54 | diff --git a/src/jtag/drivers/ftdi.c b/src/jtag/drivers/ftdi.c |
| 55 | index 00fe37faf..20f17d810 100644 |
| 56 | --- a/src/jtag/drivers/ftdi.c |
| 57 | +++ b/src/jtag/drivers/ftdi.c |
| 58 | @@ -855,6 +855,7 @@ COMMAND_HANDLER(ftdi_handle_set_signal_command) |
| 59 | ftdi_set_signal(sig, *CMD_ARGV[1]); |
| 60 | break; |
| 61 | } |
| 62 | + /* fallthru */ |
| 63 | default: |
| 64 | LOG_ERROR("unknown signal level '%s', use 0, 1 or z", CMD_ARGV[1]); |
| 65 | return ERROR_COMMAND_SYNTAX_ERROR; |
| 66 | diff --git a/src/svf/svf.c b/src/svf/svf.c |
| 67 | index e7e815c10..7b261cc72 100644 |
| 68 | --- a/src/svf/svf.c |
| 69 | +++ b/src/svf/svf.c |
| 70 | @@ -661,11 +661,13 @@ static int svf_read_command_from_file(FILE *fd) |
| 71 | if (svf_getline(&svf_read_line, &svf_read_line_size, svf_fd) <= 0) |
| 72 | return ERROR_FAIL; |
| 73 | i = -1; |
| 74 | + /* fallthru */ |
| 75 | case '\r': |
| 76 | slash = 0; |
| 77 | /* Don't save '\r' and '\n' if no data is parsed */ |
| 78 | if (!cmd_pos) |
| 79 | break; |
| 80 | + /* fallthru */ |
| 81 | default: |
| 82 | /* The parsing code currently expects a space |
| 83 | * before parentheses -- "TDI (123)". Also a |
| 84 | diff --git a/src/target/arm_adi_v5.c b/src/target/arm_adi_v5.c |
| 85 | index eafc2ddc0..d444db2b1 100644 |
| 86 | --- a/src/target/arm_adi_v5.c |
| 87 | +++ b/src/target/arm_adi_v5.c |
| 88 | @@ -346,10 +346,13 @@ static int mem_ap_write(struct adiv5_ap *ap, const uint8_t *buffer, uint32_t siz |
| 89 | case 4: |
| 90 | outvalue |= (uint32_t)*buffer++ << 8 * (address++ & 3); |
| 91 | outvalue |= (uint32_t)*buffer++ << 8 * (address++ & 3); |
| 92 | + /* fallthru */ |
| 93 | case 2: |
| 94 | outvalue |= (uint32_t)*buffer++ << 8 * (address++ & 3); |
| 95 | + /* fallthru */ |
| 96 | case 1: |
| 97 | outvalue |= (uint32_t)*buffer++ << 8 * (address++ & 3); |
| 98 | + /* fallthru */ |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | @@ -509,20 +512,26 @@ static int mem_ap_read(struct adiv5_ap *ap, uint8_t *buffer, uint32_t size, uint |
| 103 | case 4: |
| 104 | *buffer++ = *read_ptr >> 8 * (3 - (address++ & 3)); |
| 105 | *buffer++ = *read_ptr >> 8 * (3 - (address++ & 3)); |
| 106 | + /* fallthru */ |
| 107 | case 2: |
| 108 | *buffer++ = *read_ptr >> 8 * (3 - (address++ & 3)); |
| 109 | + /* fallthru */ |
| 110 | case 1: |
| 111 | *buffer++ = *read_ptr >> 8 * (3 - (address++ & 3)); |
| 112 | + /* fallthru */ |
| 113 | } |
| 114 | } else { |
| 115 | switch (this_size) { |
| 116 | case 4: |
| 117 | *buffer++ = *read_ptr >> 8 * (address++ & 3); |
| 118 | *buffer++ = *read_ptr >> 8 * (address++ & 3); |
| 119 | + /* fallthru */ |
| 120 | case 2: |
| 121 | *buffer++ = *read_ptr >> 8 * (address++ & 3); |
| 122 | + /* fallthru */ |
| 123 | case 1: |
| 124 | *buffer++ = *read_ptr >> 8 * (address++ & 3); |
| 125 | + /* fallthru */ |
| 126 | } |
| 127 | } |
| 128 | |
| 129 | diff --git a/src/target/arm_disassembler.c b/src/target/arm_disassembler.c |
| 130 | index 5277b94d8..2eb21ea33 100644 |
| 131 | --- a/src/target/arm_disassembler.c |
| 132 | +++ b/src/target/arm_disassembler.c |
| 133 | @@ -3299,6 +3299,7 @@ static int t2ev_data_immed(uint32_t opcode, uint32_t address, |
| 134 | case 0x10: |
| 135 | case 0x12: |
| 136 | is_signed = true; |
| 137 | + /* fallthru */ |
| 138 | case 0x18: |
| 139 | case 0x1a: |
| 140 | /* signed/unsigned saturated add */ |
| 141 | diff --git a/src/target/target.c b/src/target/target.c |
| 142 | index e04ecc470..597b4b13d 100644 |
| 143 | --- a/src/target/target.c |
| 144 | +++ b/src/target/target.c |
| 145 | @@ -3684,6 +3684,7 @@ COMMAND_HANDLER(handle_bp_command) |
| 146 | addr = 0; |
| 147 | return handle_bp_command_set(CMD_CTX, addr, asid, length, hw); |
| 148 | } |
| 149 | + /* fallthru */ |
| 150 | |
| 151 | case 4: |
| 152 | hw = BKPT_HARD; |
| 153 | -- |
| 154 | 2.13.1 |
| 155 | |