From 5e52207798ba727c7f6ab9d8d7f669fac93e3b55 Mon Sep 17 00:00:00 2001 From: elagil Date: Thu, 9 Nov 2023 22:46:41 +0100 Subject: [PATCH] fix: gcc compiler warnings --- src/gdb_main.c | 2 +- src/include/gdb_main.h | 2 +- src/include/rtt_if.h | 4 ++-- src/target/adiv5.c | 2 +- src/target/adiv5_swd.c | 6 +++--- src/target/jtag_scan.c | 2 +- src/target/sfdp.c | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/gdb_main.c b/src/gdb_main.c index 220d6afe543..1102d9ca0cc 100644 --- a/src/gdb_main.c +++ b/src/gdb_main.c @@ -41,7 +41,7 @@ #include "rtt.h" #endif -#if ADVERTISE_NOACKMODE == 1 +#if defined(ADVERTISE_NOACKMODE) && ADVERTISE_NOACKMODE == 1 /* * This lets GDB know that the probe supports ‘QStartNoAckMode’ * and prefers to operate in no-acknowledgment mode diff --git a/src/include/gdb_main.h b/src/include/gdb_main.h index e52b886e6d5..5f6fba75820 100644 --- a/src/include/gdb_main.h +++ b/src/include/gdb_main.h @@ -31,6 +31,6 @@ extern target_s *cur_target; void gdb_poll_target(void); void gdb_main(char *pbuf, size_t pbuf_size, size_t size); int gdb_main_loop(target_controller_s *tc, char *pbuf, size_t pbuf_size, size_t size, bool in_syscall); -char *gdb_packet_buffer(); +char *gdb_packet_buffer(void); #endif /* INCLUDE_GDB_MAIN_H */ diff --git a/src/include/rtt_if.h b/src/include/rtt_if.h index 20560496e5c..ceba91a7451 100644 --- a/src/include/rtt_if.h +++ b/src/include/rtt_if.h @@ -68,8 +68,8 @@ int rtt_if_exit(void); /* target to host: write len bytes from the buffer starting at buf. return number bytes written */ uint32_t rtt_write(const char *buf, uint32_t len); /* host to target: read one character, non-blocking. return character, -1 if no character */ -int32_t rtt_getchar(); +int32_t rtt_getchar(void); /* host to target: true if no characters available for reading */ -bool rtt_nodata(); +bool rtt_nodata(void); #endif /* INCLUDE_RTT_IF_H */ diff --git a/src/target/adiv5.c b/src/target/adiv5.c index 9180600b8ba..c69fdb2c133 100644 --- a/src/target/adiv5.c +++ b/src/target/adiv5.c @@ -477,7 +477,7 @@ static uint32_t cortexm_initial_halt(adiv5_access_port_s *ap) */ static bool cortexm_prepare(adiv5_access_port_s *ap) { -#if PC_HOSTED == 1 || ENABLE_DEBUG == 1 +#if (defined(PC_HOSTED) && PC_HOSTED == 1) || (defined(ENABLE_DEBUG) && ENABLE_DEBUG == 1) uint32_t start_time = platform_time_ms(); #endif uint32_t dhcsr = cortexm_initial_halt(ap); diff --git a/src/target/adiv5_swd.c b/src/target/adiv5_swd.c index 52a0a034a70..a257c00b4bb 100644 --- a/src/target/adiv5_swd.c +++ b/src/target/adiv5_swd.c @@ -19,7 +19,7 @@ * along with this program. If not, see . */ -/* +/* * This file implements the SWD specific functions of the * ARM Debug Interface v5 Architecture Specification, ARM doc IHI0031A. */ @@ -67,7 +67,7 @@ static void swd_line_reset_sequence(const bool idle_cycles) } /* Switch out of dormant state into SWD */ -static void dormant_to_swd_sequence() +static void dormant_to_swd_sequence(void) { /* * ARM Debug Interface Architecture Specification, ADIv5.0 to ADIv5.2. ARM IHI 0031C @@ -102,7 +102,7 @@ static void dormant_to_swd_sequence() } /* Deprecated JTAG-to-SWD select sequence */ -static void jtag_to_swd_sequence() +static void jtag_to_swd_sequence(void) { /* * ARM Debug Interface Architecture Specification, ADIv5.0 to ADIv5.2. ARM IHI 0031C diff --git a/src/target/jtag_scan.c b/src/target/jtag_scan.c index c28b2daec8b..d03944e58c6 100644 --- a/src/target/jtag_scan.c +++ b/src/target/jtag_scan.c @@ -191,7 +191,7 @@ static bool jtag_read_idcodes(void) static void jtag_display_idcodes(void) { -#if ENABLE_DEBUG +#if defined(ENABLE_DEBUG) && ENABLE_DEBUG for (size_t device = 0; device < jtag_dev_count; ++device) { const char *description = "Unknown"; for (size_t idx = 0; dev_descr[idx].idcode; ++idx) { diff --git a/src/target/sfdp.c b/src/target/sfdp.c index e73a706e73e..e2439fe0be9 100644 --- a/src/target/sfdp.c +++ b/src/target/sfdp.c @@ -43,7 +43,7 @@ static inline void sfdp_debug_print(const uint32_t address, const void *const buffer, const uint32_t length) { -#if ENABLE_DEBUG +#if defined(ENABLE_DEBUG) && ENABLE_DEBUG DEBUG_INFO("%" PRIu32 " byte SFDP read at 0x%" PRIx32 ":\n", length, address); const uint8_t *const data = buffer; for (size_t i = 0; i < length; i += 8U) {