diff options
author | Neil Booth <neil@daikokuya.demon.co.uk> | 2002-05-06 22:53:10 +0000 |
---|---|---|
committer | Neil Booth <neil@gcc.gnu.org> | 2002-05-06 22:53:10 +0000 |
commit | a5a49440f74e957e418360804bf270a8ebc9ad8e (patch) | |
tree | 3f56b583072218fe62c5e65ab9af8fa0eb09165a /gcc/doc/cpp.texi | |
parent | d7ee9f9fa759ab04e844982d8818001f6ba7d4cd (diff) | |
download | gcc-a5a49440f74e957e418360804bf270a8ebc9ad8e.zip gcc-a5a49440f74e957e418360804bf270a8ebc9ad8e.tar.gz gcc-a5a49440f74e957e418360804bf270a8ebc9ad8e.tar.bz2 |
c-common.c (warn_multichar): New.
* 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.
From-SVN: r53240
Diffstat (limited to 'gcc/doc/cpp.texi')
-rw-r--r-- | gcc/doc/cpp.texi | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/gcc/doc/cpp.texi b/gcc/doc/cpp.texi index 7ba498d..0e7d9e8 100644 --- a/gcc/doc/cpp.texi +++ b/gcc/doc/cpp.texi @@ -3514,19 +3514,17 @@ values they would have on the target machine. Multi-character character constants are interpreted a character at a time, shifting the previous result left by the number of bits per -target character and adding the sign-extended value of the new -character. They have type @code{int}, and are treated as signed -regardless of whether single characters are signed or not. If there -are more characters in the constant than would fit in the target -@code{int}, a diagnostic is given, and the excess leading characters -are ignored. This methodology is not fully compatible with versions -3.1 and earlier of GCC, which used a confusing and inconsistent -valuation technique. +target character and or-ing the value of the new character truncated +to the width of a target character. They have type @code{int}, and +are treated as signed regardless of whether single characters are +signed or not (a slight change from versions 3.1 and earlier of GCC). +If there are more characters in the constant than would fit in the +target @code{int} an error is issued. For example, 'ab' for a target with an 8-bit @code{char} would be -interpreted as @w{'a' * 256 + 'b'}, and 'a\234' as @w{'a' * 256 + -'\234'}. GCC 3.1 and earlier would give a different value for the -latter example, probably @w{'a' * 256 + (unsigned char) '\234'}. +interpreted as @w{(int) ((unsigned char) 'a' * 256 + (unsigned char) +'b')}, and 'a\234' as @w{(int) ((unsigned char) 'a' * 256 + (unsigned +char) '\234')}. @item Source file inclusion. |