2009-12-16 04:14:24 +08:00
/* RUN: %clang_cc1 -std=c90 -fsyntax-only %s -verify -pedantic-errors
2008-07-26 02:42:46 +08:00
*/
2007-11-15 00:14:50 +08:00
enum { cast_hex = ( long ) (
2008-07-26 02:42:46 +08:00
0x0 p - 1 /* expected-error {{hexadecimal floating constants are a C99 feature}} */
2007-11-15 00:14:50 +08:00
) } ;
2009-01-17 06:39:25 +08:00
/* PR2477 */
int test1 ( int a , int b ) { return a //* This is a divide followed by block comment in c89 mode */
b ; }
// comment accepted as extension /* expected-error {{// comments are not allowed in this language}}
2010-07-20 22:33:20 +08:00
void test2 ( ) {
const char * str =
" sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds " // expected-error{{string literal of length 845 exceeds maximum length 509 that C90 compilers are required to support}}
" sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds "
" sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds "
" sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds "
" sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds "
" sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds "
" sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds "
" sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds "
" sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds "
" sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds "
" sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds "
" sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds "
" sdjflksdjf lksdjf skldfjsdkljflksdjf kldsjflkdsj fldks jflsdkjfds " ;
}
2010-10-06 12:57:26 +08:00
void test3 ( ) {
2013-01-28 04:12:04 +08:00
( void ) L " \u1234 " ; // expected-error {{universal character names are only valid in C99 or C++}}
( void ) L ' \ u1234 ' ; // expected-error {{universal character names are only valid in C99 or C++}}
2010-10-06 12:57:26 +08:00
}
2012-06-15 13:07:49 +08:00
# define PREFIX(x) foo ## x
int test4 ( ) {
int PREFIX ( 0 p ) = 0 ;
int * p = & PREFIX ( 0 p + 1 ) ;
return p [ - 1 ] ;
}
2013-01-28 04:12:04 +08:00
# define MY_UCN \u00FC // expected-warning {{universal character names are only valid in C99 or C++; treating as '\' followed by identifier}}
2013-01-29 01:49:02 +08:00
# define NOT_A_UCN \h // no-warning
extern int idWithUCN \ u00FC ; // expected-warning {{universal character names are only valid in C99 or C++; treating as '\' followed by identifier}} expected-error {{expected ';'}}