mirror of https://github.com/arendst/Tasmota.git
Fix compilation ESP8266
https://github.com/crankyoldgit/IRremoteESP8266/pull/1881/files
This commit is contained in:
parent
914859ad48
commit
412d5d6938
|
@ -5,6 +5,20 @@
|
|||
*/
|
||||
/// @file IRmacros.h
|
||||
|
||||
/**
|
||||
* VA_OPT_SUPPORTED macro to check if __VA_OPT__ is supported
|
||||
* Source: https://stackoverflow.com/a/48045656
|
||||
*/
|
||||
/// @cond TEST
|
||||
#define PP_THIRD_ARG(a, b, c, ...) c
|
||||
#define VA_OPT_SUPPORTED_I(...) \
|
||||
PP_THIRD_ARG(__VA_OPT__(, false), true, false, false)
|
||||
#define VA_OPT_SUPPORTED VA_OPT_SUPPORTED_I(?)
|
||||
/// @endcond
|
||||
/**
|
||||
* VA_OPT_SUPPORTED end
|
||||
*/
|
||||
|
||||
/**
|
||||
* COND() Set of macros to facilitate single-line conditional compilation
|
||||
* argument checking.
|
||||
|
@ -13,8 +27,14 @@
|
|||
*
|
||||
* Usage:
|
||||
* COND(<define_to_test>[||/&&<more_define>...], <true_result>, <false_result>)
|
||||
*
|
||||
* NB: If __VA_OPT__ macro not supported, the <true_result> will be expanded!
|
||||
*/
|
||||
/// @cond TEST
|
||||
#if !VA_OPT_SUPPORTED
|
||||
// #pragma message("Compiler without __VA_OPT__ support")
|
||||
#define COND(cond, a, b) a
|
||||
#else
|
||||
#define NOTHING
|
||||
#define EXPAND(...) __VA_ARGS__
|
||||
#define STUFF_P(a, ...) __VA_OPT__(a)
|
||||
|
@ -24,6 +44,7 @@
|
|||
#define NEGATE(a) VA_TEST(a, a)
|
||||
#define COND_P(cond, a, b) STUFF(a, cond)STUFF(b, NEGATE(cond))
|
||||
#define COND(cond, a, b) EXPAND(COND_P(cond, a, b))
|
||||
#endif
|
||||
/// @endcond
|
||||
/**
|
||||
* end of COND() set of macros
|
||||
|
|
Loading…
Reference in New Issue