2015-09-19 10:14:12 +08:00
|
|
|
|
// RUN: %clang_cc1 -fsyntax-only -verify -x c -std=c11 %s
|
|
|
|
|
// RUN: %clang_cc1 -fsyntax-only -verify -x c++ -std=c++11 %s
|
2021-08-18 21:30:36 +08:00
|
|
|
|
// RUN: %clang_cc1 -std=c99 -E -DPP_ONLY=1 %s | FileCheck %s --strict-whitespace
|
2021-08-18 21:10:34 +08:00
|
|
|
|
// RUN: %clang_cc1 -E -DPP_ONLY=1 %s | FileCheck %s --strict-whitespace
|
2013-01-25 04:50:50 +08:00
|
|
|
|
|
|
|
|
|
// This file contains Unicode characters; please do not "fix" them!
|
|
|
|
|
|
|
|
|
|
extern int x; // expected-warning {{treating Unicode character as whitespace}}
|
|
|
|
|
extern int x; // expected-warning {{treating Unicode character as whitespace}}
|
2013-01-30 09:52:57 +08:00
|
|
|
|
|
|
|
|
|
// CHECK: extern int {{x}}
|
|
|
|
|
// CHECK: extern int {{x}}
|
|
|
|
|
|
2013-02-01 03:48:48 +08:00
|
|
|
|
#pragma mark ¡Unicode!
|
|
|
|
|
|
|
|
|
|
#define COPYRIGHT Copyright © 2012
|
|
|
|
|
#define XSTR(X) #X
|
|
|
|
|
#define STR(X) XSTR(X)
|
|
|
|
|
|
|
|
|
|
static const char *copyright = STR(COPYRIGHT); // no-warning
|
|
|
|
|
// CHECK: static const char *copyright = "Copyright © {{2012}}";
|
|
|
|
|
|
2013-01-30 09:52:57 +08:00
|
|
|
|
#if PP_ONLY
|
2013-02-01 03:48:48 +08:00
|
|
|
|
COPYRIGHT
|
|
|
|
|
// CHECK: Copyright © {{2012}}
|
2021-08-18 19:33:14 +08:00
|
|
|
|
CHECK : The preprocessor should not complain about Unicode characters like ©.
|
2013-01-30 09:52:57 +08:00
|
|
|
|
#endif
|
2015-09-19 10:14:12 +08:00
|
|
|
|
|
2021-08-18 19:33:14 +08:00
|
|
|
|
int _;
|
|
|
|
|
|
2022-05-06 07:44:41 +08:00
|
|
|
|
extern int X\UAAAAAAAA; // expected-error {{not allowed in an identifier}}
|
|
|
|
|
int Y = '\UAAAAAAAA'; // expected-error {{invalid universal character}}
|
|
|
|
|
|
2021-08-18 19:33:14 +08:00
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
|
|
|
|
|
extern int ༀ;
|
|
|
|
|
extern int 𑩐;
|
|
|
|
|
extern int 𐠈;
|
|
|
|
|
extern int ꙮ;
|
2021-09-17 01:20:35 +08:00
|
|
|
|
extern int \u1B4C; // BALINESE LETTER ARCHAIC JNYA - Added in Unicode 14
|
|
|
|
|
extern int \U00016AA2; // TANGSA LETTER GA - Added in Unicode 14
|
2022-04-04 18:41:12 +08:00
|
|
|
|
extern int _\N{TANGSA LETTER GA};
|
|
|
|
|
extern int _\N{TANGSALETTERGA}; // expected-error {{'TANGSALETTERGA' is not a valid Unicode character name}} \
|
|
|
|
|
// expected-note {{characters names in Unicode escape sequences are sensitive to case and whitespace}}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-09-17 01:20:35 +08:00
|
|
|
|
// This character doesn't have the XID_Start property
|
|
|
|
|
extern int \U00016AC0; // TANGSA DIGIT ZERO // expected-error {{expected unqualified-id}}
|
2021-08-18 19:33:14 +08:00
|
|
|
|
|
|
|
|
|
extern int 🌹; // expected-error {{unexpected character <U+1F339>}} \
|
|
|
|
|
expected-warning {{declaration does not declare anything}}
|
|
|
|
|
|
|
|
|
|
extern int 👷; // expected-error {{unexpected character <U+1F477>}} \
|
|
|
|
|
expected-warning {{declaration does not declare anything}}
|
|
|
|
|
|
|
|
|
|
extern int 👷♀; // expected-warning {{declaration does not declare anything}} \
|
|
|
|
|
expected-error {{unexpected character <U+1F477>}} \
|
|
|
|
|
expected-error {{unexpected character <U+200D>}} \
|
|
|
|
|
expected-error {{unexpected character <U+2640>}}
|
|
|
|
|
#else
|
|
|
|
|
|
2015-09-19 10:14:12 +08:00
|
|
|
|
// A 🌹 by any other name....
|
|
|
|
|
extern int 🌹;
|
|
|
|
|
int 🌵(int 🌻) { return 🌻+ 1; }
|
2022-02-10 06:13:53 +08:00
|
|
|
|
int main (void) {
|
2015-09-19 10:14:12 +08:00
|
|
|
|
int 🌷 = 🌵(🌹);
|
|
|
|
|
return 🌷;
|
|
|
|
|
}
|
2017-12-14 21:15:08 +08:00
|
|
|
|
|
|
|
|
|
int n; = 3; // expected-warning {{treating Unicode character <U+037E> as identifier character rather than as ';' symbol}}
|
|
|
|
|
int *n꞉꞉v = &n;; // expected-warning 2{{treating Unicode character <U+A789> as identifier character rather than as ':' symbol}}
|
|
|
|
|
// expected-warning@-1 {{treating Unicode character <U+037E> as identifier character rather than as ';' symbol}}
|
|
|
|
|
int v=[=](auto){return~x;}(); // expected-warning 12{{treating Unicode character}}
|
2018-09-08 03:25:39 +08:00
|
|
|
|
|
|
|
|
|
int xx;
|
|
|
|
|
// expected-warning@-1 {{identifier contains Unicode character <U+2060> that is invisible in some environments}}
|
|
|
|
|
// expected-warning@-2 {{identifier contains Unicode character <U+FEFF> that is invisible in some environments}}
|
|
|
|
|
// expected-warning@-3 {{identifier contains Unicode character <U+200D> that is invisible in some environments}}
|
|
|
|
|
int foobar = 0; // expected-warning {{identifier contains Unicode character <U+200B> that is invisible in some environments}}
|
|
|
|
|
int x = foobar; // expected-error {{undeclared identifier}}
|
2018-09-26 06:34:45 +08:00
|
|
|
|
|
2021-08-18 19:33:14 +08:00
|
|
|
|
int ∣foo; // expected-error {{unexpected character <U+2223>}}
|
2018-09-26 06:34:45 +08:00
|
|
|
|
#ifndef PP_ONLY
|
|
|
|
|
#define ∶ x // expected-error {{macro name must be an identifier}}
|
|
|
|
|
#endif
|
2021-08-18 19:33:14 +08:00
|
|
|
|
|
|
|
|
|
#endif
|