Skip to content

Commit 84f8c8a

Browse files
committed
test_runner: fix STRINGIFY macro so it expands correctly as intended
Now `STRINGIFY(EXIT_SUCCESS)` is "EXIT_SUCCESS" not "0" for example. The other expanding version is now called `EXPAND_AND_STRINGIFY`.
1 parent a820727 commit 84f8c8a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

misc/test_runner/include/ia2_test_runner.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ struct fake_criterion_test {
2828

2929
extern struct fake_criterion_test *fake_criterion_tests;
3030

31-
#define _STRINGIFY(a) #a
32-
#define STRINGIFY(a) _STRINGIFY(a)
31+
#define STRINGIFY(a) #a
32+
#define EXPAND_AND_STRINGIFY(a) STRINGIFY(a)
3333

3434
/*
3535
* Placing IA2_{BEGIN,END}_NO_WRAP between the function declaration stops the rewriter from creating a
@@ -43,8 +43,8 @@ extern struct fake_criterion_test *fake_criterion_tests;
4343
IA2_END_NO_WRAP \
4444
struct fake_criterion_test fake_criterion_##suite_##_##name_##_##test IA2_SHARED_DATA = { \
4545
.next = NULL, \
46-
.suite = STRINGIFY(suite_), \
47-
.name = STRINGIFY(name_), \
46+
.suite = EXPAND_AND_STRINGIFY(suite_), \
47+
.name = EXPAND_AND_STRINGIFY(name_), \
4848
.test = fake_criterion_##suite_##_##name_, \
4949
##__VA_ARGS__}; \
5050
__attribute__((constructor)) void fake_criterion_add_##suite_##_##name_##_##test(void) { \

0 commit comments

Comments
 (0)