1 /* Verify that we don't emit ranges that span both
2 a macro definition location and a macro expansion location. */
4 /* { dg-options "-fdiagnostics-show-caret" } */
6 /* Various cases involving the ranges of the LHS and RHS operands to "-". */
9 start token is in macro definition ("&"),
10 end token is in macro invocation ("a" and "b"). */
12 #define M1(A, B) &A - &B /* { dg-error "invalid operands" } */
23 int test_1 (float a
, int b
)
25 return M1(a
, b
); /* { dg-message "in expansion of macro 'M1'" } */
28 /* { dg-begin-multiline-output "" }
29 #define M1(A, B) &A - &B
31 { dg-end-multiline-output "" } */
32 /* { dg-begin-multiline-output "" }
35 { dg-end-multiline-output "" } */
38 start and end tokens are both in macro invocation ("&", and "a"/"b"). */
40 #define M2(A, B) A - B /* { dg-error "invalid operands" } */
51 int test_2 (float a
, int b
)
53 return M2(&a
, &b
); /* { dg-message "in expansion of macro 'M2'" } */
56 /* { dg-begin-multiline-output "" }
57 #define M2(A, B) A - B
59 { dg-end-multiline-output "" } */
60 /* { dg-begin-multiline-output "" }
63 { dg-end-multiline-output "" } */
66 start token is in macro invocation ("&"),
67 end token is in macro definition ("a"). */
69 #define M3(OP) OP a - OP b /* { dg-error "invalid operands" } */
80 int test_3 (float a
, int b
)
82 return M3(&); /* { dg-message "in expansion of macro 'M3'" } */
85 /* { dg-begin-multiline-output "" }
86 #define M3(OP) OP a - OP b
88 { dg-end-multiline-output "" } */
89 /* { dg-begin-multiline-output "" }
92 { dg-end-multiline-output "" } */
96 start and end tokens are both in macro definition ("&a"). */
98 #define M4 &a - &b /* { dg-error "invalid operands" } */
109 int test_4 (float a
, int b
)
111 return M4
; /* { dg-message "in expansion of macro 'M4'" } */
114 /* { dg-begin-multiline-output "" }
120 { dg-end-multiline-output "" } */
121 /* { dg-begin-multiline-output "" }
124 { dg-end-multiline-output "" } */