Require target lra in gcc.dg/pr108095.c
[official-gcc.git] / gcc / testsuite / gcc.dg / pr97932.c
blob4a0b3041375d7a7f816d46a006656cff25a0877b
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 "-". */
8 /* Case 1
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" } */
14 /* Intervening
15 material
16 that
17 ought
18 not
21 printed. */
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 "" }
33 return M1(a, b);
35 { dg-end-multiline-output "" } */
37 /* Case 2:
38 start and end tokens are both in macro invocation ("&", and "a"/"b"). */
40 #define M2(A, B) A - B /* { dg-error "invalid operands" } */
42 /* Intervening
43 material
44 that
45 ought
46 not
49 printed. */
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 "" }
61 return M2(&a, &b);
63 { dg-end-multiline-output "" } */
65 /* Case 3:
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" } */
71 /* Intervening
72 material
73 that
74 ought
75 not
78 printed. */
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 "" }
90 return M3(&);
92 { dg-end-multiline-output "" } */
95 /* Case 4:
96 start and end tokens are both in macro definition ("&a"). */
98 #define M4 &a - &b /* { dg-error "invalid operands" } */
100 /* Intervening
101 material
102 that
103 ought
107 printed. */
109 int test_4 (float a, int b)
111 return M4; /* { dg-message "in expansion of macro 'M4'" } */
114 /* { dg-begin-multiline-output "" }
115 #define M4 &a - &b
116 ~~ ^ ~~
118 | int *
119 float *
120 { dg-end-multiline-output "" } */
121 /* { dg-begin-multiline-output "" }
122 return M4;
124 { dg-end-multiline-output "" } */