1 /* RUN: %clang_cc1 -std=c90 -fsyntax-only %s -verify -pedantic-errors
2 */
3
4 enum { cast_hex = (long) (
5 0x0p-1 /* expected-error {{hexadecimal floating constants are a C99 feature}} */
6 ) };
7
8 /* PR2477 */
test1(int a,int b)9 int test1(int a,int b) {return a//* This is a divide followed by block comment in c89 mode */
10 b;}
11
12 // comment accepted as extension /* expected-error {{// comments are not allowed in this language}}
13
test2()14 void test2() {
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";
29 }
30
test3()31 void test3() {
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++}}
34 }
35
36 #define PREFIX(x) foo ## x
test4()37 int test4() {
38 int PREFIX(0p) = 0;
39 int *p = &PREFIX(0p+1);
40 return p[-1];
41 }
42
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
45
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 ';'}}
47