From 623f20d2b555ceb7a06246a820fdea17eb2f5b52 Mon Sep 17 00:00:00 2001 From: Darian Leung Date: Wed, 16 Nov 2022 17:51:10 +0800 Subject: [PATCH] freertos(SMP): Fix SMP FreeRTOS RISC-V statement expression macro Macros that need to reteurn a value should use GCC statement expression macro syntax. This commit fixes the portTRY_ENTER_CRITICAL() in the RISC-V port of SMP FreeRTOS to be a statement expression macro. --- .../portable/riscv/include/freertos/portmacro.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/freertos/FreeRTOS-Kernel-SMP/portable/riscv/include/freertos/portmacro.h b/components/freertos/FreeRTOS-Kernel-SMP/portable/riscv/include/freertos/portmacro.h index 3c79da605d..c5d0f40b92 100644 --- a/components/freertos/FreeRTOS-Kernel-SMP/portable/riscv/include/freertos/portmacro.h +++ b/components/freertos/FreeRTOS-Kernel-SMP/portable/riscv/include/freertos/portmacro.h @@ -256,11 +256,11 @@ void vPortEnterCritical(void); void vPortExitCritical(void); //IDF task critical sections -#define portTRY_ENTER_CRITICAL(lock, timeout) {((void) lock; (void) timeout; vPortEnterCritical(); pdPASS;)} +#define portTRY_ENTER_CRITICAL(lock, timeout) ({(void) lock; (void) timeout; vPortEnterCritical(); pdPASS;}) #define portENTER_CRITICAL_IDF(lock) ({(void) lock; vPortEnterCritical();}) #define portEXIT_CRITICAL_IDF(lock) ({(void) lock; vPortExitCritical();}) //IDF ISR critical sections -#define portTRY_ENTER_CRITICAL_ISR(lock, timeout) {((void) lock; (void) timeout; vPortEnterCritical(); pdPASS;)} +#define portTRY_ENTER_CRITICAL_ISR(lock, timeout) ({(void) lock; (void) timeout; vPortEnterCritical(); pdPASS;}) #define portENTER_CRITICAL_ISR(lock) ({(void) lock; vPortEnterCritical();}) #define portEXIT_CRITICAL_ISR(lock) ({(void) lock; vPortExitCritical();}) //IDF safe critical sections (they're the same)