src: fix clang15 compiler warnings

Below warnings are fixed.

1- A function declaration without a prototype is deprecated in all
versions of C [-Werror,-Wstrict-prototypes]

2- error: variable set but not used [-Werror,-Wunused-but-set-variable]

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: I1cf14b8e5e3e732ebc9cacc4b1cb9009276a8ea9
Reviewed-on: https://review.openocd.org/c/openocd/+/7569
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
This commit is contained in:
Erhan Kurubas 2023-04-02 00:26:51 +02:00
parent 1a089d8409
commit e6f30aef80
3 changed files with 4 additions and 10 deletions

View File

@ -3012,7 +3012,8 @@ static int gdb_query_packet(struct connection *connection,
return ERROR_OK; return ERROR_OK;
} }
static bool gdb_handle_vcont_packet(struct connection *connection, const char *packet, int packet_size) static bool gdb_handle_vcont_packet(struct connection *connection, const char *packet,
__attribute__((unused)) int packet_size)
{ {
struct gdb_connection *gdb_connection = connection->priv; struct gdb_connection *gdb_connection = connection->priv;
struct target *target = get_available_target_from_connection(connection); struct target *target = get_available_target_from_connection(connection);
@ -3031,7 +3032,6 @@ static bool gdb_handle_vcont_packet(struct connection *connection, const char *p
if (parse[0] == ';') { if (parse[0] == ';') {
++parse; ++parse;
--packet_size;
} }
/* simple case, a continue packet */ /* simple case, a continue packet */
@ -3070,14 +3070,11 @@ static bool gdb_handle_vcont_packet(struct connection *connection, const char *p
int current_pc = 1; int current_pc = 1;
int64_t thread_id; int64_t thread_id;
parse++; parse++;
packet_size--;
if (parse[0] == ':') { if (parse[0] == ':') {
char *endp; char *endp;
parse++; parse++;
packet_size--;
thread_id = strtoll(parse, &endp, 16); thread_id = strtoll(parse, &endp, 16);
if (endp) { if (endp) {
packet_size -= endp - parse;
parse = endp; parse = endp;
} }
} else { } else {
@ -3115,7 +3112,6 @@ static bool gdb_handle_vcont_packet(struct connection *connection, const char *p
if (parse[0] == ';') { if (parse[0] == ';') {
++parse; ++parse;
--packet_size;
if (parse[0] == 'c') { if (parse[0] == 'c') {
parse += 1; parse += 1;

View File

@ -1553,7 +1553,6 @@ static int arm7_9_restore_context(struct target *target)
if (dirty) { if (dirty) {
uint32_t mask = 0x0; uint32_t mask = 0x0;
int num_regs = 0;
uint32_t regs[16]; uint32_t regs[16];
if (mode_change) { if (mode_change) {
@ -1576,7 +1575,6 @@ static int arm7_9_restore_context(struct target *target)
if (reg->dirty) { if (reg->dirty) {
regs[j] = buf_get_u32(reg->value, 0, 32); regs[j] = buf_get_u32(reg->value, 0, 32);
mask |= 1 << j; mask |= 1 << j;
num_regs++;
reg->dirty = false; reg->dirty = false;
reg->valid = true; reg->valid = true;
LOG_DEBUG("writing register %i mode %s " LOG_DEBUG("writing register %i mode %s "

View File

@ -1948,13 +1948,13 @@ static int target_call_timer_callbacks_check_time(int checktime)
return ERROR_OK; return ERROR_OK;
} }
int target_call_timer_callbacks() int target_call_timer_callbacks(void)
{ {
return target_call_timer_callbacks_check_time(1); return target_call_timer_callbacks_check_time(1);
} }
/* invoke periodic callbacks immediately */ /* invoke periodic callbacks immediately */
int target_call_timer_callbacks_now() int target_call_timer_callbacks_now(void)
{ {
return target_call_timer_callbacks_check_time(0); return target_call_timer_callbacks_check_time(0);
} }