8sa1-gcc/gcc/testsuite/gcc.dg/cpp/escape.c
Neil Booth f8710242d3 cpp.texi: Update for handling of charconsts.
* 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.

From-SVN: r42514
2001-05-23 22:50:28 +00:00

26 lines
818 B
C

/* Copyright (C) 2001 Free Software Foundation, Inc. */
/* { dg-do compile } */
/* { dg-options "-Wtraditional -std=c89 -fno-show-column" } */
/* This tests various diagnostics with -Wtraditioanl about escape
sequences, for both the preprocessor and the compiler.
Neil Booth, 22 May 2001. */
#if '\a' /* { dg-warning "traditional" "traditional bell" } */
#endif
#if '\x1a' != 26 /* { dg-warning "traditional" "traditional hex" } */
#error bad hex /* { dg-bogus "bad" "bad hexadecimal evaluation" } */
#endif
#if '\u' /* { dg-warning "unknown" "\u is unknown in C89" } */
#endif
void foo ()
{
int c = '\a'; /* { dg-warning "traditional" "traditional bell" } */
c = '\xa1'; /* { dg-warning "traditional" "traditional hex" } */
c = '\u'; /* { dg-warning "unknown" "\u is unknown in C89" } */
}