2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / gcc.dg / cpp / charconst.c
blob07257a74a4ff57bc1b373e6fa037a8f295110191
1 /* Copyright (C) 2001 Free Software Foundation, Inc. */
3 /* { dg-do compile } */
5 /* This tests various diagnostics about character constants, for both
6 the preprocessor and the compiler.
8 Neil Booth, 22 May 2001. */
10 #if '' /* { dg-warning "empty" "empty charconst" } */
11 #endif
12 #if L'' /* { dg-warning "empty" "empty wide charconst" } */
13 #endif
14 #if 'very long' /* { dg-warning "too long" "long charconst" } */
15 #endif
16 #if L'very long' /* { dg-warning "too long" "long wide charconst" } */
17 #endif
18 /* Don't do this test for L'ab'; it depends upon sizeof (wchar_t). */
19 #if 'ab' /* { dg-warning "multi-char" "multi-character" } */
20 #endif
22 void foo ()
24 int c;
25 __WCHAR_TYPE__ w;
27 c = ''; /* { dg-warning "empty" "empty charconst" } */
28 w = L''; /* { dg-warning "empty" "empty wide charconst" } */
30 c = 'very long'; /* { dg-warning "too long" "long charconst" } */
31 w = L'very long'; /* { dg-warning "too long" "long wide charconst" } */
33 c = 'ab'; /* { dg-warning "multi-char" "multi-char" } */
34 /* Wide charconsts cannot contain more than one wide character. */
35 w = L'ab'; /* { dg-warning "too long" "multi-char wide" } */