(HOST_WIDE_INT, HOST_BITS_PER_WIDE_INT): New macros.

(expression_value): Now HOST_WIDE_INT.
(parse_c_expression): Now returns HOST_WIDE_INT.

From-SVN: r8106
This commit is contained in:
Richard Kenner 1994-09-20 19:02:37 -04:00
parent 16b02ae092
commit 979b374813

View File

@ -1,5 +1,5 @@
/* Parse C expressions for CCCP. /* Parse C expressions for CCCP.
Copyright (C) 1987, 1992 Free Software Foundation. Copyright (C) 1987, 1992, 1994 Free Software Foundation.
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the under the terms of the GNU General Public License as published by the
@ -59,13 +59,27 @@ struct arglist {
#endif #endif
#endif #endif
/* Find the largest host integer type and set its size and type. */
#ifndef HOST_BITS_PER_WIDE_INT
#if HOST_BITS_PER_LONG > HOST_BITS_PER_INT
#define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_LONG
#define HOST_WIDE_INT long
#else
#define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_INT
#define HOST_WIDE_INT int
#endif
#endif
#ifndef NULL_PTR #ifndef NULL_PTR
#define NULL_PTR ((GENERIC_PTR)0) #define NULL_PTR ((GENERIC_PTR)0)
#endif #endif
int yylex (); int yylex ();
void yyerror (); void yyerror ();
int expression_value; HOST_WIDE_INT expression_value;
static jmp_buf parse_return_error; static jmp_buf parse_return_error;
@ -905,7 +919,7 @@ right_shift (a, b)
/* We do not support C comments. They should be removed before /* We do not support C comments. They should be removed before
this function is called. */ this function is called. */
int HOST_WIDE_INT
parse_c_expression (string) parse_c_expression (string)
char *string; char *string;
{ {
@ -954,7 +968,7 @@ main ()
if (buf[n] == EOF) if (buf[n] == EOF)
break; break;
buf[n] = '\0'; buf[n] = '\0';
printf ("parser returned %d\n", parse_c_expression (buf)); printf ("parser returned %ld\n", parse_c_expression (buf));
} }
return 0; return 0;