#define CASE_RETURN_STRING(a) case a: return #a
+/**
+ * Concatenate two macro args into one, e.g.:
+ * int CONCAT(foo_, __LINE__);
+ * will produce:
+ * int foo_123;
+ */
+#define CONCAT2(X,Y) X##Y
+#define CONCAT(X,Y) CONCAT2(X,Y)
+
#define _fallthrough_ __attribute__((fallthrough))
void (*setup)(void);
} __attribute__((aligned(16)));
-#define TEST_COLLECTION(name) \
- static void (name##_setup)(void); \
- static const struct test_collection _test_collection \
+#define TEST_COLLECTION(name_) \
+ static void (CONCAT(name_ , __LINE__))(void); \
+ static const struct test_collection CONCAT(_test_collection_, __LINE__) \
__attribute__ ((used)) \
__attribute__ ((section ("test_collection_section"))) = { \
- #name, name##_setup \
+ #name_, CONCAT(name_, __LINE__) \
}; \
- static void (name##_setup)(void)
+ static void (CONCAT(name_, __LINE__))(void)
__attribute__ ((format (printf, 3, 0)))
void _litest_checkpoint(const char *func,