Skip analyzer strndup test on hppa*-*-hpux*
[official-gcc.git] / gcc / testsuite / gcc.dg / pr69554-1.c
blobb979b5596f2a443ad21f14e6e8251183afdad0b0
1 /* { dg-options "-fdiagnostics-show-caret" } */
3 /* Various versions of the same C error, with a variety of line spacing,
4 and of columns, to exercise the line-span handling in
5 diagnostic-show-locus.c (PR other/69554). */
7 /* All on one line. */
9 int test_1 (const char *p, const char *q)
11 return (p + 1) + (q + 1); /* { dg-error "invalid operands" } */
12 /* { dg-begin-multiline-output "" }
13 return (p + 1) + (q + 1);
14 ~~~~~~~ ^ ~~~~~~~
15 | |
16 | const char *
17 const char *
18 { dg-end-multiline-output "" } */
21 /* On separate lines, but without intervening lines.
22 This can be printed as a single span of lines. */
24 int test_2 (const char *p, const char *q)
26 return (p + 1)
27 + /* { dg-error "invalid operands" } */
28 (q + 1);
29 /* { dg-begin-multiline-output "" }
30 return (p + 1)
31 ~~~~~~~
33 const char *
36 (q + 1);
37 ~~~~~~~
39 const char *
40 { dg-end-multiline-output "" } */
43 /* On separate lines, with an intervening line between lines 1 and 2.
44 This is printed as 2 "spans" of lines, broken up by the intervening
45 line. */
47 int test_3 (const char *p, const char *q)
49 return (p + 1) /* { dg-locus "10" } */
51 + /* { dg-error "invalid operands" } */
52 (q + 1);
53 /* { dg-locus "12" "" { target *-*-* } "51" } */
54 /* { dg-begin-multiline-output "" }
55 return (p + 1)
56 ~~~~~~~
58 const char *
59 { dg-end-multiline-output "" } */
60 /* { dg-begin-multiline-output "" }
63 (q + 1);
64 ~~~~~~~
66 const char *
67 { dg-end-multiline-output "" } */
70 /* As above, but the intervening line is between lines 2 and 3,
71 so that the 2 spans are grouped the other way. */
73 int test_4 (const char *p, const char *q)
75 return (p + 1)
76 + /* { dg-error "invalid operands" } */
78 (q + 1); /* { dg-locus "14" } */
79 /* { dg-begin-multiline-output "" }
80 return (p + 1)
81 ~~~~~~~
83 const char *
86 { dg-end-multiline-output "" } */
87 /* { dg-begin-multiline-output "" }
88 (q + 1);
89 ~~~~~~~
91 const char *
92 { dg-end-multiline-output "" } */
95 /* On separate lines, with intervening lines.
96 This is printed as 3 "spans" of lines, each span being an
97 individual line. */
99 int test_5 (const char *p, const char *q)
101 return (p + 1) /* { dg-locus "10" } */
103 + /* { dg-error "invalid operands" } */
105 (q + 1); /* { dg-locus "14" } */
106 /* { dg-locus "12" "" { target *-*-* } "103" } */
107 /* { dg-begin-multiline-output "" }
108 return (p + 1)
109 ~~~~~~~
111 const char *
112 { dg-end-multiline-output "" } */
113 /* { dg-begin-multiline-output "" }
116 { dg-end-multiline-output "" } */
117 /* { dg-begin-multiline-output "" }
118 (q + 1);
119 ~~~~~~~
121 const char *
122 { dg-end-multiline-output "" } */
125 /* On separate lines, with numerous intervening lines.
126 This is printed as 3 "spans" of lines, each span being an
127 individual line. */
129 int test_6 (const char *p, const char *q)
131 return (p + 1) /* { dg-locus "10" } */
132 /* Lorem ipsum dolor sit amet, consectetur adipiscing elit.
133 Maecenas nisl sapien, rutrum non euismod et, rutrum ac felis.
134 Morbi nec nisi ipsum. Quisque pulvinar ante nec urna rhoncus,
135 a cursus nisi commodo. Praesent euismod neque lectus, at
136 dapibus ipsum gravida in. Pellentesque tempor massa eu viverra
137 feugiat. Proin eleifend pulvinar urna, ut dapibus metus vehicula
138 ac. Suspendisse rutrum finibus quam, ac dignissim diam blandit
139 maximus. In blandit viverra pulvinar. Praesent vel tellus
140 elementum, placerat lacus quis, ornare lectus. Donec ac
141 eleifend nulla, sit amet condimentum risus. Vestibulum aliquam
142 maximus ante non pellentesque. Praesent mollis ante in risus
143 feugiat hendrerit. Praesent feugiat maximus urna nec blandit. */
144 + /* { dg-error "invalid operands" } */
145 /* Vestibulum ac nunc eget enim tempor tristique. Suspendisse
146 potenti. Nam et sollicitudin enim. Morbi sed tincidunt lectus.
147 Sed facilisis velit at ante maximus feugiat. Sed vestibulum mi
148 id leo tempor, sed ullamcorper sapien efficitur. Vestibulum purus
149 lacus, dignissim non magna at, tincidunt luctus nisl. Cum sociis
150 natoque penatibus et magnis dis parturient montes, nascetur
151 ridiculus mus. Donec elit elit, laoreet a dolor quis, eleifend
152 dapibus metus. Proin lectus turpis, eleifend nec pharetra eu,
153 fermentum in lacus. Morbi sit amet mauris orci. Nam sagittis,
154 nibh vel fermentum dictum, purus ex hendrerit odio, feugiat
155 fringilla sapien elit vitae nisl. Fusce mattis commodo risus
156 nec convallis. */
157 (q + 1); /* { dg-locus "14" } */
158 /* { dg-locus "12" "" { target *-*-* } "144" } */
159 /* { dg-begin-multiline-output "" }
160 return (p + 1)
161 ~~~~~~~
163 const char *
164 { dg-end-multiline-output "" } */
165 /* { dg-begin-multiline-output "" }
168 { dg-end-multiline-output "" } */
169 /* { dg-begin-multiline-output "" }
170 (q + 1);
171 ~~~~~~~
173 const char *
174 { dg-end-multiline-output "" } */