Skip to content

Commit

Permalink
Attempt to clarify pw3_padded_arg_inner test
Browse files Browse the repository at this point in the history
I saw your comment Brett, before you deleted it, hopefully this makes it
slightly clearer at what my intention was and with this test and why
there are two identical macros defined.
  • Loading branch information
Eathox committed Nov 10, 2024
1 parent b6e9a4a commit 8cbe9ff
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#define HELLO(var1, var2) INNER(Hello, var1##var2)
#define GREET(var1, var2) INNER(Greetings, var1##var2)
#define TEST1(var1, var2) INNER(var1, var2)
#define TEST2(var1, var2) INNER(var1, var2) // Separate macro to trigger unique warning for INNER padding
#define INNER(var1, var2) var1 var2

value1 = HELLO(John,Smith); // Only inner
value2 = GREET(John, Smith); // Both call and inner
TEST1(John,Smith); // Only inner
TEST2(John, Smith); // Both call and inner
20 changes: 10 additions & 10 deletions libs/preprocessor/tests/warnings/pw3_padded_arg_inner/stderr.ansi
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
warning[PW3]: padding a macro argument
┌─ source.hpp:1:39
┌─ source.hpp:1:38
│
1 │ #define HELLO(var1, var2) INNER(Hello, var1##var2)
│ ^ padding a macro argument
1 │ #define TEST1(var1, var2) INNER(var1, var2)
│ ^ padding a macro argument
│
= note: padding a macro argument is likely unintended
= note: occured in: `INNER`

warning[PW3]: padding a macro argument
┌─ source.hpp:6:21
┌─ source.hpp:6:12
│
6 │ value2 = GREET(John, Smith); // Both call and inner
│ ^ padding a macro argument
6 │ TEST2(John, Smith); // Both call and inner
│ ^ padding a macro argument
│
= note: padding a macro argument is likely unintended
= note: occured in: `GREET`
= note: occured in: `TEST2`

warning[PW3]: padding a macro argument
┌─ source.hpp:2:43
┌─ source.hpp:2:38
│
2 │ #define GREET(var1, var2) INNER(Greetings, var1##var2)
│ ^ padding a macro argument
2 │ #define TEST2(var1, var2) INNER(var1, var2) // Separate macro to trigger unique warning for INNER padding
│ ^ padding a macro argument
│
= note: padding a macro argument is likely unintended
= note: occured in: `INNER`
Expand Down

0 comments on commit 8cbe9ff

Please sign in to comment.