aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/cpp/ucnid-7-utf8.c
blob: 22aff7eaed5c09208c588d6c47257e9dab60de52 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/* { dg-do compile } */
/* { dg-options "-std=c99" } */

/* When GCC reads UTF-8-encoded input into its internal UTF-8
representation, it does not apply any transformation to the data, and
in particular it makes no attempt to verify that the encoding is valid
UTF-8.  Historically, if any non-ASCII characters were found outside a
string or comment, they were treated as stray tokens and did not
necessarily produce an error, e.g. if, as in this test, they disappear
in the preprocessor.  Now that UTF-8 is also supported in identifiers,
the basic structure of this process has not changed; GCC just treats
invalid UTF-8 as a stray token.  This test verifies that the historical
behavior is unchanged.  In the future, if GCC were changed, say, to
validate the UTF-8 on input, then this test would no longer be
appropriate.  */


#define a b(
#define b(x) q
/* The line below contains invalid UTF-8.  */
int);