| 1 | // RUN: %clang_cc1 -fsyntax-only -verify -x c -std=c11 %s |
| 2 | // RUN: %clang_cc1 -fsyntax-only -verify -x c++ -std=c++11 %s |
| 3 | // RUN: %clang_cc1 -E -DPP_ONLY=1 %s -o %t |
| 4 | // RUN: FileCheck --strict-whitespace --input-file=%t %s |
| 5 | |
| 6 | // This file contains Unicode characters; please do not "fix" them! |
| 7 | |
| 8 | extern int x; // expected-warning {{treating Unicode character as whitespace}} |
| 9 | extern int x; // expected-warning {{treating Unicode character as whitespace}} |
| 10 | |
| 11 | // CHECK: extern int {{x}} |
| 12 | // CHECK: extern int {{x}} |
| 13 | |
| 14 | #pragma mark ¡Unicode! |
| 15 | |
| 16 | #define COPYRIGHT Copyright © 2012 |
| 17 | #define XSTR(X) #X |
| 18 | #define STR(X) XSTR(X) |
| 19 | |
| 20 | static const char *copyright = STR(COPYRIGHT); // no-warning |
| 21 | // CHECK: static const char *copyright = "Copyright © {{2012}}"; |
| 22 | |
| 23 | #if PP_ONLY |
| 24 | COPYRIGHT |
| 25 | // CHECK: Copyright © {{2012}} |
| 26 | CHECK: The preprocessor should not complain about Unicode characters like ©. |
| 27 | #endif |
| 28 | |
| 29 | // A 🌹 by any other name.... |
| 30 | extern int 🌹; |
| 31 | int 🌵(int 🌻) { return 🌻+ 1; } |
| 32 | int main () { |
| 33 | int 🌷 = 🌵(🌹); |
| 34 | return 🌷; |
| 35 | } |
| 36 | |
| 37 | int n; = 3; // expected-warning {{treating Unicode character <U+037E> as identifier character rather than as ';' symbol}} |
| 38 | int *n꞉꞉v = &n;; // expected-warning 2{{treating Unicode character <U+A789> as identifier character rather than as ':' symbol}} |
| 39 | // expected-warning@-1 {{treating Unicode character <U+037E> as identifier character rather than as ';' symbol}} |
| 40 | int v=[=](auto){return~x;}(); // expected-warning 12{{treating Unicode character}} |
| 41 | |
| 42 | int xx; |
| 43 | // expected-warning@-1 {{identifier contains Unicode character <U+2060> that is invisible in some environments}} |
| 44 | // expected-warning@-2 {{identifier contains Unicode character <U+FEFF> that is invisible in some environments}} |
| 45 | // expected-warning@-3 {{identifier contains Unicode character <U+200D> that is invisible in some environments}} |
| 46 | int foobar = 0; // expected-warning {{identifier contains Unicode character <U+200B> that is invisible in some environments}} |
| 47 | int x = foobar; // expected-error {{undeclared identifier}} |
| 48 | |
| 49 | int ∣foo; // expected-error {{non-ASCII character}} |
| 50 | #ifndef PP_ONLY |
| 51 | #define ∶ x // expected-error {{macro name must be an identifier}} |
| 52 | #endif |
| 53 | |