IRremoteESP8266
IRmacros.h
Go to the documentation of this file.
1 #ifndef IRMACROS_H_
2 #define IRMACROS_H_
3 /****************************************************************
4  * Copyright 2022 IRremoteESP8266 project and others
5  */
7 
12 #define PP_THIRD_ARG(a, b, c, ...) c
14 #define VA_OPT_SUPPORTED_I(...) \
15  PP_THIRD_ARG(__VA_OPT__(, false), true, false, false)
16 #define VA_OPT_SUPPORTED VA_OPT_SUPPORTED_I(?)
17 
33 #if !VA_OPT_SUPPORTED
35 // #pragma message("Compiler without __VA_OPT__ support")
36 #define COND(cond, a, b) a
37 #else // !VA_OPT_SUPPORTED
38 #define NOTHING
39 #define EXPAND(...) __VA_ARGS__
40 #define STUFF_P(a, ...) __VA_OPT__(a)
41 #define STUFF(...) STUFF_P(__VA_ARGS__)
42 #define VA_TEST_P(a, ...) __VA_OPT__(NO)##THING
43 #define VA_TEST(...) VA_TEST_P(__VA_ARGS__)
44 #define NEGATE(a) VA_TEST(a, a)
45 #define COND_P(cond, a, b) STUFF(a, cond)STUFF(b, NEGATE(cond))
46 #define COND(cond, a, b) EXPAND(COND_P(cond, a, b))
47 #endif // !VA_OPT_SUPPORTED
48 
53 #endif // IRMACROS_H_