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 {
#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;
......
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