target: align switch and case statements

The coding style requires the 'case' to be at the same indentation
level of its 'switch' statement.

Align the code accordingly.

While there:
- add space around the operators;
- drop useless empty line.

Skip all riscv code, as it is going to be updated soon from the
external fork.

No changes are reported by
	git log -p -w --ignore-blank-lines --patience

Change-Id: I2691dfdd2b6734143e14160b46183623e9773539
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/9051
Tested-by: jenkins
This commit is contained in:
Antonio Borneo
2025-07-26 15:46:26 +02:00
parent 0cd8b6a9d9
commit ddef9cf73b
41 changed files with 4227 additions and 4232 deletions

View File

@@ -965,9 +965,9 @@ static int evaluate_media(uint32_t opcode, uint32_t address,
sprintf(cp, "%cSAT16%s\tr%d, #%d, r%d",
(opcode & (1 << 22)) ? 'U' : 'S',
COND(opcode),
(int) (opcode >> 12) & 0xf,
(int) (opcode >> 16) & 0xf,
(int) (opcode >> 0) & 0xf);
(int)(opcode >> 12) & 0xf,
(int)(opcode >> 16) & 0xf,
(int)(opcode >> 0) & 0xf);
return ERROR_OK;
case 0x00b00030:
mnemonic = "REV";
@@ -981,23 +981,23 @@ static int evaluate_media(uint32_t opcode, uint32_t address,
case 0x008000b0:
/* select bytes */
sprintf(cp, "SEL%s\tr%d, r%d, r%d", COND(opcode),
(int) (opcode >> 12) & 0xf,
(int) (opcode >> 16) & 0xf,
(int) (opcode >> 0) & 0xf);
(int)(opcode >> 12) & 0xf,
(int)(opcode >> 16) & 0xf,
(int)(opcode >> 0) & 0xf);
return ERROR_OK;
case 0x01800010:
/* unsigned sum of absolute differences */
if (((opcode >> 12) & 0xf) == 0xf)
sprintf(cp, "USAD8%s\tr%d, r%d, r%d", COND(opcode),
(int) (opcode >> 16) & 0xf,
(int) (opcode >> 0) & 0xf,
(int) (opcode >> 8) & 0xf);
(int)(opcode >> 16) & 0xf,
(int)(opcode >> 0) & 0xf,
(int)(opcode >> 8) & 0xf);
else
sprintf(cp, "USADA8%s\tr%d, r%d, r%d, r%d", COND(opcode),
(int) (opcode >> 16) & 0xf,
(int) (opcode >> 0) & 0xf,
(int) (opcode >> 8) & 0xf,
(int) (opcode >> 12) & 0xf);
(int)(opcode >> 16) & 0xf,
(int)(opcode >> 0) & 0xf,
(int)(opcode >> 8) & 0xf,
(int)(opcode >> 12) & 0xf);
return ERROR_OK;
}
if (mnemonic) {

View File

@@ -187,7 +187,6 @@ static int dpm_read_reg_u64(struct arm_dpm *dpm, struct reg *r, unsigned int reg
&value_r1);
break;
default:
break;
}
@@ -295,7 +294,6 @@ static int dpm_write_reg_u64(struct arm_dpm *dpm, struct reg *r, unsigned int re
((regnum - ARM_VFP_V3_D0) & 0xf)), value_r0);
break;
default:
break;
}

View File

@@ -209,7 +209,6 @@ static int pass_condition(uint32_t cpsr, uint32_t opcode)
case 0xe:
case 0xf:
return 1;
}
LOG_ERROR("BUG: should never get here");

View File

@@ -820,7 +820,6 @@ static int dsp563xx_write_register(struct target *target, int num, int force)
dsp563xx->core_cache->reg_list[DSP563XX_REG_IDX_SSH].valid = 0;
dsp563xx->core_cache->reg_list[DSP563XX_REG_IDX_SSL].valid = 0;
}
break;
}
}
@@ -1918,7 +1917,7 @@ static int dsp563xx_add_custom_watchpoint(struct target *target, uint32_t addres
obcr_value |= OBCR_BP_0(OBCR_BP_ON_WRITE);
break;
case WPT_ACCESS:
obcr_value |= OBCR_BP_0(OBCR_BP_ON_READ|OBCR_BP_ON_WRITE);
obcr_value |= OBCR_BP_0(OBCR_BP_ON_READ | OBCR_BP_ON_WRITE);
break;
default:
LOG_ERROR("Unsupported write mode (%d)", rw);

View File

@@ -428,6 +428,7 @@ static int esirisc_trace_analyze_full(struct command_invocation *cmd, uint8_t *b
}
break;
}
case ESIRISC_TRACE_EXT_ID_EXCEPTION: {
uint32_t eid, epc;
@@ -443,6 +444,7 @@ static int esirisc_trace_analyze_full(struct command_invocation *cmd, uint8_t *b
esirisc_trace_ext_id_strings[ext_id], eid, epc);
break;
}
case ESIRISC_TRACE_EXT_ID_COUNT: {
uint32_t count;
@@ -454,6 +456,7 @@ static int esirisc_trace_analyze_full(struct command_invocation *cmd, uint8_t *b
(count == 1) ? "time" : "times");
break;
}
case ESIRISC_TRACE_EXT_ID_END:
command_print(cmd, "--- end of trace ---");
return ERROR_OK;

View File

@@ -844,7 +844,6 @@ static int image_mot_buffer_complete_inner(struct image *image,
bytes_read += 8;
count -= 4;
break;
}
if (full_address != address) {

View File

@@ -1699,7 +1699,6 @@ COMMAND_HANDLER(mips32_handle_cp0_command)
retval = mips32_cp0_get_reg_by_number(CMD, ejtag_info);
else /* or set value by register name */
retval = mips32_cp0_set_reg_by_name(CMD, mips32, ejtag_info);
break;
case 3: /* 3 args => set cp0 reg/sel value*/
retval = mips32_cp0_set_reg_by_number(CMD, mips32, ejtag_info);

View File

@@ -399,7 +399,6 @@ int semihosting_common(struct target *target)
semihosting->param);
switch (semihosting->op) {
case SEMIHOSTING_SYS_CLOCK: /* 0x10 */
/*
* Returns the number of centiseconds (hundredths of a second)
@@ -1125,7 +1124,7 @@ int semihosting_common(struct target *target)
fileio_info->param_1 = addr;
fileio_info->param_2 = len;
} else {
uint8_t *fn = malloc(len+1);
uint8_t *fn = malloc(len + 1);
if (!fn) {
semihosting->result = -1;
semihosting->sys_errno = ENOMEM;
@@ -1182,8 +1181,8 @@ int semihosting_common(struct target *target)
fileio_info->param_3 = addr2;
fileio_info->param_4 = len2;
} else {
uint8_t *fn1 = malloc(len1+1);
uint8_t *fn2 = malloc(len2+1);
uint8_t *fn1 = malloc(len1 + 1);
uint8_t *fn2 = malloc(len2 + 1);
if (!fn1 || !fn2) {
free(fn1);
free(fn2);
@@ -1298,7 +1297,7 @@ int semihosting_common(struct target *target)
fileio_info->param_1 = addr;
fileio_info->param_2 = len;
} else {
uint8_t *cmd = malloc(len+1);
uint8_t *cmd = malloc(len + 1);
if (!cmd) {
semihosting->result = -1;
semihosting->sys_errno = ENOMEM;

View File

@@ -75,10 +75,10 @@ static int target_hexmsg(struct target *target, int size, uint32_t length)
for (i = 0; i < length; i++) {
switch (size) {
case 4:
line_len += snprintf(line + line_len, 128 - line_len, "%8.8" PRIx32 " ", le_to_h_u32(data + (4*i)));
line_len += snprintf(line + line_len, 128 - line_len, "%8.8" PRIx32 " ", le_to_h_u32(data + (4 * i)));
break;
case 2:
line_len += snprintf(line + line_len, 128 - line_len, "%4.4x ", le_to_h_u16(data + (2*i)));
line_len += snprintf(line + line_len, 128 - line_len, "%4.4x ", le_to_h_u16(data + (2 * i)));
break;
case 1:
line_len += snprintf(line + line_len, 128 - line_len, "%2.2x ", data[i]);

View File

@@ -2739,7 +2739,6 @@ static int xscale_analyze_trace(struct target *target, struct command_invocation
default:/* Reserved */
LOG_WARNING("trace is suspect: invalid trace message byte");
continue;
}
/* If we don't have the current_pc yet, but we did get the branch target