From 1d74652b5e488c55f2836943241f693353bf0aea Mon Sep 17 00:00:00 2001 From: Vladimir Chistyakov Date: Thu, 11 Mar 2021 14:13:00 +0700 Subject: [PATCH] Fix portGET_ARGUMENT_COUNT macro portGET_ARGUMENT_COUNT uses a GCC extension ##__VA_ARGS__. It forces the user to compile the code with GNU extensions enabled instead of ISO language standard. The suggested change is to replace ##__VA_ARGS__ with __VA_OPT__(,) __VA_ARGS__ which is supported by the current version of GCC used in ESP-IDF for both C and C++ ISO standards. This fix would enable ESP-IDF users to compile their code with ISO C++20 standard in future releases. Signed-off-by: Jakob Hasse --- components/freertos/port/xtensa/include/freertos/portmacro.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/freertos/port/xtensa/include/freertos/portmacro.h b/components/freertos/port/xtensa/include/freertos/portmacro.h index 222a5ae801..2621207995 100644 --- a/components/freertos/port/xtensa/include/freertos/portmacro.h +++ b/components/freertos/port/xtensa/include/freertos/portmacro.h @@ -312,7 +312,7 @@ void _frxt_setup_switch( void ); * Macro to count number of arguments of a __VA_ARGS__ used to support portYIELD_FROM_ISR with, * or without arguments. */ -#define portGET_ARGUMENT_COUNT(...) portGET_ARGUMENT_COUNT_INNER(0, ##__VA_ARGS__,1,0) +#define portGET_ARGUMENT_COUNT(...) portGET_ARGUMENT_COUNT_INNER(0 __VA_OPT__(,) __VA_ARGS__,1,0) #define portGET_ARGUMENT_COUNT_INNER(zero, one, count, ...) count _Static_assert(portGET_ARGUMENT_COUNT() == 0, "portGET_ARGUMENT_COUNT() result does not match for 0 arguments");