diff options
author | eggert <eggert@138bc75d-0d04-0410-961f-82ee72b054a4> | 1996-01-23 03:28:01 +0000 |
---|---|---|
committer | eggert <eggert@138bc75d-0d04-0410-961f-82ee72b054a4> | 1996-01-23 03:28:01 +0000 |
commit | 2ec86b3cd066be2c074366b14d833c7b57ecac91 (patch) | |
tree | d637766faec6fb2fac3aa23280e0e1c73db3cc73 /gcc/cexp.y | |
parent | eb74733676f3a4fd6cfcb420f2eda05c32fc1c59 (diff) | |
download | gcc-2ec86b3cd066be2c074366b14d833c7b57ecac91.tar.gz |
Use preprocessor arithmetic instead of C arithmetic
to avoid warnings on some compilers.
(HOST_WIDE_INT_MASK): Remove.
(MAX_CHAR_TYPE_MASK, MAX_WCHAR_TYPE_MASK): New macros.
(yylex): Use them.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@11086 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cexp.y')
-rw-r--r-- | gcc/cexp.y | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/gcc/cexp.y b/gcc/cexp.y index f3456442dc3..470c45d0976 100644 --- a/gcc/cexp.y +++ b/gcc/cexp.y @@ -101,11 +101,6 @@ struct arglist { #endif -#define HOST_WIDE_INT_MASK(bits) \ - ((bits) < HOST_BITS_PER_WIDE_INT \ - ? ~ (~ (HOST_WIDE_INT) 0 << (bits)) \ - : ~ (HOST_WIDE_INT) 0) - #if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 6) # define __attribute__(x) #endif @@ -198,6 +193,18 @@ extern int traditional; #define MAX_WCHAR_TYPE_SIZE WCHAR_TYPE_SIZE #endif +#if MAX_CHAR_TYPE_SIZE < HOST_BITS_PER_WIDE_INT +#define MAX_CHAR_TYPE_MASK (~ (~ (HOST_WIDE_INT) 0 << MAX_CHAR_TYPE_SIZE)) +#else +#define MAX_CHAR_TYPE_MASK (~ (HOST_WIDE_INT) 0) +#endif + +#if MAX_WCHAR_TYPE_SIZE < HOST_BITS_PER_WIDE_INT +#define MAX_WCHAR_TYPE_MASK (~ (~ (HOST_WIDE_INT) 0 << MAX_WCHAR_TYPE_SIZE)) +#else +#define MAX_WCHAR_TYPE_MASK (~ (HOST_WIDE_INT) 0) +#endif + /* Suppose A1 + B1 = SUM1, using 2's complement arithmetic ignoring overflow. Suppose A, B and SUM have the same respective signs as A1, B1, and SUM1. Suppose SIGNEDP is negative if the result is signed, zero if unsigned. @@ -632,21 +639,21 @@ yylex () { lexptr++; wide_flag = 1; - mask = HOST_WIDE_INT_MASK (MAX_WCHAR_TYPE_SIZE); + mask = MAX_WCHAR_TYPE_MASK; goto char_constant; } if (lexptr[1] == '"') { lexptr++; wide_flag = 1; - mask = HOST_WIDE_INT_MASK (MAX_WCHAR_TYPE_SIZE); + mask = MAX_WCHAR_TYPE_MASK; goto string_constant; } break; case '\'': wide_flag = 0; - mask = HOST_WIDE_INT_MASK (MAX_CHAR_TYPE_SIZE); + mask = MAX_CHAR_TYPE_MASK; char_constant: lexptr++; if (keyword_parsing) { @@ -801,7 +808,7 @@ yylex () return c; case '"': - mask = HOST_WIDE_INT_MASK (MAX_CHAR_TYPE_SIZE); + mask = MAX_CHAR_TYPE_MASK; string_constant: if (keyword_parsing) { char *start_ptr = lexptr; |