Daily bump.
[official-gcc.git] / gcc / testsuite / c-c++-common / Wbidi-chars-5.c
blobad49498fe234e5bbb5f8e89be0aebb96e1d2eff5
1 /* PR preprocessor/103026 */
2 /* { dg-do compile } */
3 /* { dg-options "-Wbidi-chars=unpaired,ucn -Wno-multichar -Wno-overflow" } */
4 /* Test all bidi chars in various contexts (identifiers, comments,
5 string literals, character constants), both UCN and UTF-8. The bidi
6 chars here are properly terminated, except for the character constants. */
8 /* a b c LRE‪ 1 2 3 PDF‬ x y z */
9 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
10 /* a b c RLE‫ 1 2 3 PDF‬ x y z */
11 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
12 /* a b c LRO‭ 1 2 3 PDF‬ x y z */
13 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
14 /* a b c RLO‮ 1 2 3 PDF‬ x y z */
15 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
16 /* a b c LRI⁦ 1 2 3 PDI⁩ x y z */
17 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
18 /* a b c RLI⁧ 1 2 3 PDI⁩ x y */
19 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
20 /* a b c FSI⁨ 1 2 3 PDI⁩ x y z */
21 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
23 /* Same but C++ comments instead. */
24 // a b c LRE‪ 1 2 3 PDF‬ x y z
25 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
26 // a b c RLE‫ 1 2 3 PDF‬ x y z
27 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
28 // a b c LRO‭ 1 2 3 PDF‬ x y z
29 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
30 // a b c RLO‮ 1 2 3 PDF‬ x y z
31 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
32 // a b c LRI⁦ 1 2 3 PDI⁩ x y z
33 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
34 // a b c RLI⁧ 1 2 3 PDI⁩ x y
35 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
36 // a b c FSI⁨ 1 2 3 PDI⁩ x y z
37 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
39 /* Here we're closing an unopened context, warn when =any. */
40 /* a b c PDI⁩ x y z */
41 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
42 /* a b c PDF‬ x y z */
43 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
44 // a b c PDI⁩ x y z
45 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
46 // a b c PDF‬ x y z
47 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
49 /* Multiline comments. */
50 /* a b c PDI⁩ x y z
52 /* { dg-bogus "unpaired" "" { target *-*-* } .-2 } */
53 /* a b c PDF‬ x y z
55 /* { dg-bogus "unpaired" "" { target *-*-* } .-2 } */
56 /* first
57 a b c PDI⁩ x y z
59 /* { dg-bogus "unpaired" "" { target *-*-* } .-2 } */
60 /* first
61 a b c PDF‬ x y z
63 /* { dg-bogus "unpaired" "" { target *-*-* } .-2 } */
64 /* first
65 a b c PDI⁩ x y z */
66 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
67 /* first
68 a b c PDF‬ x y z */
69 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
71 void
72 g1 ()
74 const char *s1 = "a b c LRE‪ 1 2 3 PDF‬ x y z";
75 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
76 const char *s2 = "a b c RLE‫ 1 2 3 PDF‬ x y z";
77 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
78 const char *s3 = "a b c LRO‭ 1 2 3 PDF‬ x y z";
79 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
80 const char *s4 = "a b c RLO‮ 1 2 3 PDF‬ x y z";
81 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
82 const char *s5 = "a b c LRI⁦ 1 2 3 PDI⁩ x y z";
83 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
84 const char *s6 = "a b c RLI⁧ 1 2 3 PDI⁩ x y z";
85 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
86 const char *s7 = "a b c FSI⁨ 1 2 3 PDI⁩ x y z";
87 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
88 const char *s8 = "a b c PDI⁩ x y z";
89 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
90 const char *s9 = "a b c PDF‬ x y z";
91 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
93 const char *s10 = "a b c LRE\u202a 1 2 3 PDF\u202c x y z";
94 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
95 const char *s11 = "a b c LRE\u202A 1 2 3 PDF\u202c x y z";
96 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
97 const char *s12 = "a b c RLE\u202b 1 2 3 PDF\u202c x y z";
98 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
99 const char *s13 = "a b c RLE\u202B 1 2 3 PDF\u202c x y z";
100 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
101 const char *s14 = "a b c LRO\u202d 1 2 3 PDF\u202c x y z";
102 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
103 const char *s15 = "a b c LRO\u202D 1 2 3 PDF\u202c x y z";
104 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
105 const char *s16 = "a b c RLO\u202e 1 2 3 PDF\u202c x y z";
106 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
107 const char *s17 = "a b c RLO\u202E 1 2 3 PDF\u202c x y z";
108 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
109 const char *s18 = "a b c LRI\u2066 1 2 3 PDI\u2069 x y z";
110 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
111 const char *s19 = "a b c RLI\u2067 1 2 3 PDI\u2069 x y z";
112 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
113 const char *s20 = "a b c FSI\u2068 1 2 3 PDI\u2069 x y z";
114 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
117 void
118 g2 ()
120 const char c1 = '\u202a';
121 /* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
122 const char c2 = '\u202A';
123 /* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
124 const char c3 = '\u202b';
125 /* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
126 const char c4 = '\u202B';
127 /* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
128 const char c5 = '\u202d';
129 /* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
130 const char c6 = '\u202D';
131 /* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
132 const char c7 = '\u202e';
133 /* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
134 const char c8 = '\u202E';
135 /* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
136 const char c9 = '\u2066';
137 /* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
138 const char c10 = '\u2067';
139 /* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
140 const char c11 = '\u2068';
141 /* { dg-warning "unpaired" "" { target *-*-* } .-1 } */
144 int a‪b‬c;
145 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
146 int a‫b‬c;
147 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
148 int a‭b‬c;
149 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
150 int a‮b‬c;
151 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
152 int a⁦b⁩c;
153 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
154 int a⁧b⁩c;
155 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
156 int a⁨b⁩c;
157 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
158 int A‬X;
159 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
160 int A\u202cY;
161 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
162 int A\u202CY2;
163 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
165 int d\u202ae\u202cf;
166 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
167 int d\u202Ae\u202cf2;
168 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
169 int d\u202be\u202cf;
170 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
171 int d\u202Be\u202cf2;
172 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
173 int d\u202de\u202cf;
174 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
175 int d\u202De\u202cf2;
176 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
177 int d\u202ee\u202cf;
178 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
179 int d\u202Ee\u202cf2;
180 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
181 int d\u2066e\u2069f;
182 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
183 int d\u2067e\u2069f;
184 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
185 int d\u2068e\u2069f;
186 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */
187 int X\u2069;
188 /* { dg-bogus "unpaired" "" { target *-*-* } .-1 } */