diff options
author | neil <neil@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-05-04 07:30:32 +0000 |
---|---|---|
committer | neil <neil@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-05-04 07:30:32 +0000 |
commit | 13c457e1923eefa04f4b52e5321ef6e2379d6a8b (patch) | |
tree | 39e01f86f161ea393ce56f05f0c0a0264050f332 /gcc/cpplib.h | |
parent | 364c5d83bb809b704995306cc743668535338a68 (diff) | |
download | gcc-13c457e1923eefa04f4b52e5321ef6e2379d6a8b.tar.gz |
* c-lex.c (lex_string): Let cpp_parse_escape handles truncation
and sign-extension.
(lex_charconst): Update for change in prototype of
cpp_interpret_charconst. Extend from cppchar_t to HOST_WIDE_INT
appropriately.
* cpphash.h (BITS_PER_CPPCHAR_T): New.
* cppinit.c (cpp_create_reader): Initialize them for no
change in semantics.
(cpp_post_options): Add sanity checks.
* cpplex.c (cpp_parse_escape): Handle precision, sign-extension
and truncation issues. Calculate in type cppchar_t.
(MAX_CHAR_TYPE_SIZE, MAX_WCHAR_TYPE_SIZE): Remove.
(cpp_interpret_charconst): Calculate in type cppchar_t. Handle
run-time dependent precision correctly. Return whether the
result is signed or not.
* cpplib.c (dequote_string): Use cppchar_t; update.
* cpplib.h (cppchar_signed_t): New.
struct cpp_options): New precision members.
(cpp_interpret_charconst, cpp_parse_escape): Update prototypes.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@53152 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cpplib.h')
-rw-r--r-- | gcc/cpplib.h | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/gcc/cpplib.h b/gcc/cpplib.h index bbf272be202..520f2a2eac9 100644 --- a/gcc/cpplib.h +++ b/gcc/cpplib.h @@ -190,9 +190,12 @@ struct cpp_token } val; }; -/* A standalone character. It is unsigned for the same reason we use - unsigned char - to avoid signedness issues. */ +/* A type wide enough to hold any multibyte source character. + cpplib's character constant interpreter uses shifts, and so + requires an unsigned type. */ typedef unsigned int cppchar_t; +/* Its signed equivalent. */ +typedef int cppchar_signed_t; /* Values for opts.dump_macros. dump_only means inhibit output of the preprocessed text @@ -237,6 +240,10 @@ struct cpp_options /* -fleading_underscore sets this to "_". */ const char *user_label_prefix; + /* Precision for target CPP arithmetic, target characters and target + wide characters, respectively. */ + size_t precision, char_precision, wchar_precision; + /* The language we're preprocessing. */ enum c_lang lang; @@ -535,9 +542,9 @@ extern const unsigned char *cpp_macro_definition PARAMS ((cpp_reader *, extern void _cpp_backup_tokens PARAMS ((cpp_reader *, unsigned int)); /* Evaluate a CPP_CHAR or CPP_WCHAR token. */ -extern HOST_WIDE_INT +extern cppchar_t cpp_interpret_charconst PARAMS ((cpp_reader *, const cpp_token *, - int, unsigned int *)); + int, unsigned int *, int *)); extern void cpp_define PARAMS ((cpp_reader *, const char *)); extern void cpp_assert PARAMS ((cpp_reader *, const char *)); @@ -600,10 +607,15 @@ extern int cpp_ideq PARAMS ((const cpp_token *, extern void cpp_output_line PARAMS ((cpp_reader *, FILE *)); extern void cpp_output_token PARAMS ((const cpp_token *, FILE *)); extern const char *cpp_type2name PARAMS ((enum cpp_ttype)); -extern unsigned int cpp_parse_escape PARAMS ((cpp_reader *, - const unsigned char **, - const unsigned char *, - unsigned HOST_WIDE_INT)); +/* Returns the value of an escape sequence, truncated to the correct + target precision. PSTR points to the input pointer, which is just + after the backslash. LIMIT is how much text we have. WIDE is true + if the escape sequence is part of a wide character constant or + string literal. Handles all relevant diagnostics. */ +extern cppchar_t cpp_parse_escape PARAMS ((cpp_reader *, + const unsigned char ** pstr, + const unsigned char *limit, + int wide)); /* In cpphash.c */ |