Skip to content

Commit

Permalink
test_runner: fix STRINGIFY macro so it expands correctly as intended
Browse files Browse the repository at this point in the history
Now `STRINGIFY(EXIT_SUCCESS)` is "EXIT_SUCCESS" not "0" for example.
The other expanding version is now called `EXPAND_AND_STRINGIFY`.
  • Loading branch information
kkysen committed Dec 21, 2024
1 parent b419950 commit e346f66
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions misc/test_runner/include/ia2_test_runner.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ struct fake_criterion_test {

extern struct fake_criterion_test *fake_criterion_tests;

#define _STRINGIFY(a) #a
#define STRINGIFY(a) _STRINGIFY(a)
#define STRINGIFY(a) #a
#define EXPAND_AND_STRINGIFY(a) STRINGIFY(a)

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

0 comments on commit e346f66

Please sign in to comment.