From 318fdd81915678cdc4e744ad9aa51cbfef2b9fc1 Mon Sep 17 00:00:00 2001 From: neil Date: Mon, 6 May 2002 22:53:10 +0000 Subject: * c-common.c (warn_multichar): New. (c_common_init): Set CPP's warn_multichar. * c-common.h (warn_multichar): New. * c-decl.c (warn_multichar): Remove. * c-lex.c (lex_charconst): Update. * c-tree.h (warn_multichar): Remove. * cppexp.c (eval_token): Sign-extend charconst value. * cppinit.c (cpp_create_reader): Set warn_multichar. * cpplex.c (cpp_interpret_charconst): Don't sign-extend each character. Update prototype. Sign-extend the result. * cpplib.h: Fix conditions. (struct cpp_options): Add new warning flag. (cpp_interpret_charconst): Update prototype. cp: * Make-lang.in (decl2.o): Update. * cp-tree.h (warn_multichar): Remove. * decl2.c: Include c-common.h. (warn_multichar): Remove. doc: * cpp.texi: Update documentation. testsuite: * gcc.dg/cpp/charconst-3.c: Correct tests accordingly. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@53240 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cpplib.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'gcc/cpplib.h') diff --git a/gcc/cpplib.h b/gcc/cpplib.h index 42eae9177e7..ca0eee2bd63 100644 --- a/gcc/cpplib.h +++ b/gcc/cpplib.h @@ -196,10 +196,10 @@ struct cpp_token #ifndef MAX_WCHAR_TYPE_SIZE # define MAX_WCHAR_TYPE_SIZE WCHAR_TYPE_SIZE #endif -#if SIZEOF_INT >= MAX_WCHAR_TYPE_SIZE +#if CHAR_BIT * SIZEOF_INT >= MAX_WCHAR_TYPE_SIZE # define CPPCHAR_SIGNED_T int #else -# if SIZEOF_LONG >= MAX_WCHAR_TYPE_SIZE || !HAVE_LONG_LONG +# if CHAR_BIT * SIZEOF_LONG >= MAX_WCHAR_TYPE_SIZE || !HAVE_LONG_LONG # define CPPCHAR_SIGNED_T long # else # define CPPCHAR_SIGNED_T long long @@ -329,6 +329,9 @@ struct cpp_options /* Nonzero means warn if #import is used. */ unsigned char warn_import; + /* Nonzero means warn about multicharacter charconsts. */ + unsigned char warn_multichar; + /* Nonzero means warn about various incompatibilities with traditional C. */ unsigned char warn_traditional; @@ -558,7 +561,7 @@ extern void _cpp_backup_tokens PARAMS ((cpp_reader *, unsigned int)); /* Evaluate a CPP_CHAR or CPP_WCHAR token. */ extern cppchar_t cpp_interpret_charconst PARAMS ((cpp_reader *, const cpp_token *, - int, unsigned int *, int *)); + unsigned int *, int *)); /* Used to register builtins during the register_builtins callback. The text is the same as the command line argument. */ -- cgit v1.2.3