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 <jakob.hasse@espressif.com>
This commit is contained in:
Vladimir Chistyakov
2021-03-11 14:13:00 +07:00
committed by Jakob Hasse
parent afe14a5ed2
commit 1d74652b5e

View File

@@ -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");