Skip to content

Commit

Permalink
Add test for padded inner macros
Browse files Browse the repository at this point in the history
  • Loading branch information
Eathox committed Nov 9, 2024
1 parent 0c2bca2 commit b6e9a4a
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#define HELLO(var1, var2) INNER(Hello, var1##var2)
#define GREET(var1, var2) INNER(Greetings, var1##var2)
#define INNER(var1, var2) var1 var2

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

warning[PW3]: padding a macro argument
┌─ source.hpp:2:43
│
2 │ #define GREET(var1, var2) INNER(Greetings, var1##var2)
│ ^ padding a macro argument
│
= note: padding a macro argument is likely unintended
= note: occured in: `INNER`

0 comments on commit b6e9a4a

Please sign in to comment.