Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inhibit protocol names for not-included protocols #1853

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions src/IRmacros.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#ifndef IRMACROS_H_
#define IRMACROS_H_
/****************************************************************
* Copyright 2022 IRremoteESP8266 project and others
*/
/// @file IRmacros.h

/**
* COND() Set of macros to facilitate single-line conditional compilation
* argument checking.
* Found here: https://www.reddit.com/r/C_Programming/comments/ud3xrv/
* conditional_preprocessor_macro_anyone/
*
* Usage:
* COND(<define_to_test>[||/&&<more_define>...], <true_result>, <false_result>)
*/
/// @cond TEST
#define NOTHING
#define EXPAND(...) __VA_ARGS__
#define STUFF_P(a, ...) __VA_OPT__(a)
#define STUFF(...) STUFF_P(__VA_ARGS__)
#define VA_TEST_P(a, ...) __VA_OPT__(NO)##THING
#define VA_TEST(...) VA_TEST_P(__VA_ARGS__)
#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))
/// @endcond
/**
* end of COND() set of macros
*/

#endif // IRMACROS_H_
2 changes: 2 additions & 0 deletions src/IRremoteESP8266.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@
#include <string>
#endif // UNIT_TEST

#include "IRmacros.h"

// Library Version Information
// Major version number (X.x.x)
#define _IRREMOTEESP8266_VERSION_MAJOR 2
Expand Down
Loading