diff options
author | Paul Eggert <eggert@gnu.org> | 1996-01-23 03:28:01 +0000 |
---|---|---|
committer | Paul Eggert <eggert@gnu.org> | 1996-01-23 03:28:01 +0000 |
commit | e12ba0642d940ecd6636906e20efcd04bf3fc745 (patch) | |
tree | d637766faec6fb2fac3aa23280e0e1c73db3cc73 /gcc | |
parent | 52529158ea7d7b80ea578218c9a03d8ff6f3b0d1 (diff) | |
download | gcc-e12ba0642d940ecd6636906e20efcd04bf3fc745.zip gcc-e12ba0642d940ecd6636906e20efcd04bf3fc745.tar.gz gcc-e12ba0642d940ecd6636906e20efcd04bf3fc745.tar.bz2 |
Use preprocessor arithmetic instead of C arithmetic to avoid warnings on some compilers.
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.
From-SVN: r11086
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cexp.y | 25 |
1 files changed, 16 insertions, 9 deletions
@@ -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; |