diff options
author | neil <neil@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-05-23 22:50:28 +0000 |
---|---|---|
committer | neil <neil@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-05-23 22:50:28 +0000 |
commit | f73bab034e2d3896f7c04159fe46dc7088135352 (patch) | |
tree | 6ccc83b80dfb184aeb83b9ad4fb992c103b4b1b0 /gcc/testsuite/gcc.dg/cpp/charconst.c | |
parent | 2df5a327e5568e6b4c2912c73b101413ad81d64c (diff) | |
download | gcc-f73bab034e2d3896f7c04159fe46dc7088135352.tar.gz |
* cpp.texi: Update for handling of charconsts.
* cpplex.c (maybe_read_ucs): Don't accept D800-DFFF. Update
diagnostics. Skip to the end if the UCS is too short.
(cpp_interpret_charconst): Long charconsts issue a warning
not an error.
* gcc.dg/cpp/charconst.c: New tests.
* gcc.dg/cpp/escape.c: New tests.
* gcc.dg/cpp/escape-1.c: New tests.
* gcc.dg/cpp/escape-2.c: New tests.
* gcc.dg/cpp/ucs.c: New tests.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@42514 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/cpp/charconst.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/cpp/charconst.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/cpp/charconst.c b/gcc/testsuite/gcc.dg/cpp/charconst.c new file mode 100644 index 00000000000..d8a178b7a9f --- /dev/null +++ b/gcc/testsuite/gcc.dg/cpp/charconst.c @@ -0,0 +1,33 @@ +/* Copyright (C) 2001 Free Software Foundation, Inc. */ + +/* { dg-do compile } */ + +/* This tests various diagnostics about character constants, for both + the preprocessor and the compiler. + + Neil Booth, 22 May 2001. */ + +#if '' /* { dg-warning "empty" "empty charconst" } */ +#endif +#if L'' /* { dg-warning "empty" "empty wide charconst" } */ +#endif +#if 'very long' /* { dg-warning "too long" "long charconst" } */ +#endif +#if L'very long' /* { dg-warning "too long" "long wide charconst" } */ +#endif +/* Don't do this test for L'ab'; it depends upon sizeof (wchar_t). */ +#if 'ab' /* { dg-warning "multi-char" "multi-character" } */ +#endif + +void foo () +{ + int c = ''; /* { dg-warning "empty" "empty charconst" } */ + c = L''; /* { dg-warning "empty" "empty wide charconst" } */ + + c = 'very long'; /* { dg-warning "too long" "long charconst" } */ + c = L'very long'; /* { dg-warning "too long" "long wide charconst" } */ + + /* Don't do this test for L'ab'; it depends upon sizeof (wchar_t). */ + c = 'ab'; /* { dg-warning "multi-char" "multi-character" } */ + +} |