diff options
author | neil <neil@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-05-29 17:15:42 +0000 |
---|---|---|
committer | neil <neil@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-05-29 17:15:42 +0000 |
commit | 4baf0479d3457d3479e1ddc9198e4481e69c8c88 (patch) | |
tree | cb54dc5c6bb9ba60a0d20a46d9816c704bcb8afa /gcc/cpplib.h | |
parent | f9557322297bfeb7d00a05b80b62563e7c042969 (diff) | |
download | gcc-4baf0479d3457d3479e1ddc9198e4481e69c8c88.tar.gz |
2002-05-29 Neil Booth <neil@daikokuya.demon.co.uk>
Zack Weinberg <zack@codesourcery.com>
* cppexp.c (cpp_num): Move to cpplib.h.
(CPP_ERROR): Remove.
(interpret_float_suffix, interpret_int_suffix): New.
(struct suffix, vsuf_1, vsuf_2, vsuf_3): Remove.
(cpp_classify_number, cpp_interpret_integer): New.
(interpret_number): Remove.
(eval_token): Update to use new routines.
* cpphash.h (cpp_num_part): Move to cpplib.h.
* cppinit.c (cpp_post_options): Set warn_long_long.
* cpplib.h (struct cpp_options): Add warn_long_long.
(cpp_num, cpp_num_part, CPP_N_CATEGORY, CPP_N_INVALID,
CPP_N_INTEGER, CPP_N_FLOATING, CPP_N_WIDTH, CPP_N_SMALL,
CPP_N_MEDIUM, CPP_N_LARGE, CPP_N_RADIX, CPP_N_DEC, CPP_N_HEX,
CPP_N_OCTAL, CPP_N_UNSIGNED, CPP_N_IMAGINARY, cpp_classify_number,
cpp_interpret_integer): New.
testsuite:
* gcc.dg/cpp/c++98-pedantic.c, gcc.dg/cpp/c89-pedantic.c,
gcc.dg/cpp/c94-pedantic.c, gcc.dg/cpp/gnuc89-pedantic.c,
gcc.dg/cpp/if-1.c: Update for modified diagnostics.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@54007 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cpplib.h')
-rw-r--r-- | gcc/cpplib.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/gcc/cpplib.h b/gcc/cpplib.h index 8376e1c1657..79fff2bdf5c 100644 --- a/gcc/cpplib.h +++ b/gcc/cpplib.h @@ -327,6 +327,9 @@ struct cpp_options traditional C. */ unsigned char warn_traditional; + /* Nonzero means warn about long long numeric constants. */ + unsigned char warn_long_long; + /* Nonzero means warn about text after an #endif (or #else). */ unsigned char warn_endif_labels; @@ -577,6 +580,51 @@ extern cpp_buffer *cpp_push_buffer PARAMS ((cpp_reader *, int, int)); extern int cpp_defined PARAMS ((cpp_reader *, const unsigned char *, int)); +/* A preprocessing number. Code assumes that any unused high bits of + the double integer are set to zero. */ +typedef unsigned HOST_WIDE_INT cpp_num_part; +typedef struct cpp_num cpp_num; +struct cpp_num +{ + cpp_num_part high; + cpp_num_part low; + bool unsignedp; /* True if value should be treated as unsigned. */ + bool overflow; /* True if the most recent calculation overflowed. */ +}; + +/* cpplib provides two interfaces for interpretation of preprocessing + numbers. + + cpp_classify_number categorizes numeric constants according to + their field (integer, floating point, or invalid), radix (decimal, + octal, hexadecimal), and type suffixes. */ + +#define CPP_N_CATEGORY 0x000F +#define CPP_N_INVALID 0x0000 +#define CPP_N_INTEGER 0x0001 +#define CPP_N_FLOATING 0x0002 + +#define CPP_N_WIDTH 0x00F0 +#define CPP_N_SMALL 0x0010 /* int, float. */ +#define CPP_N_MEDIUM 0x0020 /* long, double. */ +#define CPP_N_LARGE 0x0040 /* long long, long double. */ + +#define CPP_N_RADIX 0x0F00 +#define CPP_N_DECIMAL 0x0100 +#define CPP_N_HEX 0x0200 +#define CPP_N_OCTAL 0x0400 + +#define CPP_N_UNSIGNED 0x1000 /* Properties. */ +#define CPP_N_IMAGINARY 0x2000 + +/* Classify a CPP_NUMBER token. The return value is a combination of + the flags from the above sets. */ +extern unsigned cpp_classify_number PARAMS ((cpp_reader *, const cpp_token *)); + +/* Evaluate a token classified as category CPP_N_INTEGER. */ +extern cpp_num cpp_interpret_integer PARAMS ((cpp_reader *, const cpp_token *, + unsigned int type)); + /* Diagnostic levels. To get a dianostic without associating a position in the translation unit with it, use cpp_error_with_line with a line number of zero. */ |