Commit bd86d7e2 by Kaveh R. Ghazi Committed by Kaveh Ghazi

cccp.c: Don't define HOST_WIDE_INT.

        * cccp.c: Don't define HOST_WIDE_INT.  Replace all occurrences of
        WIDE_INT with WIDEST_INT.
        * cexp.y: Likewise.
        Don't define unsigned_HOST_WIDE_INT, CHAR_BIT or
        HOST_BITS_PER_WIDE_INT.  Replace occurrences of PRINTF_PROTO_1()
        style with PVPROTO() ATTRIBUTE_PRINTF_1 style macros.  Replace
        occurrences of "unsigned_HOST" with "unsigned HOST".  Provide a
        definition of variable `c89' when compiling a test binary and set it.
        * system.h: Don't define the PRINTF_PROTO_* macros.

From-SVN: r25217
parent c4ae2725
Mon Feb 15 14:44:53 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* cccp.c: Don't define HOST_WIDE_INT. Replace all occurrences of
WIDE_INT with WIDEST_INT.
* cexp.y: Likewise.
Don't define unsigned_HOST_WIDE_INT, CHAR_BIT or
HOST_BITS_PER_WIDE_INT. Replace occurrences of PRINTF_PROTO_1()
style with PVPROTO() ATTRIBUTE_PRINTF_1 style macros. Replace
occurrences of "unsigned_HOST" with "unsigned HOST". Provide a
definition of variable `c89' when compiling a test binary and set it.
* system.h: Don't define the PRINTF_PROTO_* macros.
Mon Feb 15 11:33:51 1999 Jeffrey A Law (law@cygnus.com)
* loop.c (mark_loop_jump): Handle LO_SUM. If we encounter something
......
......@@ -82,26 +82,6 @@ static int hack_vms_include_specification ();
#define INO_T_EQ(a, b) 0
#endif
/* Find the largest host integer type and set its size and type.
Watch out: on some crazy hosts `long' is shorter than `int'. */
#ifndef HOST_WIDE_INT
# if HAVE_INTTYPES_H
# include <inttypes.h>
# define HOST_WIDE_INT intmax_t
# else
# if (HOST_BITS_PER_LONG <= HOST_BITS_PER_INT && HOST_BITS_PER_LONGLONG <= HOST_BITS_PER_INT)
# define HOST_WIDE_INT int
# else
# if (HOST_BITS_PER_LONGLONG <= HOST_BITS_PER_LONG || ! (defined LONG_LONG_MAX || defined LLONG_MAX))
# define HOST_WIDE_INT long
# else
# define HOST_WIDE_INT long long
# endif
# endif
# endif
#endif
#ifndef INO_T_EQ
#define INO_T_EQ(a, b) ((a) == (b))
#endif
......@@ -117,8 +97,8 @@ static int hack_vms_include_specification ();
/* External declarations. */
extern char *version_string;
HOST_WIDE_INT parse_escape PROTO((char **, HOST_WIDE_INT));
HOST_WIDE_INT parse_c_expression PROTO((char *, int));
HOST_WIDEST_INT parse_escape PROTO((char **, HOST_WIDEST_INT));
HOST_WIDEST_INT parse_c_expression PROTO((char *, int));
/* Name under which this program was invoked. */
......@@ -959,7 +939,7 @@ static void delete_assertion PROTO((ASSERTION_HASHNODE *));
static void do_once PROTO((void));
static HOST_WIDE_INT eval_if_expression PROTO((U_CHAR *, int));
static HOST_WIDEST_INT eval_if_expression PROTO((U_CHAR *, int));
static void conditional_skip PROTO((FILE_BUF *, int, enum node_type, U_CHAR *, FILE_BUF *));
static void skip_if_group PROTO((FILE_BUF *, int, FILE_BUF *));
static void validate_else PROTO((U_CHAR *, U_CHAR *));
......@@ -2563,7 +2543,7 @@ get_lintcmd (ibp, limit, argstart, arglen, cmdlen)
U_CHAR **argstart; /* point to command arg */
int *arglen, *cmdlen; /* how long they are */
{
HOST_WIDE_INT linsize;
HOST_WIDEST_INT linsize;
register U_CHAR *numptr; /* temp for arg parsing */
*arglen = 0;
......@@ -6962,7 +6942,7 @@ do_line (buf, limit, op, keyword)
if (! ignore_escape_flag)
{
char *bpc = (char *) bp;
HOST_WIDE_INT c = parse_escape (&bpc, (HOST_WIDE_INT) (U_CHAR) (-1));
HOST_WIDEST_INT c = parse_escape (&bpc, (HOST_WIDEST_INT) (U_CHAR) (-1));
bp = (U_CHAR *) bpc;
if (c < 0)
p--;
......@@ -7275,7 +7255,7 @@ do_if (buf, limit, op, keyword)
FILE_BUF *op;
struct directive *keyword ATTRIBUTE_UNUSED;
{
HOST_WIDE_INT value;
HOST_WIDEST_INT value;
FILE_BUF *ip = &instack[indepth];
value = eval_if_expression (buf, limit - buf);
......@@ -7292,7 +7272,7 @@ do_elif (buf, limit, op, keyword)
FILE_BUF *op;
struct directive *keyword ATTRIBUTE_UNUSED;
{
HOST_WIDE_INT value;
HOST_WIDEST_INT value;
FILE_BUF *ip = &instack[indepth];
if (if_stack == instack[indepth].if_stack) {
......@@ -7330,14 +7310,14 @@ do_elif (buf, limit, op, keyword)
/* Evaluate a #if expression in BUF, of length LENGTH, then parse the
result as a C expression and return the value as an int. */
static HOST_WIDE_INT
static HOST_WIDEST_INT
eval_if_expression (buf, length)
U_CHAR *buf;
int length;
{
FILE_BUF temp_obuf;
HASHNODE *save_defined;
HOST_WIDE_INT value;
HOST_WIDEST_INT value;
save_defined = install ((U_CHAR *) "defined", -1, T_SPEC_DEFINED,
NULL_PTR, -1);
......
......@@ -43,44 +43,11 @@ struct arglist {
int argno;
};
/* Find the largest host integer type and set its size and type.
Watch out: on some crazy hosts `long' is shorter than `int'. */
#ifndef HOST_WIDE_INT
# if HAVE_INTTYPES_H
# include <inttypes.h>
# define HOST_WIDE_INT intmax_t
# define unsigned_HOST_WIDE_INT uintmax_t
# else
# if (HOST_BITS_PER_LONG <= HOST_BITS_PER_INT && HOST_BITS_PER_LONGLONG <= HOST_BITS_PER_INT)
# define HOST_WIDE_INT int
# else
# if (HOST_BITS_PER_LONGLONG <= HOST_BITS_PER_LONG || ! (defined LONG_LONG_MAX || defined LLONG_MAX))
# define HOST_WIDE_INT long
# else
# define HOST_WIDE_INT long long
# endif
# endif
# endif
#endif
#ifndef unsigned_HOST_WIDE_INT
#define unsigned_HOST_WIDE_INT unsigned HOST_WIDE_INT
#endif
#ifndef CHAR_BIT
#define CHAR_BIT 8
#endif
#ifndef HOST_BITS_PER_WIDE_INT
#define HOST_BITS_PER_WIDE_INT (CHAR_BIT * sizeof (HOST_WIDE_INT))
#endif
HOST_WIDE_INT parse_c_expression PROTO((char *, int));
HOST_WIDEST_INT parse_c_expression PROTO((char *, int));
static int yylex PROTO((void));
static void yyerror PRINTF_PROTO_1((char *, ...)) __attribute__ ((noreturn));
static HOST_WIDE_INT expression_value;
static void yyerror PVPROTO((char *, ...)) ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
static HOST_WIDEST_INT expression_value;
#ifdef TEST_EXP_READER
static int expression_signedp;
#endif
......@@ -141,13 +108,13 @@ extern int c89;
#define MAX_WCHAR_TYPE_SIZE WCHAR_TYPE_SIZE
#endif
#define MAX_CHAR_TYPE_MASK (MAX_CHAR_TYPE_SIZE < HOST_BITS_PER_WIDE_INT \
? (~ (~ (HOST_WIDE_INT) 0 << MAX_CHAR_TYPE_SIZE)) \
: ~ (HOST_WIDE_INT) 0)
#define MAX_CHAR_TYPE_MASK (MAX_CHAR_TYPE_SIZE < HOST_BITS_PER_WIDEST_INT \
? (~ (~ (HOST_WIDEST_INT) 0 << MAX_CHAR_TYPE_SIZE)) \
: ~ (HOST_WIDEST_INT) 0)
#define MAX_WCHAR_TYPE_MASK (MAX_WCHAR_TYPE_SIZE < HOST_BITS_PER_WIDE_INT \
? ~ (~ (HOST_WIDE_INT) 0 << MAX_WCHAR_TYPE_SIZE) \
: ~ (HOST_WIDE_INT) 0)
#define MAX_WCHAR_TYPE_MASK (MAX_WCHAR_TYPE_SIZE < HOST_BITS_PER_WIDEST_INT \
? ~ (~ (HOST_WIDEST_INT) 0 << MAX_WCHAR_TYPE_SIZE) \
: ~ (HOST_WIDEST_INT) 0)
/* 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.
......@@ -161,25 +128,25 @@ extern int c89;
struct constant;
HOST_WIDE_INT parse_escape PROTO((char **, HOST_WIDE_INT));
HOST_WIDEST_INT parse_escape PROTO((char **, HOST_WIDEST_INT));
int check_assertion PROTO((U_CHAR *, int, int, struct arglist *));
struct hashnode *lookup PROTO((U_CHAR *, int, int));
void error PRINTF_PROTO_1((char *, ...));
void pedwarn PRINTF_PROTO_1((char *, ...));
void warning PRINTF_PROTO_1((char *, ...));
void error PVPROTO((char *, ...)) ATTRIBUTE_PRINTF_1;
void pedwarn PVPROTO((char *, ...)) ATTRIBUTE_PRINTF_1;
void warning PVPROTO((char *, ...)) ATTRIBUTE_PRINTF_1;
static int parse_number PROTO((int));
static HOST_WIDE_INT left_shift PROTO((struct constant *, unsigned_HOST_WIDE_INT));
static HOST_WIDE_INT right_shift PROTO((struct constant *, unsigned_HOST_WIDE_INT));
static HOST_WIDEST_INT left_shift PROTO((struct constant *, unsigned HOST_WIDEST_INT));
static HOST_WIDEST_INT right_shift PROTO((struct constant *, unsigned HOST_WIDEST_INT));
static void integer_overflow PROTO((void));
/* `signedp' values */
#define SIGNED (~0)
#define UNSIGNED 0
#line 185 "cexp.y"
#line 152 "cexp.y"
typedef union {
struct constant {HOST_WIDE_INT value; int signedp;} integer;
struct constant {HOST_WIDEST_INT value; int signedp;} integer;
struct name {U_CHAR *address; int length;} name;
struct arglist *keywords;
} YYSTYPE;
......@@ -258,10 +225,10 @@ static const short yyrhs[] = { 35,
#if YYDEBUG != 0
static const short yyrline[] = { 0,
215, 225, 226, 233, 238, 241, 243, 246, 250, 252,
257, 262, 275, 292, 305, 311, 317, 323, 329, 332,
335, 342, 349, 356, 363, 366, 369, 372, 375, 378,
381, 384, 386, 389, 392, 394, 396, 404, 406, 419
182, 192, 193, 200, 205, 208, 210, 213, 217, 219,
224, 229, 242, 259, 272, 278, 284, 290, 296, 299,
302, 309, 316, 323, 330, 333, 336, 339, 342, 345,
348, 351, 353, 356, 359, 361, 363, 371, 373, 386
};
#endif
......@@ -367,7 +334,7 @@ static const short yycheck[] = { 4,
26, 27, 23, 24, 25, 26, 27, 0, 9
};
/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
#line 3 "/usr/cygnus/r5900/share/bison.simple"
#line 3 "/usr/local/gnu/share/bison.simple"
/* Skeleton output parser for bison,
Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
......@@ -560,7 +527,7 @@ __yy_memcpy (char *to, char *from, int count)
#endif
#endif
#line 196 "/usr/cygnus/r5900/share/bison.simple"
#line 196 "/usr/local/gnu/share/bison.simple"
/* The user can define YYPARSE_PARAM as the name of an argument to be passed
into yyparse. The argument should have type void *.
......@@ -865,7 +832,7 @@ yyreduce:
switch (yyn) {
case 1:
#line 216 "cexp.y"
#line 183 "cexp.y"
{
expression_value = yyvsp[0].integer.value;
#ifdef TEST_EXP_READER
......@@ -874,55 +841,55 @@ case 1:
;
break;}
case 3:
#line 227 "cexp.y"
#line 194 "cexp.y"
{ if (pedantic)
pedwarn ("comma operator in operand of `#if'");
yyval.integer = yyvsp[0].integer; ;
break;}
case 4:
#line 234 "cexp.y"
#line 201 "cexp.y"
{ yyval.integer.value = - yyvsp[0].integer.value;
yyval.integer.signedp = yyvsp[0].integer.signedp;
if ((yyval.integer.value & yyvsp[0].integer.value & yyval.integer.signedp) < 0)
integer_overflow (); ;
break;}
case 5:
#line 239 "cexp.y"
#line 206 "cexp.y"
{ yyval.integer.value = ! yyvsp[0].integer.value;
yyval.integer.signedp = SIGNED; ;
break;}
case 6:
#line 242 "cexp.y"
#line 209 "cexp.y"
{ yyval.integer = yyvsp[0].integer; ;
break;}
case 7:
#line 244 "cexp.y"
#line 211 "cexp.y"
{ yyval.integer.value = ~ yyvsp[0].integer.value;
yyval.integer.signedp = yyvsp[0].integer.signedp; ;
break;}
case 8:
#line 247 "cexp.y"
#line 214 "cexp.y"
{ yyval.integer.value = check_assertion (yyvsp[0].name.address, yyvsp[0].name.length,
0, NULL_PTR);
yyval.integer.signedp = SIGNED; ;
break;}
case 9:
#line 251 "cexp.y"
#line 218 "cexp.y"
{ keyword_parsing = 1; ;
break;}
case 10:
#line 253 "cexp.y"
#line 220 "cexp.y"
{ yyval.integer.value = check_assertion (yyvsp[-4].name.address, yyvsp[-4].name.length,
1, yyvsp[-1].keywords);
keyword_parsing = 0;
yyval.integer.signedp = SIGNED; ;
break;}
case 11:
#line 258 "cexp.y"
#line 225 "cexp.y"
{ yyval.integer = yyvsp[-1].integer; ;
break;}
case 12:
#line 263 "cexp.y"
#line 230 "cexp.y"
{ yyval.integer.signedp = yyvsp[-2].integer.signedp & yyvsp[0].integer.signedp;
if (yyval.integer.signedp)
{
......@@ -933,11 +900,11 @@ case 12:
integer_overflow ();
}
else
yyval.integer.value = ((unsigned_HOST_WIDE_INT) yyvsp[-2].integer.value
yyval.integer.value = ((unsigned HOST_WIDEST_INT) yyvsp[-2].integer.value
* yyvsp[0].integer.value); ;
break;}
case 13:
#line 276 "cexp.y"
#line 243 "cexp.y"
{ if (yyvsp[0].integer.value == 0)
{
if (!skip_evaluation)
......@@ -952,11 +919,11 @@ case 13:
integer_overflow ();
}
else
yyval.integer.value = ((unsigned_HOST_WIDE_INT) yyvsp[-2].integer.value
yyval.integer.value = ((unsigned HOST_WIDEST_INT) yyvsp[-2].integer.value
/ yyvsp[0].integer.value); ;
break;}
case 14:
#line 293 "cexp.y"
#line 260 "cexp.y"
{ if (yyvsp[0].integer.value == 0)
{
if (!skip_evaluation)
......@@ -967,11 +934,11 @@ case 14:
if (yyval.integer.signedp)
yyval.integer.value = yyvsp[-2].integer.value % yyvsp[0].integer.value;
else
yyval.integer.value = ((unsigned_HOST_WIDE_INT) yyvsp[-2].integer.value
yyval.integer.value = ((unsigned HOST_WIDEST_INT) yyvsp[-2].integer.value
% yyvsp[0].integer.value); ;
break;}
case 15:
#line 306 "cexp.y"
#line 273 "cexp.y"
{ yyval.integer.value = yyvsp[-2].integer.value + yyvsp[0].integer.value;
yyval.integer.signedp = yyvsp[-2].integer.signedp & yyvsp[0].integer.signedp;
if (overflow_sum_sign (yyvsp[-2].integer.value, yyvsp[0].integer.value,
......@@ -979,7 +946,7 @@ case 15:
integer_overflow (); ;
break;}
case 16:
#line 312 "cexp.y"
#line 279 "cexp.y"
{ yyval.integer.value = yyvsp[-2].integer.value - yyvsp[0].integer.value;
yyval.integer.signedp = yyvsp[-2].integer.signedp & yyvsp[0].integer.signedp;
if (overflow_sum_sign (yyval.integer.value, yyvsp[0].integer.value,
......@@ -987,7 +954,7 @@ case 16:
integer_overflow (); ;
break;}
case 17:
#line 318 "cexp.y"
#line 285 "cexp.y"
{ yyval.integer.signedp = yyvsp[-2].integer.signedp;
if ((yyvsp[0].integer.value & yyvsp[0].integer.signedp) < 0)
yyval.integer.value = right_shift (&yyvsp[-2].integer, -yyvsp[0].integer.value);
......@@ -995,7 +962,7 @@ case 17:
yyval.integer.value = left_shift (&yyvsp[-2].integer, yyvsp[0].integer.value); ;
break;}
case 18:
#line 324 "cexp.y"
#line 291 "cexp.y"
{ yyval.integer.signedp = yyvsp[-2].integer.signedp;
if ((yyvsp[0].integer.value & yyvsp[0].integer.signedp) < 0)
yyval.integer.value = left_shift (&yyvsp[-2].integer, -yyvsp[0].integer.value);
......@@ -1003,110 +970,110 @@ case 18:
yyval.integer.value = right_shift (&yyvsp[-2].integer, yyvsp[0].integer.value); ;
break;}
case 19:
#line 330 "cexp.y"
#line 297 "cexp.y"
{ yyval.integer.value = (yyvsp[-2].integer.value == yyvsp[0].integer.value);
yyval.integer.signedp = SIGNED; ;
break;}
case 20:
#line 333 "cexp.y"
#line 300 "cexp.y"
{ yyval.integer.value = (yyvsp[-2].integer.value != yyvsp[0].integer.value);
yyval.integer.signedp = SIGNED; ;
break;}
case 21:
#line 336 "cexp.y"
#line 303 "cexp.y"
{ yyval.integer.signedp = SIGNED;
if (yyvsp[-2].integer.signedp & yyvsp[0].integer.signedp)
yyval.integer.value = yyvsp[-2].integer.value <= yyvsp[0].integer.value;
else
yyval.integer.value = ((unsigned_HOST_WIDE_INT) yyvsp[-2].integer.value
yyval.integer.value = ((unsigned HOST_WIDEST_INT) yyvsp[-2].integer.value
<= yyvsp[0].integer.value); ;
break;}
case 22:
#line 343 "cexp.y"
#line 310 "cexp.y"
{ yyval.integer.signedp = SIGNED;
if (yyvsp[-2].integer.signedp & yyvsp[0].integer.signedp)
yyval.integer.value = yyvsp[-2].integer.value >= yyvsp[0].integer.value;
else
yyval.integer.value = ((unsigned_HOST_WIDE_INT) yyvsp[-2].integer.value
yyval.integer.value = ((unsigned HOST_WIDEST_INT) yyvsp[-2].integer.value
>= yyvsp[0].integer.value); ;
break;}
case 23:
#line 350 "cexp.y"
#line 317 "cexp.y"
{ yyval.integer.signedp = SIGNED;
if (yyvsp[-2].integer.signedp & yyvsp[0].integer.signedp)
yyval.integer.value = yyvsp[-2].integer.value < yyvsp[0].integer.value;
else
yyval.integer.value = ((unsigned_HOST_WIDE_INT) yyvsp[-2].integer.value
yyval.integer.value = ((unsigned HOST_WIDEST_INT) yyvsp[-2].integer.value
< yyvsp[0].integer.value); ;
break;}
case 24:
#line 357 "cexp.y"
#line 324 "cexp.y"
{ yyval.integer.signedp = SIGNED;
if (yyvsp[-2].integer.signedp & yyvsp[0].integer.signedp)
yyval.integer.value = yyvsp[-2].integer.value > yyvsp[0].integer.value;
else
yyval.integer.value = ((unsigned_HOST_WIDE_INT) yyvsp[-2].integer.value
yyval.integer.value = ((unsigned HOST_WIDEST_INT) yyvsp[-2].integer.value
> yyvsp[0].integer.value); ;
break;}
case 25:
#line 364 "cexp.y"
#line 331 "cexp.y"
{ yyval.integer.value = yyvsp[-2].integer.value & yyvsp[0].integer.value;
yyval.integer.signedp = yyvsp[-2].integer.signedp & yyvsp[0].integer.signedp; ;
break;}
case 26:
#line 367 "cexp.y"
#line 334 "cexp.y"
{ yyval.integer.value = yyvsp[-2].integer.value ^ yyvsp[0].integer.value;
yyval.integer.signedp = yyvsp[-2].integer.signedp & yyvsp[0].integer.signedp; ;
break;}
case 27:
#line 370 "cexp.y"
#line 337 "cexp.y"
{ yyval.integer.value = yyvsp[-2].integer.value | yyvsp[0].integer.value;
yyval.integer.signedp = yyvsp[-2].integer.signedp & yyvsp[0].integer.signedp; ;
break;}
case 28:
#line 373 "cexp.y"
#line 340 "cexp.y"
{ skip_evaluation += !yyvsp[-1].integer.value; ;
break;}
case 29:
#line 375 "cexp.y"
#line 342 "cexp.y"
{ skip_evaluation -= !yyvsp[-3].integer.value;
yyval.integer.value = (yyvsp[-3].integer.value && yyvsp[0].integer.value);
yyval.integer.signedp = SIGNED; ;
break;}
case 30:
#line 379 "cexp.y"
#line 346 "cexp.y"
{ skip_evaluation += !!yyvsp[-1].integer.value; ;
break;}
case 31:
#line 381 "cexp.y"
#line 348 "cexp.y"
{ skip_evaluation -= !!yyvsp[-3].integer.value;
yyval.integer.value = (yyvsp[-3].integer.value || yyvsp[0].integer.value);
yyval.integer.signedp = SIGNED; ;
break;}
case 32:
#line 385 "cexp.y"
#line 352 "cexp.y"
{ skip_evaluation += !yyvsp[-1].integer.value; ;
break;}
case 33:
#line 387 "cexp.y"
#line 354 "cexp.y"
{ skip_evaluation += !!yyvsp[-4].integer.value - !yyvsp[-4].integer.value; ;
break;}
case 34:
#line 389 "cexp.y"
#line 356 "cexp.y"
{ skip_evaluation -= !!yyvsp[-6].integer.value;
yyval.integer.value = yyvsp[-6].integer.value ? yyvsp[-3].integer.value : yyvsp[0].integer.value;
yyval.integer.signedp = yyvsp[-3].integer.signedp & yyvsp[0].integer.signedp; ;
break;}
case 35:
#line 393 "cexp.y"
#line 360 "cexp.y"
{ yyval.integer = yylval.integer; ;
break;}
case 36:
#line 395 "cexp.y"
#line 362 "cexp.y"
{ yyval.integer = yylval.integer; ;
break;}
case 37:
#line 397 "cexp.y"
#line 364 "cexp.y"
{ if (warn_undef && !skip_evaluation)
warning ("`%.*s' is not defined",
yyvsp[0].name.length, yyvsp[0].name.address);
......@@ -1114,11 +1081,11 @@ case 37:
yyval.integer.signedp = SIGNED; ;
break;}
case 38:
#line 405 "cexp.y"
#line 372 "cexp.y"
{ yyval.keywords = 0; ;
break;}
case 39:
#line 407 "cexp.y"
#line 374 "cexp.y"
{ struct arglist *temp;
yyval.keywords = (struct arglist *) xmalloc (sizeof (struct arglist));
yyval.keywords->next = yyvsp[-2].keywords;
......@@ -1133,7 +1100,7 @@ case 39:
temp->next->length = 1; ;
break;}
case 40:
#line 420 "cexp.y"
#line 387 "cexp.y"
{ yyval.keywords = (struct arglist *) xmalloc (sizeof (struct arglist));
yyval.keywords->name = yyvsp[-1].name.address;
yyval.keywords->length = yyvsp[-1].name.length;
......@@ -1141,7 +1108,7 @@ case 40:
break;}
}
/* the action file gets copied in in place of this dollarsign */
#line 498 "/usr/cygnus/r5900/share/bison.simple"
#line 498 "/usr/local/gnu/share/bison.simple"
yyvsp -= yylen;
yyssp -= yylen;
......@@ -1337,7 +1304,7 @@ yyerrhandle:
yystate = yyn;
goto yynewstate;
}
#line 425 "cexp.y"
#line 392 "cexp.y"
/* During parsing of a C expression, the pointer to the next character
......@@ -1357,7 +1324,7 @@ parse_number (olen)
{
register char *p = lexptr;
register int c;
register unsigned_HOST_WIDE_INT n = 0, nd, max_over_base;
register unsigned HOST_WIDEST_INT n = 0, nd, max_over_base;
register int base = 10;
register int len = olen;
register int overflow = 0;
......@@ -1375,7 +1342,7 @@ parse_number (olen)
}
}
max_over_base = (unsigned_HOST_WIDE_INT) -1 / base;
max_over_base = (unsigned HOST_WIDEST_INT) -1 / base;
for (; len > 0; len--) {
c = *p++;
......@@ -1430,7 +1397,7 @@ parse_number (olen)
pedwarn ("integer constant out of range");
/* If too big to be signed, consider it unsigned. */
if (((HOST_WIDE_INT) n & yylval.integer.signedp) < 0)
if (((HOST_WIDEST_INT) n & yylval.integer.signedp) < 0)
{
if (base == 10)
warning ("integer constant is so large that it is unsigned");
......@@ -1471,7 +1438,7 @@ yylex ()
register unsigned char *tokstart;
register struct token *toktab;
int wide_flag;
HOST_WIDE_INT mask;
HOST_WIDEST_INT mask;
retry:
......@@ -1538,7 +1505,7 @@ yylex ()
handles multicharacter constants and wide characters.
It is mostly copied from c-lex.c. */
{
register HOST_WIDE_INT result = 0;
register HOST_WIDEST_INT result = 0;
register int num_chars = 0;
int chars_seen = 0;
unsigned width = MAX_CHAR_TYPE_SIZE;
......@@ -1653,12 +1620,12 @@ yylex ()
sizeof ("__CHAR_UNSIGNED__") - 1, -1)
|| ((result >> (num_bits - 1)) & 1) == 0)
yylval.integer.value
= result & (~ (unsigned_HOST_WIDE_INT) 0
>> (HOST_BITS_PER_WIDE_INT - num_bits));
= result & (~ (unsigned HOST_WIDEST_INT) 0
>> (HOST_BITS_PER_WIDEST_INT - num_bits));
else
yylval.integer.value
= result | ~(~ (unsigned_HOST_WIDE_INT) 0
>> (HOST_BITS_PER_WIDE_INT - num_bits));
= result | ~(~ (unsigned HOST_WIDEST_INT) 0
>> (HOST_BITS_PER_WIDEST_INT - num_bits));
}
else
{
......@@ -1784,10 +1751,10 @@ yylex ()
If \ is followed by 000, we return 0 and leave the string pointer
after the zeros. A value of 0 does not mean end of string. */
HOST_WIDE_INT
HOST_WIDEST_INT
parse_escape (string_ptr, result_mask)
char **string_ptr;
HOST_WIDE_INT result_mask;
HOST_WIDEST_INT result_mask;
{
register int c = *(*string_ptr)++;
switch (c)
......@@ -1826,7 +1793,7 @@ parse_escape (string_ptr, result_mask)
case '6':
case '7':
{
register HOST_WIDE_INT i = c - '0';
register HOST_WIDEST_INT i = c - '0';
register int count = 0;
while (++count < 3)
{
......@@ -1848,7 +1815,7 @@ parse_escape (string_ptr, result_mask)
}
case 'x':
{
register unsigned_HOST_WIDE_INT i = 0, overflow = 0;
register unsigned HOST_WIDEST_INT i = 0, overflow = 0;
register int digits_found = 0, digit;
for (;;)
{
......@@ -1889,31 +1856,31 @@ integer_overflow ()
pedwarn ("integer overflow in preprocessor expression");
}
static HOST_WIDE_INT
static HOST_WIDEST_INT
left_shift (a, b)
struct constant *a;
unsigned_HOST_WIDE_INT b;
unsigned HOST_WIDEST_INT b;
{
/* It's unclear from the C standard whether shifts can overflow.
The following code ignores overflow; perhaps a C standard
interpretation ruling is needed. */
if (b >= HOST_BITS_PER_WIDE_INT)
if (b >= HOST_BITS_PER_WIDEST_INT)
return 0;
else
return (unsigned_HOST_WIDE_INT) a->value << b;
return (unsigned HOST_WIDEST_INT) a->value << b;
}
static HOST_WIDE_INT
static HOST_WIDEST_INT
right_shift (a, b)
struct constant *a;
unsigned_HOST_WIDE_INT b;
unsigned HOST_WIDEST_INT b;
{
if (b >= HOST_BITS_PER_WIDE_INT)
return a->signedp ? a->value >> (HOST_BITS_PER_WIDE_INT - 1) : 0;
if (b >= HOST_BITS_PER_WIDEST_INT)
return a->signedp ? a->value >> (HOST_BITS_PER_WIDEST_INT - 1) : 0;
else if (a->signedp)
return a->value >> b;
else
return (unsigned_HOST_WIDE_INT) a->value >> b;
return (unsigned HOST_WIDEST_INT) a->value >> b;
}
/* This page contains the entry point to this file. */
......@@ -1926,7 +1893,7 @@ right_shift (a, b)
We do not support C comments. They should be removed before
this function is called. */
HOST_WIDE_INT
HOST_WIDEST_INT
parse_c_expression (string, warn_undefined)
char *string;
int warn_undefined;
......@@ -1980,10 +1947,11 @@ extern int yydebug;
int pedantic;
int traditional;
int c89;
int main PROTO((int, char **));
static void initialize_random_junk PROTO((void));
static void print_unsigned_host_wide_int PROTO((unsigned_HOST_WIDE_INT));
static void print_unsigned_host_widest_int PROTO((unsigned HOST_WIDEST_INT));
/* Main program for testing purposes. */
int
......@@ -1993,12 +1961,13 @@ main (argc, argv)
{
int n, c;
char buf[1024];
unsigned_HOST_WIDE_INT u;
unsigned HOST_WIDEST_INT u;
pedantic = 1 < argc;
traditional = 2 < argc;
c89 = 3 < argc;
#if YYDEBUG
yydebug = 3 < argc;
yydebug = 4 < argc;
#endif
initialize_random_junk ();
......@@ -2011,7 +1980,7 @@ main (argc, argv)
break;
parse_c_expression (buf, 1);
printf ("parser returned ");
u = (unsigned_HOST_WIDE_INT) expression_value;
u = (unsigned HOST_WIDEST_INT) expression_value;
if (expression_value < 0 && expression_signedp) {
u = -u;
printf ("-");
......@@ -2019,7 +1988,7 @@ main (argc, argv)
if (u == 0)
printf ("0");
else
print_unsigned_host_wide_int (u);
print_unsigned_host_widest_int (u);
if (! expression_signedp)
printf("u");
printf ("\n");
......@@ -2029,11 +1998,11 @@ main (argc, argv)
}
static void
print_unsigned_host_wide_int (u)
unsigned_HOST_WIDE_INT u;
print_unsigned_host_widest_int (u)
unsigned HOST_WIDEST_INT u;
{
if (u) {
print_unsigned_host_wide_int (u / 10);
print_unsigned_host_widest_int (u / 10);
putchar ('0' + (int) (u % 10));
}
}
......
......@@ -47,44 +47,11 @@ struct arglist {
int argno;
};
/* Find the largest host integer type and set its size and type.
Watch out: on some crazy hosts `long' is shorter than `int'. */
#ifndef HOST_WIDE_INT
# if HAVE_INTTYPES_H
# include <inttypes.h>
# define HOST_WIDE_INT intmax_t
# define unsigned_HOST_WIDE_INT uintmax_t
# else
# if (HOST_BITS_PER_LONG <= HOST_BITS_PER_INT && HOST_BITS_PER_LONGLONG <= HOST_BITS_PER_INT)
# define HOST_WIDE_INT int
# else
# if (HOST_BITS_PER_LONGLONG <= HOST_BITS_PER_LONG || ! (defined LONG_LONG_MAX || defined LLONG_MAX))
# define HOST_WIDE_INT long
# else
# define HOST_WIDE_INT long long
# endif
# endif
# endif
#endif
#ifndef unsigned_HOST_WIDE_INT
#define unsigned_HOST_WIDE_INT unsigned HOST_WIDE_INT
#endif
#ifndef CHAR_BIT
#define CHAR_BIT 8
#endif
#ifndef HOST_BITS_PER_WIDE_INT
#define HOST_BITS_PER_WIDE_INT (CHAR_BIT * sizeof (HOST_WIDE_INT))
#endif
HOST_WIDE_INT parse_c_expression PROTO((char *, int));
HOST_WIDEST_INT parse_c_expression PROTO((char *, int));
static int yylex PROTO((void));
static void yyerror PRINTF_PROTO_1((char *, ...)) __attribute__ ((noreturn));
static HOST_WIDE_INT expression_value;
static void yyerror PVPROTO((char *, ...)) ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
static HOST_WIDEST_INT expression_value;
#ifdef TEST_EXP_READER
static int expression_signedp;
#endif
......@@ -145,13 +112,13 @@ extern int c89;
#define MAX_WCHAR_TYPE_SIZE WCHAR_TYPE_SIZE
#endif
#define MAX_CHAR_TYPE_MASK (MAX_CHAR_TYPE_SIZE < HOST_BITS_PER_WIDE_INT \
? (~ (~ (HOST_WIDE_INT) 0 << MAX_CHAR_TYPE_SIZE)) \
: ~ (HOST_WIDE_INT) 0)
#define MAX_CHAR_TYPE_MASK (MAX_CHAR_TYPE_SIZE < HOST_BITS_PER_WIDEST_INT \
? (~ (~ (HOST_WIDEST_INT) 0 << MAX_CHAR_TYPE_SIZE)) \
: ~ (HOST_WIDEST_INT) 0)
#define MAX_WCHAR_TYPE_MASK (MAX_WCHAR_TYPE_SIZE < HOST_BITS_PER_WIDE_INT \
? ~ (~ (HOST_WIDE_INT) 0 << MAX_WCHAR_TYPE_SIZE) \
: ~ (HOST_WIDE_INT) 0)
#define MAX_WCHAR_TYPE_MASK (MAX_WCHAR_TYPE_SIZE < HOST_BITS_PER_WIDEST_INT \
? ~ (~ (HOST_WIDEST_INT) 0 << MAX_WCHAR_TYPE_SIZE) \
: ~ (HOST_WIDEST_INT) 0)
/* 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.
......@@ -165,16 +132,16 @@ extern int c89;
struct constant;
HOST_WIDE_INT parse_escape PROTO((char **, HOST_WIDE_INT));
HOST_WIDEST_INT parse_escape PROTO((char **, HOST_WIDEST_INT));
int check_assertion PROTO((U_CHAR *, int, int, struct arglist *));
struct hashnode *lookup PROTO((U_CHAR *, int, int));
void error PRINTF_PROTO_1((char *, ...));
void pedwarn PRINTF_PROTO_1((char *, ...));
void warning PRINTF_PROTO_1((char *, ...));
void error PVPROTO((char *, ...)) ATTRIBUTE_PRINTF_1;
void pedwarn PVPROTO((char *, ...)) ATTRIBUTE_PRINTF_1;
void warning PVPROTO((char *, ...)) ATTRIBUTE_PRINTF_1;
static int parse_number PROTO((int));
static HOST_WIDE_INT left_shift PROTO((struct constant *, unsigned_HOST_WIDE_INT));
static HOST_WIDE_INT right_shift PROTO((struct constant *, unsigned_HOST_WIDE_INT));
static HOST_WIDEST_INT left_shift PROTO((struct constant *, unsigned HOST_WIDEST_INT));
static HOST_WIDEST_INT right_shift PROTO((struct constant *, unsigned HOST_WIDEST_INT));
static void integer_overflow PROTO((void));
/* `signedp' values */
......@@ -183,7 +150,7 @@ static void integer_overflow PROTO((void));
%}
%union {
struct constant {HOST_WIDE_INT value; int signedp;} integer;
struct constant {HOST_WIDEST_INT value; int signedp;} integer;
struct name {U_CHAR *address; int length;} name;
struct arglist *keywords;
}
......@@ -270,7 +237,7 @@ exp : exp '*' exp
integer_overflow ();
}
else
$$.value = ((unsigned_HOST_WIDE_INT) $1.value
$$.value = ((unsigned HOST_WIDEST_INT) $1.value
* $3.value); }
| exp '/' exp
{ if ($3.value == 0)
......@@ -287,7 +254,7 @@ exp : exp '*' exp
integer_overflow ();
}
else
$$.value = ((unsigned_HOST_WIDE_INT) $1.value
$$.value = ((unsigned HOST_WIDEST_INT) $1.value
/ $3.value); }
| exp '%' exp
{ if ($3.value == 0)
......@@ -300,7 +267,7 @@ exp : exp '*' exp
if ($$.signedp)
$$.value = $1.value % $3.value;
else
$$.value = ((unsigned_HOST_WIDE_INT) $1.value
$$.value = ((unsigned HOST_WIDEST_INT) $1.value
% $3.value); }
| exp '+' exp
{ $$.value = $1.value + $3.value;
......@@ -337,28 +304,28 @@ exp : exp '*' exp
if ($1.signedp & $3.signedp)
$$.value = $1.value <= $3.value;
else
$$.value = ((unsigned_HOST_WIDE_INT) $1.value
$$.value = ((unsigned HOST_WIDEST_INT) $1.value
<= $3.value); }
| exp GEQ exp
{ $$.signedp = SIGNED;
if ($1.signedp & $3.signedp)
$$.value = $1.value >= $3.value;
else
$$.value = ((unsigned_HOST_WIDE_INT) $1.value
$$.value = ((unsigned HOST_WIDEST_INT) $1.value
>= $3.value); }
| exp '<' exp
{ $$.signedp = SIGNED;
if ($1.signedp & $3.signedp)
$$.value = $1.value < $3.value;
else
$$.value = ((unsigned_HOST_WIDE_INT) $1.value
$$.value = ((unsigned HOST_WIDEST_INT) $1.value
< $3.value); }
| exp '>' exp
{ $$.signedp = SIGNED;
if ($1.signedp & $3.signedp)
$$.value = $1.value > $3.value;
else
$$.value = ((unsigned_HOST_WIDE_INT) $1.value
$$.value = ((unsigned HOST_WIDEST_INT) $1.value
> $3.value); }
| exp '&' exp
{ $$.value = $1.value & $3.value;
......@@ -441,7 +408,7 @@ parse_number (olen)
{
register char *p = lexptr;
register int c;
register unsigned_HOST_WIDE_INT n = 0, nd, max_over_base;
register unsigned HOST_WIDEST_INT n = 0, nd, max_over_base;
register int base = 10;
register int len = olen;
register int overflow = 0;
......@@ -459,7 +426,7 @@ parse_number (olen)
}
}
max_over_base = (unsigned_HOST_WIDE_INT) -1 / base;
max_over_base = (unsigned HOST_WIDEST_INT) -1 / base;
for (; len > 0; len--) {
c = *p++;
......@@ -514,7 +481,7 @@ parse_number (olen)
pedwarn ("integer constant out of range");
/* If too big to be signed, consider it unsigned. */
if (((HOST_WIDE_INT) n & yylval.integer.signedp) < 0)
if (((HOST_WIDEST_INT) n & yylval.integer.signedp) < 0)
{
if (base == 10)
warning ("integer constant is so large that it is unsigned");
......@@ -555,7 +522,7 @@ yylex ()
register unsigned char *tokstart;
register struct token *toktab;
int wide_flag;
HOST_WIDE_INT mask;
HOST_WIDEST_INT mask;
retry:
......@@ -622,7 +589,7 @@ yylex ()
handles multicharacter constants and wide characters.
It is mostly copied from c-lex.c. */
{
register HOST_WIDE_INT result = 0;
register HOST_WIDEST_INT result = 0;
register int num_chars = 0;
int chars_seen = 0;
unsigned width = MAX_CHAR_TYPE_SIZE;
......@@ -737,12 +704,12 @@ yylex ()
sizeof ("__CHAR_UNSIGNED__") - 1, -1)
|| ((result >> (num_bits - 1)) & 1) == 0)
yylval.integer.value
= result & (~ (unsigned_HOST_WIDE_INT) 0
>> (HOST_BITS_PER_WIDE_INT - num_bits));
= result & (~ (unsigned HOST_WIDEST_INT) 0
>> (HOST_BITS_PER_WIDEST_INT - num_bits));
else
yylval.integer.value
= result | ~(~ (unsigned_HOST_WIDE_INT) 0
>> (HOST_BITS_PER_WIDE_INT - num_bits));
= result | ~(~ (unsigned HOST_WIDEST_INT) 0
>> (HOST_BITS_PER_WIDEST_INT - num_bits));
}
else
{
......@@ -868,10 +835,10 @@ yylex ()
If \ is followed by 000, we return 0 and leave the string pointer
after the zeros. A value of 0 does not mean end of string. */
HOST_WIDE_INT
HOST_WIDEST_INT
parse_escape (string_ptr, result_mask)
char **string_ptr;
HOST_WIDE_INT result_mask;
HOST_WIDEST_INT result_mask;
{
register int c = *(*string_ptr)++;
switch (c)
......@@ -910,7 +877,7 @@ parse_escape (string_ptr, result_mask)
case '6':
case '7':
{
register HOST_WIDE_INT i = c - '0';
register HOST_WIDEST_INT i = c - '0';
register int count = 0;
while (++count < 3)
{
......@@ -932,7 +899,7 @@ parse_escape (string_ptr, result_mask)
}
case 'x':
{
register unsigned_HOST_WIDE_INT i = 0, overflow = 0;
register unsigned HOST_WIDEST_INT i = 0, overflow = 0;
register int digits_found = 0, digit;
for (;;)
{
......@@ -973,31 +940,31 @@ integer_overflow ()
pedwarn ("integer overflow in preprocessor expression");
}
static HOST_WIDE_INT
static HOST_WIDEST_INT
left_shift (a, b)
struct constant *a;
unsigned_HOST_WIDE_INT b;
unsigned HOST_WIDEST_INT b;
{
/* It's unclear from the C standard whether shifts can overflow.
The following code ignores overflow; perhaps a C standard
interpretation ruling is needed. */
if (b >= HOST_BITS_PER_WIDE_INT)
if (b >= HOST_BITS_PER_WIDEST_INT)
return 0;
else
return (unsigned_HOST_WIDE_INT) a->value << b;
return (unsigned HOST_WIDEST_INT) a->value << b;
}
static HOST_WIDE_INT
static HOST_WIDEST_INT
right_shift (a, b)
struct constant *a;
unsigned_HOST_WIDE_INT b;
unsigned HOST_WIDEST_INT b;
{
if (b >= HOST_BITS_PER_WIDE_INT)
return a->signedp ? a->value >> (HOST_BITS_PER_WIDE_INT - 1) : 0;
if (b >= HOST_BITS_PER_WIDEST_INT)
return a->signedp ? a->value >> (HOST_BITS_PER_WIDEST_INT - 1) : 0;
else if (a->signedp)
return a->value >> b;
else
return (unsigned_HOST_WIDE_INT) a->value >> b;
return (unsigned HOST_WIDEST_INT) a->value >> b;
}
/* This page contains the entry point to this file. */
......@@ -1010,7 +977,7 @@ right_shift (a, b)
We do not support C comments. They should be removed before
this function is called. */
HOST_WIDE_INT
HOST_WIDEST_INT
parse_c_expression (string, warn_undefined)
char *string;
int warn_undefined;
......@@ -1064,10 +1031,11 @@ extern int yydebug;
int pedantic;
int traditional;
int c89;
int main PROTO((int, char **));
static void initialize_random_junk PROTO((void));
static void print_unsigned_host_wide_int PROTO((unsigned_HOST_WIDE_INT));
static void print_unsigned_host_widest_int PROTO((unsigned HOST_WIDEST_INT));
/* Main program for testing purposes. */
int
......@@ -1077,12 +1045,13 @@ main (argc, argv)
{
int n, c;
char buf[1024];
unsigned_HOST_WIDE_INT u;
unsigned HOST_WIDEST_INT u;
pedantic = 1 < argc;
traditional = 2 < argc;
c89 = 3 < argc;
#if YYDEBUG
yydebug = 3 < argc;
yydebug = 4 < argc;
#endif
initialize_random_junk ();
......@@ -1095,7 +1064,7 @@ main (argc, argv)
break;
parse_c_expression (buf, 1);
printf ("parser returned ");
u = (unsigned_HOST_WIDE_INT) expression_value;
u = (unsigned HOST_WIDEST_INT) expression_value;
if (expression_value < 0 && expression_signedp) {
u = -u;
printf ("-");
......@@ -1103,7 +1072,7 @@ main (argc, argv)
if (u == 0)
printf ("0");
else
print_unsigned_host_wide_int (u);
print_unsigned_host_widest_int (u);
if (! expression_signedp)
printf("u");
printf ("\n");
......@@ -1113,11 +1082,11 @@ main (argc, argv)
}
static void
print_unsigned_host_wide_int (u)
unsigned_HOST_WIDE_INT u;
print_unsigned_host_widest_int (u)
unsigned HOST_WIDEST_INT u;
{
if (u) {
print_unsigned_host_wide_int (u / 10);
print_unsigned_host_widest_int (u / 10);
putchar ('0' + (int) (u % 10));
}
}
......
......@@ -482,15 +482,4 @@ extern void abort ();
/* Get libiberty declarations. */
#include "libiberty.h"
#if defined (ANSI_PROTOTYPES)
# define PRINTF_PROTO(ARGS, m, n) PVPROTO (ARGS) ATTRIBUTE_PRINTF(m, n)
#else
# define PRINTF_PROTO(ARGS, m, n) () ATTRIBUTE_PRINTF(m, n)
#endif
#define PRINTF_PROTO_1(ARGS) PRINTF_PROTO(ARGS, 1, 2)
#define PRINTF_PROTO_2(ARGS) PRINTF_PROTO(ARGS, 2, 3)
#define PRINTF_PROTO_3(ARGS) PRINTF_PROTO(ARGS, 3, 4)
#define PRINTF_PROTO_4(ARGS) PRINTF_PROTO(ARGS, 4, 5)
#endif /* __GCC_SYSTEM_H__ */
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