diff --git a/src/platforms/native/platform.h b/src/platforms/native/platform.h index fd456d8..37104d6 100644 --- a/src/platforms/native/platform.h +++ b/src/platforms/native/platform.h @@ -163,14 +163,14 @@ extern const char *morse_msg; #define SET_ERROR_STATE(state) {gpio_set_val(LED_PORT, LED_ERROR, state);} #define PLATFORM_SET_FATAL_ERROR_RECOVERY() {setjmp(fatal_error_jmpbuf);} -#define PLATFORM_FATAL_ERROR(error) { \ +#define PLATFORM_FATAL_ERROR(error) do { \ if(running_status) gdb_putpacketz("X1D"); \ else gdb_putpacketz("EFF"); \ running_status = 0; \ target_list_free(); \ morse("TARGET LOST.", 1); \ longjmp(fatal_error_jmpbuf, (error)); \ -} +} while (0) int platform_init(void); void morse(const char *msg, char repeat); diff --git a/src/platforms/stlink/platform.h b/src/platforms/stlink/platform.h index 029eb0a..bee8879 100644 --- a/src/platforms/stlink/platform.h +++ b/src/platforms/stlink/platform.h @@ -147,13 +147,13 @@ extern uint16_t led_idle_run; #define SET_IDLE_STATE(state) {gpio_set_val(LED_PORT, led_idle_run, state);} #define PLATFORM_SET_FATAL_ERROR_RECOVERY() {setjmp(fatal_error_jmpbuf);} -#define PLATFORM_FATAL_ERROR(error) { \ +#define PLATFORM_FATAL_ERROR(error) do { \ if(running_status) gdb_putpacketz("X1D"); \ else gdb_putpacketz("EFF"); \ running_status = 0; \ target_list_free(); \ longjmp(fatal_error_jmpbuf, (error)); \ -} +} while (0) int platform_init(void); void morse(const char *msg, char repeat);