@@ -18,6 +18,13 @@
* @body: identifiers to be introduced conditionally
*/
#define DECLARE_IF_KUNIT(body...) body
+ /**
+ * ONLY_IF_KUNIT - A macro that adds expression statement only if
+ * CONFIG_KUNIT is enabled. Otherwise if CONFIG_KUNIT is not enabled
+ * it will evaluate always to 0.
+ * @expr: expression to be introduced conditionally
+ */
+ #define ONLY_IF_KUNIT(expr...) expr
/**
* VISIBLE_IF_KUNIT - A macro that sets symbols to be static if
* CONFIG_KUNIT is not enabled. Otherwise if CONFIG_KUNIT is enabled
@@ -34,6 +41,7 @@
EXPORTED_FOR_KUNIT_TESTING)
#else
#define DECLARE_IF_KUNIT(body...)
+ #define ONLY_IF_KUNIT(expr...) 0
#define VISIBLE_IF_KUNIT static
#define EXPORT_SYMBOL_IF_KUNIT(symbol)
#endif
The ONLY_IF_KUNIT macro will add expression statement only if the CONFIG_KUNIT is enabled. Otherwise if CONFIG_KUNIT is not enabled it will evaluate always to 0. Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com> --- Cc: Rae Moar <rmoar@google.com> Cc: David Gow <davidgow@google.com> Cc: Lucas De Marchi <lucas.demarchi@intel.com> --- include/kunit/visibility.h | 8 ++++++++ 1 file changed, 8 insertions(+)