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
|
2013-01-30 09:52:57 +08:00
|
|
|
|
// RUN: %clang_cc1 -E -DPP_ONLY=1 %s -o %t
|
|
|
|
|
// RUN: FileCheck --strict-whitespace --input-file=%t %s
|
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}}
|
2013-01-30 09:52:57 +08:00
|
|
|
|
CHECK: The preprocessor should not complain about Unicode characters like ©.
|
|
|
|
|
#endif
|
2015-09-19 10:14:12 +08:00
|
|
|
|
|
|
|
|
|
// A 🌹 by any other name....
|
|
|
|
|
extern int 🌹;
|
|
|
|
|
int 🌵(int 🌻) { return 🌻+ 1; }
|
|
|
|
|
int main () {
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
int ∣foo; // expected-error {{non-ASCII character}}
|
|
|
|
|
#ifndef PP_ONLY
|
|
|
|
|
#define ∶ x // expected-error {{macro name must be an identifier}}
|
|
|
|
|
#endif
|