| 1 |
/* PR preprocessor/103026 */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-options "-Wbidi-chars=unpaired,ucn -fdiagnostics-show-caret" } */ |
| 4 |
/* Verify that we escape and underline pertinent bidirectional |
| 5 |
control characters when quoting the source. */ |
| 6 |
|
| 7 |
int test_unpaired_bidi () { |
| 8 |
int isAdmin = 0; |
| 9 |
/* } if (isAdmin) begin admins only */ |
| 10 |
/* { dg-warning "bidirectional" "" { target *-*-* } .-1 } */ |
| 11 |
#if 0 |
| 12 |
{ dg-begin-multiline-output "" } |
| 13 |
/*<U+202E> } <U+2066>if (isAdmin)<U+2069> <U+2066> begin admins only */ |
| 14 |
~~~~~~~~ ~~~~~~~~ ^ |
| 15 |
| | | |
| 16 |
| | end of bidirectional context |
| 17 |
U+202E (RIGHT-TO-LEFT OVERRIDE) U+2066 (LEFT-TO-RIGHT ISOLATE) |
| 18 |
{ dg-end-multiline-output "" } |
| 19 |
#endif |
| 20 |
|
| 21 |
__builtin_printf("You are an admin.\n"); |
| 22 |
/* end admins only { */ |
| 23 |
/* { dg-warning "bidirectional" "" { target *-*-* } .-1 } */ |
| 24 |
#if 0 |
| 25 |
{ dg-begin-multiline-output "" } |
| 26 |
/* end admins only <U+202E> { <U+2066>*/ |
| 27 |
~~~~~~~~ ~~~~~~~~ ^ |
| 28 |
| | | |
| 29 |
| | end of bidirectional context |
| 30 |
| U+2066 (LEFT-TO-RIGHT ISOLATE) |
| 31 |
U+202E (RIGHT-TO-LEFT OVERRIDE) |
| 32 |
{ dg-end-multiline-output "" } |
| 33 |
#endif |
| 34 |
|
| 35 |
return 0; |
| 36 |
} |
| 37 |
|
| 38 |
int LRE__PDF_\u202c; |
| 39 |
/* { dg-warning "mismatch" "" { target *-*-* } .-1 } */ |
| 40 |
#if 0 |
| 41 |
{ dg-begin-multiline-output "" } |
| 42 |
int LRE_<U+202A>_PDF_\u202c; |
| 43 |
~~~~~~~~ ^~~~~~ |
| 44 |
{ dg-end-multiline-output "" } |
| 45 |
#endif |
| 46 |
|
| 47 |
const char *s1 = "LRE__PDF_\u202c"; |
| 48 |
/* { dg-warning "mismatch" "" { target *-*-* } .-1 } */ |
| 49 |
#if 0 |
| 50 |
{ dg-begin-multiline-output "" } |
| 51 |
const char *s1 = "LRE_<U+202A>_PDF_\u202c"; |
| 52 |
~~~~~~~~ ^~~~~~ |
| 53 |
{ dg-end-multiline-output "" } |
| 54 |
#endif |