[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Lexer / c90.c
blob8752404c1c19993feb83f268d104b18e827824a9
1 /* RUN: %clang_cc1 -std=c90 -fsyntax-only %s -verify -pedantic-errors
2 */
4 enum { cast_hex = (long) (
5 0x0p-1 /* expected-error {{hexadecimal floating constants are a C99 feature}} */
6 ) };
8 /* PR2477 */
9 int test1(int a,int b) {return a//* This is a divide followed by block comment in c89 mode */
10 b;}
12 // comment accepted as extension /* expected-error {{// comments are not allowed in this language}}
14 void test2(void) {
15 const char * str =
16 "sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds" // expected-error{{string literal of length 845 exceeds maximum length 509 that C90 compilers are required to support}}
17 "sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds"
18 "sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds"
19 "sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds"
20 "sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds"
21 "sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds"
22 "sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds"
23 "sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds"
24 "sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds"
25 "sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds"
26 "sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds"
27 "sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds"
28 "sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds";
31 void test3(void) {
32 (void)L"\u1234"; // expected-error {{universal character names are only valid in C99 or C++}}
33 (void)L'\u1234'; // expected-error {{universal character names are only valid in C99 or C++}}
36 #define PREFIX(x) foo ## x
37 int test4(void) {
38 int PREFIX(0p) = 0;
39 int *p = &PREFIX(0p+1);
40 return p[-1];
43 #define MY_UCN \u00FC // expected-warning {{universal character names are only valid in C99 or C++; treating as '\' followed by identifier}}
44 #define NOT_A_UCN \h // no-warning
46 extern int idWithUCN\u00FC; // expected-warning {{universal character names are only valid in C99 or C++; treating as '\' followed by identifier}} expected-error {{expected ';'}}