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