Commit e12ba064 by Paul Eggert

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
parent 52529158
...@@ -101,11 +101,6 @@ struct arglist { ...@@ -101,11 +101,6 @@ struct arglist {
#endif #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) #if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 6)
# define __attribute__(x) # define __attribute__(x)
#endif #endif
...@@ -198,6 +193,18 @@ extern int traditional; ...@@ -198,6 +193,18 @@ extern int traditional;
#define MAX_WCHAR_TYPE_SIZE WCHAR_TYPE_SIZE #define MAX_WCHAR_TYPE_SIZE WCHAR_TYPE_SIZE
#endif #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 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 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. Suppose SIGNEDP is negative if the result is signed, zero if unsigned.
...@@ -632,21 +639,21 @@ yylex () ...@@ -632,21 +639,21 @@ yylex ()
{ {
lexptr++; lexptr++;
wide_flag = 1; wide_flag = 1;
mask = HOST_WIDE_INT_MASK (MAX_WCHAR_TYPE_SIZE); mask = MAX_WCHAR_TYPE_MASK;
goto char_constant; goto char_constant;
} }
if (lexptr[1] == '"') if (lexptr[1] == '"')
{ {
lexptr++; lexptr++;
wide_flag = 1; wide_flag = 1;
mask = HOST_WIDE_INT_MASK (MAX_WCHAR_TYPE_SIZE); mask = MAX_WCHAR_TYPE_MASK;
goto string_constant; goto string_constant;
} }
break; break;
case '\'': case '\'':
wide_flag = 0; wide_flag = 0;
mask = HOST_WIDE_INT_MASK (MAX_CHAR_TYPE_SIZE); mask = MAX_CHAR_TYPE_MASK;
char_constant: char_constant:
lexptr++; lexptr++;
if (keyword_parsing) { if (keyword_parsing) {
...@@ -801,7 +808,7 @@ yylex () ...@@ -801,7 +808,7 @@ yylex ()
return c; return c;
case '"': case '"':
mask = HOST_WIDE_INT_MASK (MAX_CHAR_TYPE_SIZE); mask = MAX_CHAR_TYPE_MASK;
string_constant: string_constant:
if (keyword_parsing) { if (keyword_parsing) {
char *start_ptr = lexptr; char *start_ptr = lexptr;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment