Commit 8d9bfdc5 by Richard Kenner

Changes to support execution on 64-bit machines.

From-SVN: r1484
parent 9e4223f2
...@@ -343,8 +343,21 @@ yyprint (file, yychar, yylval) ...@@ -343,8 +343,21 @@ yyprint (file, yychar, yylval)
case CONSTANT: case CONSTANT:
t = yylval.ttype; t = yylval.ttype;
if (TREE_CODE (t) == INTEGER_CST) if (TREE_CODE (t) == INTEGER_CST)
fprintf (file, " 0x%8x%8x", TREE_INT_CST_HIGH (t), fprintf (file,
TREE_INT_CST_LOW (t)); #if HOST_BITS_PER_WIDE_INT == 64
#if HOST_BITS_PER_WIDE_INT != HOST_BITS_PER_INT
" 0x%lx%016lx",
#else
" 0x%x%016x",
#endif
#else
#if HOST_BITS_PER_WIDE_INT != HOST_BITS_PER_INT
" 0x%lx%08lx",
#else
" 0x%x%08x",
#endif
#endif
TREE_INT_CST_HIGH (t), TREE_INT_CST_LOW (t));
break; break;
} }
} }
...@@ -1344,7 +1357,7 @@ yylex () ...@@ -1344,7 +1357,7 @@ yylex ()
{ {
set_float_handler (handler); set_float_handler (handler);
value = REAL_VALUE_ATOF (token_buffer); value = REAL_VALUE_ATOF (token_buffer);
set_float_handler (0); set_float_handler (NULL_PTR);
} }
#ifdef ERANGE #ifdef ERANGE
if (errno == ERANGE && !flag_traditional && pedantic) if (errno == ERANGE && !flag_traditional && pedantic)
...@@ -1424,6 +1437,7 @@ yylex () ...@@ -1424,6 +1437,7 @@ yylex ()
else else
{ {
tree traditional_type, ansi_type, type; tree traditional_type, ansi_type, type;
HOST_WIDE_INT high, low;
int spec_unsigned = 0; int spec_unsigned = 0;
int spec_long = 0; int spec_long = 0;
int spec_long_long = 0; int spec_long_long = 0;
...@@ -1496,14 +1510,18 @@ yylex () ...@@ -1496,14 +1510,18 @@ yylex ()
/* This is simplified by the fact that our constant /* This is simplified by the fact that our constant
is always positive. */ is always positive. */
/* The casts in the following statement should not be
needed, but they get around bugs in some C compilers. */ high = low = 0;
yylval.ttype
= (build_int_2 for (i = 0; i < HOST_BITS_PER_WIDE_INT / HOST_BITS_PER_CHAR; i++)
((((long)parts[3]<<24) + ((long)parts[2]<<16) {
+ ((long)parts[1]<<8) + (long)parts[0]), high |= ((HOST_WIDE_INT) parts[i + (HOST_BITS_PER_WIDE_INT
(((long)parts[7]<<24) + ((long)parts[6]<<16) / HOST_BITS_PER_CHAR)]
+ ((long)parts[5]<<8) + (long)parts[4]))); << (i * HOST_BITS_PER_CHAR));
low |= (HOST_WIDE_INT) parts[i] << (i * HOST_BITS_PER_CHAR);
}
yylval.ttype = build_int_2 (low, high);
/* If warn_traditional, calculate both the ANSI type and the /* If warn_traditional, calculate both the ANSI type and the
traditional type, then see if they disagree. traditional type, then see if they disagree.
...@@ -1665,13 +1683,13 @@ yylex () ...@@ -1665,13 +1683,13 @@ yylex ()
if (TREE_UNSIGNED (char_type_node) if (TREE_UNSIGNED (char_type_node)
|| ((result >> (num_bits - 1)) & 1) == 0) || ((result >> (num_bits - 1)) & 1) == 0)
yylval.ttype yylval.ttype
= build_int_2 (result & ((unsigned) ~0 = build_int_2 (result & ((unsigned HOST_WIDE_INT) ~0
>> (HOST_BITS_PER_INT - num_bits)), >> (HOST_BITS_PER_WIDE_INT - num_bits)),
0); 0);
else else
yylval.ttype yylval.ttype
= build_int_2 (result | ~((unsigned) ~0 = build_int_2 (result | ~((unsigned HOST_WIDE_INT) ~0
>> (HOST_BITS_PER_INT - num_bits)), >> (HOST_BITS_PER_WIDE_INT - num_bits)),
-1); -1);
} }
else else
...@@ -1685,7 +1703,7 @@ yylex () ...@@ -1685,7 +1703,7 @@ yylex ()
|| (num_chars == 1 && token_buffer[1] != '\0')) || (num_chars == 1 && token_buffer[1] != '\0'))
{ {
wchar_t wc; wchar_t wc;
(void) mbtowc (NULL, NULL, 0); (void) mbtowc (NULL_PTR, NULL_PTR, 0);
if (mbtowc (& wc, token_buffer + 1, num_chars) == num_chars) if (mbtowc (& wc, token_buffer + 1, num_chars) == num_chars)
result = wc; result = wc;
else else
......
...@@ -287,7 +287,7 @@ common_type (t1, t2) ...@@ -287,7 +287,7 @@ common_type (t1, t2)
newargs = 0; newargs = 0;
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
newargs = tree_cons (0, 0, newargs); newargs = tree_cons (NULL_TREE, NULL_TREE, newargs);
n = newargs; n = newargs;
...@@ -1011,7 +1011,7 @@ build_component_ref (datum, component) ...@@ -1011,7 +1011,7 @@ build_component_ref (datum, component)
{ {
if (TYPE_SIZE (type) == 0) if (TYPE_SIZE (type) == 0)
{ {
incomplete_type_error (0, type); incomplete_type_error (NULL_TREE, type);
return error_mark_node; return error_mark_node;
} }
...@@ -2027,7 +2027,7 @@ convert_arguments (typelist, values, name) ...@@ -2027,7 +2027,7 @@ convert_arguments (typelist, values, name)
parmval = default_conversion (parmval); parmval = default_conversion (parmval);
#endif #endif
} }
result = tree_cons (0, parmval, result); result = tree_cons (NULL_TREE, parmval, result);
} }
else if (TREE_CODE (TREE_TYPE (val)) == REAL_TYPE else if (TREE_CODE (TREE_TYPE (val)) == REAL_TYPE
&& (TYPE_PRECISION (TREE_TYPE (val)) && (TYPE_PRECISION (TREE_TYPE (val))
...@@ -3676,7 +3676,7 @@ build_c_cast (type, expr) ...@@ -3676,7 +3676,7 @@ build_c_cast (type, expr)
name = ""; name = "";
return digest_init (type, build_nt (CONSTRUCTOR, NULL_TREE, return digest_init (type, build_nt (CONSTRUCTOR, NULL_TREE,
build_tree_list (field, value)), build_tree_list (field, value)),
0, 0, 0, name); NULL_PTR, 0, 0, name);
} }
error ("cast to union type from type not present in union"); error ("cast to union type from type not present in union");
return error_mark_node; return error_mark_node;
...@@ -4200,7 +4200,7 @@ store_init_value (decl, init) ...@@ -4200,7 +4200,7 @@ store_init_value (decl, init)
/* Digest the specified initializer into an expression. */ /* Digest the specified initializer into an expression. */
value = digest_init (type, init, 0, TREE_STATIC (decl), value = digest_init (type, init, NULL_PTR, TREE_STATIC (decl),
TREE_STATIC (decl) || pedantic, TREE_STATIC (decl) || pedantic,
IDENTIFIER_POINTER (DECL_NAME (decl))); IDENTIFIER_POINTER (DECL_NAME (decl)));
...@@ -4667,13 +4667,13 @@ digest_init (type, init, tail, require_constant, constructor_constant, ofwhat) ...@@ -4667,13 +4667,13 @@ digest_init (type, init, tail, require_constant, constructor_constant, ofwhat)
} }
if (raw_constructor) if (raw_constructor)
result = process_init_constructor (type, inside_init, 0, result = process_init_constructor (type, inside_init, NULL_PTR,
require_constant, require_constant,
constructor_constant, ofwhat); constructor_constant, ofwhat);
else if (tail != 0) else if (tail != 0)
{ {
*tail = old_tail_contents; *tail = old_tail_contents;
result = process_init_constructor (type, 0, tail, result = process_init_constructor (type, NULL_TREE, tail,
require_constant, require_constant,
constructor_constant, ofwhat); constructor_constant, ofwhat);
} }
...@@ -4751,20 +4751,23 @@ digest_init (type, init, tail, require_constant, constructor_constant, ofwhat) ...@@ -4751,20 +4751,23 @@ digest_init (type, init, tail, require_constant, constructor_constant, ofwhat)
{ {
if (raw_constructor) if (raw_constructor)
return process_init_constructor (type, inside_init, return process_init_constructor (type, inside_init,
0, constructor_constant, NULL_PTR, constructor_constant,
constructor_constant, ofwhat); constructor_constant, ofwhat);
else if (tail != 0) else if (tail != 0)
{ {
*tail = old_tail_contents; *tail = old_tail_contents;
return process_init_constructor (type, 0, tail, constructor_constant, return process_init_constructor (type, NULL_TREE, tail,
constructor_constant,
constructor_constant, ofwhat); constructor_constant, ofwhat);
} }
else if (flag_traditional) else if (flag_traditional)
/* Traditionally one can say `char x[100] = 0;'. */ /* Traditionally one can say `char x[100] = 0;'. */
return process_init_constructor (type, return process_init_constructor (type,
build_nt (CONSTRUCTOR, 0, build_nt (CONSTRUCTOR, NULL_TREE,
tree_cons (0, inside_init, 0)), tree_cons (NULL_TREE,
0, constructor_constant, inside_init,
NULL_TREE)),
NULL_PTR, constructor_constant,
constructor_constant, ofwhat); constructor_constant, ofwhat);
} }
...@@ -4906,7 +4909,8 @@ process_init_constructor (type, init, elts, constant_value, constant_element, ...@@ -4906,7 +4909,8 @@ process_init_constructor (type, init, elts, constant_value, constant_element,
TREE_VALUE (tail), &tail1, TREE_VALUE (tail), &tail1,
/* Both of these are the same because /* Both of these are the same because
a value here is an elt overall. */ a value here is an elt overall. */
constant_element, constant_element, 0); constant_element, constant_element,
NULL_PTR);
}); });
if (tail1 != 0 && TREE_CODE (tail1) != TREE_LIST) if (tail1 != 0 && TREE_CODE (tail1) != TREE_LIST)
...@@ -4915,7 +4919,7 @@ process_init_constructor (type, init, elts, constant_value, constant_element, ...@@ -4915,7 +4919,7 @@ process_init_constructor (type, init, elts, constant_value, constant_element,
{ {
error_init ( error_init (
"non-empty initializer for array%s of empty elements", "non-empty initializer for array%s of empty elements",
" `%s'", 0); " `%s'", NULL_PTR);
/* Just ignore what we were supposed to use. */ /* Just ignore what we were supposed to use. */
tail1 = 0; tail1 = 0;
} }
...@@ -5015,7 +5019,8 @@ process_init_constructor (type, init, elts, constant_value, constant_element, ...@@ -5015,7 +5019,8 @@ process_init_constructor (type, init, elts, constant_value, constant_element,
push_member_name (IDENTIFIER_POINTER (DECL_NAME (field))); push_member_name (IDENTIFIER_POINTER (DECL_NAME (field)));
next1 = digest_init (TREE_TYPE (field), next1 = digest_init (TREE_TYPE (field),
TREE_VALUE (tail), &tail1, TREE_VALUE (tail), &tail1,
constant_element, constant_element, 0); constant_element, constant_element,
NULL_PTR);
}); });
if (tail1 != 0 && TREE_CODE (tail1) != TREE_LIST) if (tail1 != 0 && TREE_CODE (tail1) != TREE_LIST)
abort (); abort ();
...@@ -5103,7 +5108,7 @@ process_init_constructor (type, init, elts, constant_value, constant_element, ...@@ -5103,7 +5108,7 @@ process_init_constructor (type, init, elts, constant_value, constant_element,
push_member_name (IDENTIFIER_POINTER (DECL_NAME (field))); push_member_name (IDENTIFIER_POINTER (DECL_NAME (field)));
next1 = digest_init (TREE_TYPE (field), next1 = digest_init (TREE_TYPE (field),
TREE_VALUE (tail), &tail1, TREE_VALUE (tail), &tail1,
constant_value, constant_element, 0); constant_value, constant_element, NULL_PTR);
}); });
if (tail1 != 0 && TREE_CODE (tail1) != TREE_LIST) if (tail1 != 0 && TREE_CODE (tail1) != TREE_LIST)
abort (); abort ();
...@@ -5134,12 +5139,12 @@ process_init_constructor (type, init, elts, constant_value, constant_element, ...@@ -5134,12 +5139,12 @@ process_init_constructor (type, init, elts, constant_value, constant_element,
if (TREE_CODE (type) == UNION_TYPE) if (TREE_CODE (type) == UNION_TYPE)
{ {
pedwarn_init ("excess elements in union initializer%s", pedwarn_init ("excess elements in union initializer%s",
" after `%s'", 0); " after `%s'", NULL_PTR);
} }
else else
{ {
pedwarn_init ("excess elements in aggregate initializer%s", pedwarn_init ("excess elements in aggregate initializer%s",
" after `%s'", 0); " after `%s'", NULL_PTR);
} }
} }
...@@ -5293,7 +5298,7 @@ c_expand_start_case (exp) ...@@ -5293,7 +5298,7 @@ c_expand_start_case (exp)
exp = default_conversion (exp); exp = default_conversion (exp);
type = TREE_TYPE (exp); type = TREE_TYPE (exp);
index = get_unwidened (exp, 0); index = get_unwidened (exp, NULL_TREE);
/* We can't strip a conversion from a signed type to an unsigned, /* We can't strip a conversion from a signed type to an unsigned,
because if we did, int_fits_type_p would do the wrong thing because if we did, int_fits_type_p would do the wrong thing
when checking case values for being in range, when checking case values for being in range,
......
...@@ -120,6 +120,14 @@ typedef struct { unsigned :16, :16, :16; } vms_ino_t; ...@@ -120,6 +120,14 @@ typedef struct { unsigned :16, :16, :16; } vms_ino_t;
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
#endif #endif
#ifndef NULL
#define NULL 0
#endif
#ifndef NULL_PTR
#define NULL_PTR (char *) NULL
#endif
/* Exported declarations. */ /* Exported declarations. */
char *xmalloc (); char *xmalloc ();
...@@ -1589,7 +1597,7 @@ main (argc, argv) ...@@ -1589,7 +1597,7 @@ main (argc, argv)
perror_with_name (pend_files[i]); perror_with_name (pend_files[i]);
return FAILURE_EXIT_CODE; return FAILURE_EXIT_CODE;
} }
finclude (fd, pend_files[i], &outbuf, 0, 0); finclude (fd, pend_files[i], &outbuf, 0, NULL_PTR);
} }
no_output--; no_output--;
...@@ -1773,7 +1781,7 @@ main (argc, argv) ...@@ -1773,7 +1781,7 @@ main (argc, argv)
perror_with_name (pend_includes[i]); perror_with_name (pend_includes[i]);
return FAILURE_EXIT_CODE; return FAILURE_EXIT_CODE;
} }
finclude (fd, pend_includes[i], &outbuf, 0, 0); finclude (fd, pend_includes[i], &outbuf, 0, NULL_PTR);
} }
/* Scan the input, processing macros and directives. */ /* Scan the input, processing macros and directives. */
...@@ -3329,7 +3337,8 @@ handle_directive (ip, op) ...@@ -3329,7 +3337,8 @@ handle_directive (ip, op)
case '\"': case '\"':
{ {
register U_CHAR *bp1 register U_CHAR *bp1
= skip_quoted_string (xp - 1, bp, ip->lineno, 0, 0, 0); = skip_quoted_string (xp - 1, bp, ip->lineno,
NULL_PTR, NULL_PTR, NULL_PTR);
while (xp != bp1) while (xp != bp1)
if (*xp == '\\') { if (*xp == '\\') {
if (*++xp != '\n') if (*++xp != '\n')
...@@ -4307,8 +4316,8 @@ check_preconditions (prec) ...@@ -4307,8 +4316,8 @@ check_preconditions (prec)
HASHNODE *hp; HASHNODE *hp;
prec += 6; prec += 6;
mdef = create_definition (prec, lineend, 0); mdef = create_definition (prec, lineend, NULL_PTR);
if (mdef.defn == 0) if (mdef.defn == 0)
abort(); abort();
...@@ -4695,7 +4704,7 @@ create_definition (buf, limit, op) ...@@ -4695,7 +4704,7 @@ create_definition (buf, limit, op)
if (is_hor_space[*bp]) if (is_hor_space[*bp])
++bp; /* skip exactly one blank/tab char */ ++bp; /* skip exactly one blank/tab char */
/* now everything from bp before limit is the definition. */ /* now everything from bp before limit is the definition. */
defn = collect_expansion (bp, limit, -1, 0); defn = collect_expansion (bp, limit, -1, NULL_PTR);
defn->args.argnames = (U_CHAR *) ""; defn->args.argnames = (U_CHAR *) "";
} }
...@@ -5452,7 +5461,7 @@ read_token_list (bpp, limit, error_flag) ...@@ -5452,7 +5461,7 @@ read_token_list (bpp, limit, error_flag)
break; break;
bp++; bp++;
} else if (*bp == '"' || *bp == '\'') } else if (*bp == '"' || *bp == '\'')
bp = skip_quoted_string (bp, limit, 0, 0, 0, &eofp); bp = skip_quoted_string (bp, limit, 0, NULL_PTR, NULL_PTR, &eofp);
else else
while (! is_hor_space[*bp] && *bp != '(' && *bp != ')' while (! is_hor_space[*bp] && *bp != '(' && *bp != ')'
&& *bp != '"' && *bp != '\'' && bp != limit) && *bp != '"' && *bp != '\'' && bp != limit)
...@@ -5911,7 +5920,7 @@ do_if (buf, limit, op, keyword) ...@@ -5911,7 +5920,7 @@ do_if (buf, limit, op, keyword)
FILE_BUF *ip = &instack[indepth]; FILE_BUF *ip = &instack[indepth];
value = eval_if_expression (buf, limit - buf); value = eval_if_expression (buf, limit - buf);
conditional_skip (ip, value == 0, T_IF, 0); conditional_skip (ip, value == 0, T_IF, NULL_PTR);
return 0; return 0;
} }
...@@ -6142,7 +6151,8 @@ skip_if_group (ip, any) ...@@ -6142,7 +6151,8 @@ skip_if_group (ip, any)
break; break;
case '\"': case '\"':
case '\'': case '\'':
bp = skip_quoted_string (bp - 1, endb, ip->lineno, &ip->lineno, 0, 0); bp = skip_quoted_string (bp - 1, endb, ip->lineno, &ip->lineno,
NULL_PTR, NULL_PTR);
break; break;
case '\\': case '\\':
/* Char after backslash loses its special meaning. */ /* Char after backslash loses its special meaning. */
...@@ -6674,7 +6684,7 @@ skip_paren_group (ip) ...@@ -6674,7 +6684,7 @@ skip_paren_group (ip)
case '\'': case '\'':
{ {
int eofp = 0; int eofp = 0;
p = skip_quoted_string (p - 1, limit, 0, 0, 0, &eofp); p = skip_quoted_string (p - 1, limit, 0, NULL_PTR, NULL_PTR, &eofp);
if (eofp) if (eofp)
return ip->bufp = p; return ip->bufp = p;
} }
...@@ -6844,7 +6854,7 @@ macroexpand (hp, op) ...@@ -6844,7 +6854,7 @@ macroexpand (hp, op)
parse_error = macarg (&args[i], rest_args); parse_error = macarg (&args[i], rest_args);
} }
else else
parse_error = macarg (0, 0); parse_error = macarg (NULL_PTR, 0);
if (parse_error) { if (parse_error) {
error_with_line (line_for_error (start_line), parse_error); error_with_line (line_for_error (start_line), parse_error);
break; break;
...@@ -7505,6 +7515,7 @@ delete_newlines (start, length) ...@@ -7505,6 +7515,7 @@ delete_newlines (start, length)
void void
error (msg, arg1, arg2, arg3) error (msg, arg1, arg2, arg3)
char *msg; char *msg;
char *arg1, *arg2, *arg3;
{ {
int i; int i;
FILE_BUF *ip = NULL; FILE_BUF *ip = NULL;
...@@ -7557,6 +7568,7 @@ error_from_errno (name) ...@@ -7557,6 +7568,7 @@ error_from_errno (name)
void void
warning (msg, arg1, arg2, arg3) warning (msg, arg1, arg2, arg3)
char *msg; char *msg;
char *arg1, *arg2, *arg3;
{ {
int i; int i;
FILE_BUF *ip = NULL; FILE_BUF *ip = NULL;
...@@ -7586,6 +7598,7 @@ static void ...@@ -7586,6 +7598,7 @@ static void
error_with_line (line, msg, arg1, arg2, arg3) error_with_line (line, msg, arg1, arg2, arg3)
int line; int line;
char *msg; char *msg;
char *arg1, *arg2, *arg3;
{ {
int i; int i;
FILE_BUF *ip = NULL; FILE_BUF *ip = NULL;
...@@ -7610,6 +7623,7 @@ error_with_line (line, msg, arg1, arg2, arg3) ...@@ -7610,6 +7623,7 @@ error_with_line (line, msg, arg1, arg2, arg3)
void void
pedwarn (msg, arg1, arg2, arg3) pedwarn (msg, arg1, arg2, arg3)
char *msg; char *msg;
char *arg1, *arg2, *arg3;
{ {
if (pedantic_errors) if (pedantic_errors)
error (msg, arg1, arg2, arg3); error (msg, arg1, arg2, arg3);
...@@ -7625,6 +7639,7 @@ pedwarn_with_file_and_line (file, line, msg, arg1, arg2, arg3) ...@@ -7625,6 +7639,7 @@ pedwarn_with_file_and_line (file, line, msg, arg1, arg2, arg3)
char *file; char *file;
int line; int line;
char *msg; char *msg;
char *arg1, *arg2, *arg3;
{ {
int i; int i;
if (!pedantic_errors && inhibit_warnings) if (!pedantic_errors && inhibit_warnings)
...@@ -8001,7 +8016,8 @@ dump_defn_1 (base, start, length, of) ...@@ -8001,7 +8016,8 @@ dump_defn_1 (base, start, length, of)
if (*p != '\n') if (*p != '\n')
putc (*p, of); putc (*p, of);
else if (*p == '\"' || *p =='\'') { else if (*p == '\"' || *p =='\'') {
U_CHAR *p1 = skip_quoted_string (p, limit, 0, 0, 0, 0); U_CHAR *p1 = skip_quoted_string (p, limit, 0, NULL_PTR,
NULL_PTR, NULL_PTR);
fwrite (p, p1 - p, 1, of); fwrite (p, p1 - p, 1, of);
p = p1 - 1; p = p1 - 1;
} }
...@@ -8314,7 +8330,7 @@ make_assertion (option, str) ...@@ -8314,7 +8330,7 @@ make_assertion (option, str)
/* pass NULL as output ptr to do_define since we KNOW it never /* pass NULL as output ptr to do_define since we KNOW it never
does any output.... */ does any output.... */
do_assert (buf, buf + strlen (buf) , NULL, kt); do_assert (buf, buf + strlen (buf) , NULL_PTR, kt);
--indepth; --indepth;
} }
......
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