Use do {...} while(0) for PLATFORM_FATAL_ERROR() macro.
This commit is contained in:
parent
fce43bcd98
commit
700833f38f
@ -163,14 +163,14 @@ extern const char *morse_msg;
|
|||||||
#define SET_ERROR_STATE(state) {gpio_set_val(LED_PORT, LED_ERROR, state);}
|
#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_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"); \
|
if(running_status) gdb_putpacketz("X1D"); \
|
||||||
else gdb_putpacketz("EFF"); \
|
else gdb_putpacketz("EFF"); \
|
||||||
running_status = 0; \
|
running_status = 0; \
|
||||||
target_list_free(); \
|
target_list_free(); \
|
||||||
morse("TARGET LOST.", 1); \
|
morse("TARGET LOST.", 1); \
|
||||||
longjmp(fatal_error_jmpbuf, (error)); \
|
longjmp(fatal_error_jmpbuf, (error)); \
|
||||||
}
|
} while (0)
|
||||||
|
|
||||||
int platform_init(void);
|
int platform_init(void);
|
||||||
void morse(const char *msg, char repeat);
|
void morse(const char *msg, char repeat);
|
||||||
|
@ -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 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_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"); \
|
if(running_status) gdb_putpacketz("X1D"); \
|
||||||
else gdb_putpacketz("EFF"); \
|
else gdb_putpacketz("EFF"); \
|
||||||
running_status = 0; \
|
running_status = 0; \
|
||||||
target_list_free(); \
|
target_list_free(); \
|
||||||
longjmp(fatal_error_jmpbuf, (error)); \
|
longjmp(fatal_error_jmpbuf, (error)); \
|
||||||
}
|
} while (0)
|
||||||
|
|
||||||
int platform_init(void);
|
int platform_init(void);
|
||||||
void morse(const char *msg, char repeat);
|
void morse(const char *msg, char repeat);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user