annotate gcc/testsuite/gcc.dg/pr69554-1.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* { dg-options "-fdiagnostics-show-caret" } */
kono
parents:
diff changeset
2
kono
parents:
diff changeset
3 /* Various versions of the same C error, with a variety of line spacing,
kono
parents:
diff changeset
4 and of columns, to exercise the line-span handling in
kono
parents:
diff changeset
5 diagnostic-show-locus.c (PR other/69554). */
kono
parents:
diff changeset
6
kono
parents:
diff changeset
7 /* All on one line. */
kono
parents:
diff changeset
8
kono
parents:
diff changeset
9 int test_1 (const char *p, const char *q)
kono
parents:
diff changeset
10 {
kono
parents:
diff changeset
11 return (p + 1) + (q + 1); /* { dg-error "invalid operands" } */
kono
parents:
diff changeset
12 /* { dg-begin-multiline-output "" }
kono
parents:
diff changeset
13 return (p + 1) + (q + 1);
kono
parents:
diff changeset
14 ~~~~~~~ ^ ~~~~~~~
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
15 | |
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
16 | const char *
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
17 const char *
111
kono
parents:
diff changeset
18 { dg-end-multiline-output "" } */
kono
parents:
diff changeset
19 }
kono
parents:
diff changeset
20
kono
parents:
diff changeset
21 /* On separate lines, but without intervening lines.
kono
parents:
diff changeset
22 This can be printed as a single span of lines. */
kono
parents:
diff changeset
23
kono
parents:
diff changeset
24 int test_2 (const char *p, const char *q)
kono
parents:
diff changeset
25 {
kono
parents:
diff changeset
26 return (p + 1)
kono
parents:
diff changeset
27 + /* { dg-error "invalid operands" } */
kono
parents:
diff changeset
28 (q + 1);
kono
parents:
diff changeset
29 /* { dg-begin-multiline-output "" }
kono
parents:
diff changeset
30 return (p + 1)
kono
parents:
diff changeset
31 ~~~~~~~
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
32 |
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
33 const char *
111
kono
parents:
diff changeset
34 +
kono
parents:
diff changeset
35 ^
kono
parents:
diff changeset
36 (q + 1);
kono
parents:
diff changeset
37 ~~~~~~~
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
38 |
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
39 const char *
111
kono
parents:
diff changeset
40 { dg-end-multiline-output "" } */
kono
parents:
diff changeset
41 }
kono
parents:
diff changeset
42
kono
parents:
diff changeset
43 /* On separate lines, with an intervening line between lines 1 and 2.
kono
parents:
diff changeset
44 This is printed as 2 "spans" of lines, broken up by the intervening
kono
parents:
diff changeset
45 line. */
kono
parents:
diff changeset
46
kono
parents:
diff changeset
47 int test_3 (const char *p, const char *q)
kono
parents:
diff changeset
48 {
kono
parents:
diff changeset
49 return (p + 1) /* { dg-locus "10" } */
kono
parents:
diff changeset
50
kono
parents:
diff changeset
51 + /* { dg-error "invalid operands" } */
kono
parents:
diff changeset
52 (q + 1);
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
53 /* { dg-locus "12" "" { target *-*-* } "51" } */
111
kono
parents:
diff changeset
54 /* { dg-begin-multiline-output "" }
kono
parents:
diff changeset
55 return (p + 1)
kono
parents:
diff changeset
56 ~~~~~~~
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
57 |
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
58 const char *
111
kono
parents:
diff changeset
59 { dg-end-multiline-output "" } */
kono
parents:
diff changeset
60 /* { dg-begin-multiline-output "" }
kono
parents:
diff changeset
61 +
kono
parents:
diff changeset
62 ^
kono
parents:
diff changeset
63 (q + 1);
kono
parents:
diff changeset
64 ~~~~~~~
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
65 |
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
66 const char *
111
kono
parents:
diff changeset
67 { dg-end-multiline-output "" } */
kono
parents:
diff changeset
68 }
kono
parents:
diff changeset
69
kono
parents:
diff changeset
70 /* As above, but the intervening line is between lines 2 and 3,
kono
parents:
diff changeset
71 so that the 2 spans are grouped the other way. */
kono
parents:
diff changeset
72
kono
parents:
diff changeset
73 int test_4 (const char *p, const char *q)
kono
parents:
diff changeset
74 {
kono
parents:
diff changeset
75 return (p + 1)
kono
parents:
diff changeset
76 + /* { dg-error "invalid operands" } */
kono
parents:
diff changeset
77
kono
parents:
diff changeset
78 (q + 1); /* { dg-locus "14" } */
kono
parents:
diff changeset
79 /* { dg-begin-multiline-output "" }
kono
parents:
diff changeset
80 return (p + 1)
kono
parents:
diff changeset
81 ~~~~~~~
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
82 |
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
83 const char *
111
kono
parents:
diff changeset
84 +
kono
parents:
diff changeset
85 ^
kono
parents:
diff changeset
86 { dg-end-multiline-output "" } */
kono
parents:
diff changeset
87 /* { dg-begin-multiline-output "" }
kono
parents:
diff changeset
88 (q + 1);
kono
parents:
diff changeset
89 ~~~~~~~
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
90 |
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
91 const char *
111
kono
parents:
diff changeset
92 { dg-end-multiline-output "" } */
kono
parents:
diff changeset
93 }
kono
parents:
diff changeset
94
kono
parents:
diff changeset
95 /* On separate lines, with intervening lines.
kono
parents:
diff changeset
96 This is printed as 3 "spans" of lines, each span being an
kono
parents:
diff changeset
97 individual line. */
kono
parents:
diff changeset
98
kono
parents:
diff changeset
99 int test_5 (const char *p, const char *q)
kono
parents:
diff changeset
100 {
kono
parents:
diff changeset
101 return (p + 1) /* { dg-locus "10" } */
kono
parents:
diff changeset
102
kono
parents:
diff changeset
103 + /* { dg-error "invalid operands" } */
kono
parents:
diff changeset
104
kono
parents:
diff changeset
105 (q + 1); /* { dg-locus "14" } */
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
106 /* { dg-locus "12" "" { target *-*-* } "103" } */
111
kono
parents:
diff changeset
107 /* { dg-begin-multiline-output "" }
kono
parents:
diff changeset
108 return (p + 1)
kono
parents:
diff changeset
109 ~~~~~~~
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
110 |
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
111 const char *
111
kono
parents:
diff changeset
112 { dg-end-multiline-output "" } */
kono
parents:
diff changeset
113 /* { dg-begin-multiline-output "" }
kono
parents:
diff changeset
114 +
kono
parents:
diff changeset
115 ^
kono
parents:
diff changeset
116 { dg-end-multiline-output "" } */
kono
parents:
diff changeset
117 /* { dg-begin-multiline-output "" }
kono
parents:
diff changeset
118 (q + 1);
kono
parents:
diff changeset
119 ~~~~~~~
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
120 |
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
121 const char *
111
kono
parents:
diff changeset
122 { dg-end-multiline-output "" } */
kono
parents:
diff changeset
123 }
kono
parents:
diff changeset
124
kono
parents:
diff changeset
125 /* On separate lines, with numerous intervening lines.
kono
parents:
diff changeset
126 This is printed as 3 "spans" of lines, each span being an
kono
parents:
diff changeset
127 individual line. */
kono
parents:
diff changeset
128
kono
parents:
diff changeset
129 int test_6 (const char *p, const char *q)
kono
parents:
diff changeset
130 {
kono
parents:
diff changeset
131 return (p + 1) /* { dg-locus "10" } */
kono
parents:
diff changeset
132 /* Lorem ipsum dolor sit amet, consectetur adipiscing elit.
kono
parents:
diff changeset
133 Maecenas nisl sapien, rutrum non euismod et, rutrum ac felis.
kono
parents:
diff changeset
134 Morbi nec nisi ipsum. Quisque pulvinar ante nec urna rhoncus,
kono
parents:
diff changeset
135 a cursus nisi commodo. Praesent euismod neque lectus, at
kono
parents:
diff changeset
136 dapibus ipsum gravida in. Pellentesque tempor massa eu viverra
kono
parents:
diff changeset
137 feugiat. Proin eleifend pulvinar urna, ut dapibus metus vehicula
kono
parents:
diff changeset
138 ac. Suspendisse rutrum finibus quam, ac dignissim diam blandit
kono
parents:
diff changeset
139 maximus. In blandit viverra pulvinar. Praesent vel tellus
kono
parents:
diff changeset
140 elementum, placerat lacus quis, ornare lectus. Donec ac
kono
parents:
diff changeset
141 eleifend nulla, sit amet condimentum risus. Vestibulum aliquam
kono
parents:
diff changeset
142 maximus ante non pellentesque. Praesent mollis ante in risus
kono
parents:
diff changeset
143 feugiat hendrerit. Praesent feugiat maximus urna nec blandit. */
kono
parents:
diff changeset
144 + /* { dg-error "invalid operands" } */
kono
parents:
diff changeset
145 /* Vestibulum ac nunc eget enim tempor tristique. Suspendisse
kono
parents:
diff changeset
146 potenti. Nam et sollicitudin enim. Morbi sed tincidunt lectus.
kono
parents:
diff changeset
147 Sed facilisis velit at ante maximus feugiat. Sed vestibulum mi
kono
parents:
diff changeset
148 id leo tempor, sed ullamcorper sapien efficitur. Vestibulum purus
kono
parents:
diff changeset
149 lacus, dignissim non magna at, tincidunt luctus nisl. Cum sociis
kono
parents:
diff changeset
150 natoque penatibus et magnis dis parturient montes, nascetur
kono
parents:
diff changeset
151 ridiculus mus. Donec elit elit, laoreet a dolor quis, eleifend
kono
parents:
diff changeset
152 dapibus metus. Proin lectus turpis, eleifend nec pharetra eu,
kono
parents:
diff changeset
153 fermentum in lacus. Morbi sit amet mauris orci. Nam sagittis,
kono
parents:
diff changeset
154 nibh vel fermentum dictum, purus ex hendrerit odio, feugiat
kono
parents:
diff changeset
155 fringilla sapien elit vitae nisl. Fusce mattis commodo risus
kono
parents:
diff changeset
156 nec convallis. */
kono
parents:
diff changeset
157 (q + 1); /* { dg-locus "14" } */
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
158 /* { dg-locus "12" "" { target *-*-* } "144" } */
111
kono
parents:
diff changeset
159 /* { dg-begin-multiline-output "" }
kono
parents:
diff changeset
160 return (p + 1)
kono
parents:
diff changeset
161 ~~~~~~~
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
162 |
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
163 const char *
111
kono
parents:
diff changeset
164 { dg-end-multiline-output "" } */
kono
parents:
diff changeset
165 /* { dg-begin-multiline-output "" }
kono
parents:
diff changeset
166 +
kono
parents:
diff changeset
167 ^
kono
parents:
diff changeset
168 { dg-end-multiline-output "" } */
kono
parents:
diff changeset
169 /* { dg-begin-multiline-output "" }
kono
parents:
diff changeset
170 (q + 1);
kono
parents:
diff changeset
171 ~~~~~~~
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
172 |
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
173 const char *
111
kono
parents:
diff changeset
174 { dg-end-multiline-output "" } */
kono
parents:
diff changeset
175 }