+Fri Nov 27 12:28:56 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * system.h: Include libiberty.h.
+
+ * c-aux-info.c: Remove prototypes for concat/concat3. Change
+ function `concat' from fixed parameters to variable parameters,
+ as is done in libiberty. All callers of concat/concat3
+ changed to use the new `concat' with variable args.
+
+ * cccp.c: Remove things made redundant by libiberty.h and/or
+ conform to libiberty standards.
+ * cexp.y: Likewise.
+ * collect2.c: Likewise.
+ * config/1750a/1750a.h: Likewise.
+ * cppalloc.c: Likewise.
+ * cppexp.c: Likewise.
+ * cppfiles.c: Likewise.
+ * cpphash.c: Likewise.
+ * cpplib.c: Likewise.
+ * dyn-string.c: Likewise.
+ * fix-header.c: Likewise.
+ * gcc.c: Likewise.
+ * gcov.c: Likewise.
+ * genattr.c: Likewise.
+ * genattrtab.c: Likewise.
+ * gencheck.c: Likewise.
+ * gencodes.c: Likewise.
+ * genconfig.c: Likewise.
+ * genemit.c: Likewise.
+ * genextract.c: Likewise.
+ * genflags.c: Likewise.
+ * gengenrtl.c: Likewise.
+ * genopinit.c: Likewise.
+ * genoutput.c: Likewise.
+ * genpeep.c: Likewise.
+ * genrecog.c: Likewise.
+ * getpwd.c: Likewise.
+ * halfpic.c: Likewise.
+ * hash.c: Likewise.
+ * mips-tdump.c: Likewise. Wrap malloc/realloc/calloc prototypes
+ in NEED_DECLARATION_* macros.
+
+ * mips-tfile.c: Remove things made redundant by libiberty.h and/or
+ conform to libiberty standards.
+ (fatal): Fix const-ification of variable `format' in
+ !ANSI_PROTOTYPES case.
+
+ * prefix.c: Remove things made redundant by libiberty.h and/or
+ conform to libiberty standards.
+
+ * print-rtl.c: Rename variable `spaces' to `xspaces' to avoid
+ conflicting with function `spaces' from libiberty.
+
+ * profile.c: Remove things made redundant by libiberty.h and/or
+ conform to libiberty standards.
+ * protoize.c: Likewise.
+ * rtl.h: Likewise.
+ * scan.h: Likewise.
+ * tlink.c: Likewise.
+ * toplev.c: Likewise.
+ * toplev.h: Likewise.
+ * tree.h: Likewise.
+
Thu Nov 26 08:38:06 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* cppfiles.c (simplify_pathname): Un-ANSI-fy function definition.
static char *data_type;
-static char *concat PROTO((char *, char *));
-static char *concat3 PROTO((char *, char *, char *));
static char *affix_data_type PROTO((char *));
static char *gen_formal_list_for_type PROTO((tree, formals_style));
static int deserves_ellipsis PROTO((tree));
static char *gen_type PROTO((char *, tree, formals_style));
static char *gen_decl PROTO((tree, int, formals_style));
\f
-/* Take two strings and mash them together into a newly allocated area. */
+/* Concatenate a sequence of strings, returning the result.
-static char *
-concat (s1, s2)
- char *s1;
- char *s2;
+ This function is based on the one in libiberty. */
+
+char *
+concat VPROTO((const char *first, ...))
{
- int size1, size2;
- char *ret_val;
+ register int length;
+ register char *newstr;
+ register char *end;
+ register const char *arg;
+ va_list args;
+#ifndef ANSI_PROTOTYPES
+ const char *first;
+#endif
+
+ /* First compute the size of the result and get sufficient memory. */
+
+ VA_START (args, first);
+#ifndef ANSI_PROTOTYPES
+ first = va_arg (args, const char *);
+#endif
+
+ arg = first;
+ length = 0;
+
+ while (arg != 0)
+ {
+ length += strlen (arg);
+ arg = va_arg (args, const char *);
+ }
- if (!s1)
- s1 = "";
- if (!s2)
- s2 = "";
+ newstr = (char *) malloc (length + 1);
+ va_end (args);
- size1 = strlen (s1);
- size2 = strlen (s2);
- ret_val = xmalloc (size1 + size2 + 1);
- strcpy (ret_val, s1);
- strcpy (&ret_val[size1], s2);
- return ret_val;
-}
+ /* Now copy the individual pieces to the result string. */
-/* Take three strings and mash them together into a newly allocated area. */
+ VA_START (args, first);
+#ifndef ANSI_PROTOTYPES
+ first = va_arg (args, char *);
+#endif
-static char *
-concat3 (s1, s2, s3)
- char *s1;
- char *s2;
- char *s3;
-{
- int size1, size2, size3;
- char *ret_val;
+ end = newstr;
+ arg = first;
+ while (arg != 0)
+ {
+ while (*arg)
+ *end++ = *arg++;
+ arg = va_arg (args, const char *);
+ }
+ *end = '\000';
+ va_end (args);
- if (!s1)
- s1 = "";
- if (!s2)
- s2 = "";
- if (!s3)
- s3 = "";
-
- size1 = strlen (s1);
- size2 = strlen (s2);
- size3 = strlen (s3);
- ret_val = xmalloc (size1 + size2 + size3 + 1);
- strcpy (ret_val, s1);
- strcpy (&ret_val[size1], s2);
- strcpy (&ret_val[size1+size2], s3);
- return ret_val;
+ return (newstr);
}
/* Given a string representing an entire type or an entire declaration
add a blank after the data-type of course. */
if (p == type_or_decl)
- return concat3 (data_type, " ", type_or_decl);
+ return concat (data_type, " ", type_or_decl, NULL_PTR);
saved = *p;
*p = '\0';
- qualifiers_then_data_type = concat (type_or_decl, data_type);
+ qualifiers_then_data_type = concat (type_or_decl, data_type, NULL_PTR);
*p = saved;
- return concat3 (qualifiers_then_data_type, " ", p);
+ return concat (qualifiers_then_data_type, " ", p, NULL_PTR);
}
/* Given a tree node which represents some "function type", generate the
char *this_type;
if (*formal_list)
- formal_list = concat (formal_list, ", ");
+ formal_list = concat (formal_list, ", ", NULL_PTR);
this_type = gen_type ("", TREE_VALUE (formal_type), ansi);
formal_list
= ((strlen (this_type))
- ? concat (formal_list, affix_data_type (this_type))
- : concat (formal_list, data_type));
+ ? concat (formal_list, affix_data_type (this_type), NULL_PTR)
+ : concat (formal_list, data_type, NULL_PTR));
formal_type = TREE_CHAIN (formal_type);
}
petered out to a NULL (i.e. without being terminated by a
void_type_node) then we need to tack on an ellipsis. */
if (!formal_type)
- formal_list = concat (formal_list, ", ...");
+ formal_list = concat (formal_list, ", ...", NULL_PTR);
}
- return concat3 (" (", formal_list, ")");
+ return concat (" (", formal_list, ")", NULL_PTR);
}
/* For the generation of an ANSI prototype for a function definition, we have
char *this_formal;
if (*formal_list && ((style == ansi) || (style == k_and_r_names)))
- formal_list = concat (formal_list, ", ");
+ formal_list = concat (formal_list, ", ", NULL_PTR);
this_formal = gen_decl (formal_decl, 0, style);
if (style == k_and_r_decls)
- formal_list = concat3 (formal_list, this_formal, "; ");
+ formal_list = concat (formal_list, this_formal, "; ", NULL_PTR);
else
- formal_list = concat (formal_list, this_formal);
+ formal_list = concat (formal_list, this_formal, NULL_PTR);
formal_decl = TREE_CHAIN (formal_decl);
}
if (style == ansi)
{
if (!DECL_ARGUMENTS (fndecl))
- formal_list = concat (formal_list, "void");
+ formal_list = concat (formal_list, "void", NULL_PTR);
if (deserves_ellipsis (TREE_TYPE (fndecl)))
- formal_list = concat (formal_list, ", ...");
+ formal_list = concat (formal_list, ", ...", NULL_PTR);
}
if ((style == ansi) || (style == k_and_r_names))
- formal_list = concat3 (" (", formal_list, ")");
+ formal_list = concat (" (", formal_list, ")", NULL_PTR);
return formal_list;
}
{
case POINTER_TYPE:
if (TYPE_READONLY (t))
- ret_val = concat ("const ", ret_val);
+ ret_val = concat ("const ", ret_val, NULL_PTR);
if (TYPE_VOLATILE (t))
- ret_val = concat ("volatile ", ret_val);
+ ret_val = concat ("volatile ", ret_val, NULL_PTR);
- ret_val = concat ("*", ret_val);
+ ret_val = concat ("*", ret_val, NULL_PTR);
if (TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE || TREE_CODE (TREE_TYPE (t)) == FUNCTION_TYPE)
- ret_val = concat3 ("(", ret_val, ")");
+ ret_val = concat ("(", ret_val, ")", NULL_PTR);
ret_val = gen_type (ret_val, TREE_TYPE (t), style);
case ARRAY_TYPE:
if (TYPE_SIZE (t) == 0 || TREE_CODE (TYPE_SIZE (t)) != INTEGER_CST)
- ret_val = gen_type (concat (ret_val, "[]"), TREE_TYPE (t), style);
+ ret_val = gen_type (concat (ret_val, "[]", NULL_PTR),
+ TREE_TYPE (t), style);
else if (int_size_in_bytes (t) == 0)
- ret_val = gen_type (concat (ret_val, "[0]"), TREE_TYPE (t), style);
+ ret_val = gen_type (concat (ret_val, "[0]", NULL_PTR),
+ TREE_TYPE (t), style);
else
{
int size = (int_size_in_bytes (t) / int_size_in_bytes (TREE_TYPE (t)));
char buff[10];
sprintf (buff, "[%d]", size);
- ret_val = gen_type (concat (ret_val, buff),
+ ret_val = gen_type (concat (ret_val, buff, NULL_PTR),
TREE_TYPE (t), style);
}
break;
case FUNCTION_TYPE:
- ret_val = gen_type (concat (ret_val, gen_formal_list_for_type (t, style)), TREE_TYPE (t), style);
+ ret_val = gen_type (concat (ret_val,
+ gen_formal_list_for_type (t, style),
+ NULL_PTR),
+ TREE_TYPE (t), style);
break;
case IDENTIFIER_NODE:
chain_p = TYPE_FIELDS (t);
while (chain_p)
{
- data_type = concat (data_type, gen_decl (chain_p, 0, ansi));
+ data_type = concat (data_type, gen_decl (chain_p, 0, ansi),
+ NULL_PTR);
chain_p = TREE_CHAIN (chain_p);
- data_type = concat (data_type, "; ");
+ data_type = concat (data_type, "; ", NULL_PTR);
}
- data_type = concat3 ("{ ", data_type, "}");
+ data_type = concat ("{ ", data_type, "}", NULL_PTR);
}
- data_type = concat ("struct ", data_type);
+ data_type = concat ("struct ", data_type, NULL_PTR);
break;
case UNION_TYPE:
chain_p = TYPE_FIELDS (t);
while (chain_p)
{
- data_type = concat (data_type, gen_decl (chain_p, 0, ansi));
+ data_type = concat (data_type, gen_decl (chain_p, 0, ansi),
+ NULL_PTR);
chain_p = TREE_CHAIN (chain_p);
- data_type = concat (data_type, "; ");
+ data_type = concat (data_type, "; ", NULL_PTR);
}
- data_type = concat3 ("{ ", data_type, "}");
+ data_type = concat ("{ ", data_type, "}", NULL_PTR);
}
- data_type = concat ("union ", data_type);
+ data_type = concat ("union ", data_type, NULL_PTR);
break;
case ENUMERAL_TYPE:
while (chain_p)
{
data_type = concat (data_type,
- IDENTIFIER_POINTER (TREE_PURPOSE (chain_p)));
+ IDENTIFIER_POINTER (TREE_PURPOSE (chain_p)), NULL_PTR);
chain_p = TREE_CHAIN (chain_p);
if (chain_p)
- data_type = concat (data_type, ", ");
+ data_type = concat (data_type, ", ", NULL_PTR);
}
- data_type = concat3 ("{ ", data_type, " }");
+ data_type = concat ("{ ", data_type, " }", NULL_PTR);
}
- data_type = concat ("enum ", data_type);
+ data_type = concat ("enum ", data_type, NULL_PTR);
break;
case TYPE_DECL:
/* Normally, `unsigned' is part of the deal. Not so if it comes
with a type qualifier. */
if (TREE_UNSIGNED (t) && TYPE_QUALS (t))
- data_type = concat ("unsigned ", data_type);
+ data_type = concat ("unsigned ", data_type, NULL_PTR);
break;
case REAL_TYPE:
}
}
if (TYPE_READONLY (t))
- ret_val = concat ("const ", ret_val);
+ ret_val = concat ("const ", ret_val, NULL_PTR);
if (TYPE_VOLATILE (t))
- ret_val = concat ("volatile ", ret_val);
+ ret_val = concat ("volatile ", ret_val, NULL_PTR);
if (TYPE_RESTRICT (t))
- ret_val = concat ("restrict ", ret_val);
+ ret_val = concat ("restrict ", ret_val, NULL_PTR);
return ret_val;
}
generate the qualifiers here. */
if (TREE_THIS_VOLATILE (decl))
- ret_val = concat ("volatile ", ret_val);
+ ret_val = concat ("volatile ", ret_val, NULL_PTR);
if (TREE_READONLY (decl))
- ret_val = concat ("const ", ret_val);
+ ret_val = concat ("const ", ret_val, NULL_PTR);
data_type = "";
if (TREE_CODE (decl) == FUNCTION_DECL && is_func_definition)
{
- ret_val = concat (ret_val, gen_formal_list_for_func_def (decl, ansi));
+ ret_val = concat (ret_val, gen_formal_list_for_func_def (decl, ansi),
+ NULL_PTR);
/* Since we have already added in the formals list stuff, here we don't
add the whole "type" of the function we are considering (which
ret_val = affix_data_type (ret_val);
if (TREE_CODE (decl) != FUNCTION_DECL && DECL_REGISTER (decl))
- ret_val = concat ("register ", ret_val);
+ ret_val = concat ("register ", ret_val, NULL_PTR);
if (TREE_PUBLIC (decl))
- ret_val = concat ("extern ", ret_val);
+ ret_val = concat ("extern ", ret_val, NULL_PTR);
if (TREE_CODE (decl) == FUNCTION_DECL && !TREE_PUBLIC (decl))
- ret_val = concat ("static ", ret_val);
+ ret_val = concat ("static ", ret_val, NULL_PTR);
return ret_val;
}
static void pipe_closed PROTO((int)) __attribute__ ((noreturn));
static void memory_full PROTO((void)) __attribute__ ((noreturn));
-GENERIC_PTR xmalloc PROTO((size_t));
-static GENERIC_PTR xrealloc PROTO((GENERIC_PTR, size_t));
-static GENERIC_PTR xcalloc PROTO((size_t, size_t));
static char *savestring PROTO((char *));
static void print_help PROTO((void));
\f
fatal ("Memory exhausted.");
}
-
-GENERIC_PTR
+PTR
xmalloc (size)
- size_t size;
+ size_t size;
{
- register GENERIC_PTR ptr = (GENERIC_PTR) malloc (size);
+ register PTR ptr = (PTR) malloc (size);
if (!ptr)
memory_full ();
return ptr;
}
-static GENERIC_PTR
+PTR
xrealloc (old, size)
- GENERIC_PTR old;
- size_t size;
+ PTR old;
+ size_t size;
{
- register GENERIC_PTR ptr = (GENERIC_PTR) realloc (old, size);
+ register PTR ptr = (PTR) realloc (old, size);
if (!ptr)
memory_full ();
return ptr;
}
-static GENERIC_PTR
+PTR
xcalloc (number, size)
- size_t number, size;
+ size_t number, size;
{
register size_t total = number * size;
- register GENERIC_PTR ptr = (GENERIC_PTR) malloc (total);
+ register PTR ptr = (PTR) malloc (total);
if (!ptr)
memory_full ();
bzero (ptr, total);
struct constant;
-GENERIC_PTR xmalloc PROTO((size_t));
HOST_WIDE_INT parse_escape PROTO((char **, HOST_WIDE_INT));
int check_assertion PROTO((U_CHAR *, int, int, struct arglist *));
struct hashnode *lookup PROTO((U_CHAR *, int, int));
#define SIGNED (~0)
#define UNSIGNED 0
-#line 195 "cexp.y"
+#line 188 "cexp.y"
typedef union {
struct constant {HOST_WIDE_INT value; int signedp;} integer;
struct name {U_CHAR *address; int length;} name;
#if YYDEBUG != 0
static const short yyrline[] = { 0,
- 225, 235, 236, 243, 248, 251, 253, 256, 260, 262,
- 267, 272, 285, 302, 315, 321, 327, 333, 339, 342,
- 345, 352, 359, 366, 373, 376, 379, 382, 385, 388,
- 391, 394, 396, 399, 402, 404, 406, 414, 416, 429
+ 218, 228, 229, 236, 241, 244, 246, 249, 253, 255,
+ 260, 265, 278, 295, 308, 314, 320, 326, 332, 335,
+ 338, 345, 352, 359, 366, 369, 372, 375, 378, 381,
+ 384, 387, 389, 392, 395, 397, 399, 407, 409, 422
};
#endif
switch (yyn) {
case 1:
-#line 226 "cexp.y"
+#line 219 "cexp.y"
{
expression_value = yyvsp[0].integer.value;
#ifdef TEST_EXP_READER
;
break;}
case 3:
-#line 237 "cexp.y"
+#line 230 "cexp.y"
{ if (pedantic)
pedwarn ("comma operator in operand of `#if'");
yyval.integer = yyvsp[0].integer; ;
break;}
case 4:
-#line 244 "cexp.y"
+#line 237 "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 249 "cexp.y"
+#line 242 "cexp.y"
{ yyval.integer.value = ! yyvsp[0].integer.value;
yyval.integer.signedp = SIGNED; ;
break;}
case 6:
-#line 252 "cexp.y"
+#line 245 "cexp.y"
{ yyval.integer = yyvsp[0].integer; ;
break;}
case 7:
-#line 254 "cexp.y"
+#line 247 "cexp.y"
{ yyval.integer.value = ~ yyvsp[0].integer.value;
yyval.integer.signedp = yyvsp[0].integer.signedp; ;
break;}
case 8:
-#line 257 "cexp.y"
+#line 250 "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 261 "cexp.y"
+#line 254 "cexp.y"
{ keyword_parsing = 1; ;
break;}
case 10:
-#line 263 "cexp.y"
+#line 256 "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 268 "cexp.y"
+#line 261 "cexp.y"
{ yyval.integer = yyvsp[-1].integer; ;
break;}
case 12:
-#line 273 "cexp.y"
+#line 266 "cexp.y"
{ yyval.integer.signedp = yyvsp[-2].integer.signedp & yyvsp[0].integer.signedp;
if (yyval.integer.signedp)
{
* yyvsp[0].integer.value); ;
break;}
case 13:
-#line 286 "cexp.y"
+#line 279 "cexp.y"
{ if (yyvsp[0].integer.value == 0)
{
if (!skip_evaluation)
/ yyvsp[0].integer.value); ;
break;}
case 14:
-#line 303 "cexp.y"
+#line 296 "cexp.y"
{ if (yyvsp[0].integer.value == 0)
{
if (!skip_evaluation)
% yyvsp[0].integer.value); ;
break;}
case 15:
-#line 316 "cexp.y"
+#line 309 "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,
integer_overflow (); ;
break;}
case 16:
-#line 322 "cexp.y"
+#line 315 "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,
integer_overflow (); ;
break;}
case 17:
-#line 328 "cexp.y"
+#line 321 "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);
yyval.integer.value = left_shift (&yyvsp[-2].integer, yyvsp[0].integer.value); ;
break;}
case 18:
-#line 334 "cexp.y"
+#line 327 "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);
yyval.integer.value = right_shift (&yyvsp[-2].integer, yyvsp[0].integer.value); ;
break;}
case 19:
-#line 340 "cexp.y"
+#line 333 "cexp.y"
{ yyval.integer.value = (yyvsp[-2].integer.value == yyvsp[0].integer.value);
yyval.integer.signedp = SIGNED; ;
break;}
case 20:
-#line 343 "cexp.y"
+#line 336 "cexp.y"
{ yyval.integer.value = (yyvsp[-2].integer.value != yyvsp[0].integer.value);
yyval.integer.signedp = SIGNED; ;
break;}
case 21:
-#line 346 "cexp.y"
+#line 339 "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;
<= yyvsp[0].integer.value); ;
break;}
case 22:
-#line 353 "cexp.y"
+#line 346 "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;
>= yyvsp[0].integer.value); ;
break;}
case 23:
-#line 360 "cexp.y"
+#line 353 "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;
< yyvsp[0].integer.value); ;
break;}
case 24:
-#line 367 "cexp.y"
+#line 360 "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;
> yyvsp[0].integer.value); ;
break;}
case 25:
-#line 374 "cexp.y"
+#line 367 "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 377 "cexp.y"
+#line 370 "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 380 "cexp.y"
+#line 373 "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 383 "cexp.y"
+#line 376 "cexp.y"
{ skip_evaluation += !yyvsp[-1].integer.value; ;
break;}
case 29:
-#line 385 "cexp.y"
+#line 378 "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 389 "cexp.y"
+#line 382 "cexp.y"
{ skip_evaluation += !!yyvsp[-1].integer.value; ;
break;}
case 31:
-#line 391 "cexp.y"
+#line 384 "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 395 "cexp.y"
+#line 388 "cexp.y"
{ skip_evaluation += !yyvsp[-1].integer.value; ;
break;}
case 33:
-#line 397 "cexp.y"
+#line 390 "cexp.y"
{ skip_evaluation += !!yyvsp[-4].integer.value - !yyvsp[-4].integer.value; ;
break;}
case 34:
-#line 399 "cexp.y"
+#line 392 "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 403 "cexp.y"
+#line 396 "cexp.y"
{ yyval.integer = yylval.integer; ;
break;}
case 36:
-#line 405 "cexp.y"
+#line 398 "cexp.y"
{ yyval.integer = yylval.integer; ;
break;}
case 37:
-#line 407 "cexp.y"
+#line 400 "cexp.y"
{ if (warn_undef && !skip_evaluation)
warning ("`%.*s' is not defined",
yyvsp[0].name.length, yyvsp[0].name.address);
yyval.integer.signedp = SIGNED; ;
break;}
case 38:
-#line 415 "cexp.y"
+#line 408 "cexp.y"
{ yyval.keywords = 0; ;
break;}
case 39:
-#line 417 "cexp.y"
+#line 410 "cexp.y"
{ struct arglist *temp;
yyval.keywords = (struct arglist *) xmalloc (sizeof (struct arglist));
yyval.keywords->next = yyvsp[-2].keywords;
temp->next->length = 1; ;
break;}
case 40:
-#line 430 "cexp.y"
+#line 423 "cexp.y"
{ yyval.keywords = (struct arglist *) xmalloc (sizeof (struct arglist));
yyval.keywords->name = yyvsp[-1].name.address;
yyval.keywords->length = yyvsp[-1].name.length;
yystate = yyn;
goto yynewstate;
}
-#line 435 "cexp.y"
+#line 428 "cexp.y"
\f
/* During parsing of a C expression, the pointer to the next character
return (DEFAULT_SIGNED_CHAR) ? 0 : ((struct hashnode *) -1);
}
-GENERIC_PTR
+PTR
xmalloc (size)
- size_t size;
+ size_t size;
{
- return (GENERIC_PTR) malloc (size);
+ return (PTR) malloc (size);
}
#endif
struct constant;
-GENERIC_PTR xmalloc PROTO((size_t));
HOST_WIDE_INT parse_escape PROTO((char **, HOST_WIDE_INT));
int check_assertion PROTO((U_CHAR *, int, int, struct arglist *));
struct hashnode *lookup PROTO((U_CHAR *, int, int));
return (DEFAULT_SIGNED_CHAR) ? 0 : ((struct hashnode *) -1);
}
-GENERIC_PTR
+PTR
xmalloc (size)
- size_t size;
+ size_t size;
{
- return (GENERIC_PTR) malloc (size);
+ return (PTR) malloc (size);
}
#endif
static int use_import_list PROTO((char *));
static int ignore_library PROTO((char *));
#endif
-
-char *xcalloc ();
-char *xmalloc ();
-
\f
#ifdef NO_DUP2
int
}
\f
-char *
+PTR
xcalloc (size1, size2)
- int size1, size2;
+ size_t size1, size2;
{
- char *ptr = (char *) calloc (size1, size2);
- if (ptr)
- return ptr;
-
- fatal ("out of memory");
- return (char *) 0;
+ PTR ptr = (PTR) calloc (size1, size2);
+ if (!ptr)
+ fatal ("out of memory");
+ return ptr;
}
-char *
+PTR
xmalloc (size)
- unsigned size;
+ size_t size;
{
- char *ptr = (char *) malloc (size);
- if (ptr)
- return ptr;
-
- fatal ("out of memory");
- return (char *) 0;
+ PTR ptr = (PTR) malloc (size);
+ if (!ptr)
+ fatal ("out of memory");
+ return ptr;
}
-char *
+PTR
xrealloc (ptr, size)
- char *ptr;
- unsigned size;
+ PTR ptr;
+ size_t size;
{
- register char *value = (char *) realloc (ptr, size);
+ register PTR value = (PTR) realloc (ptr, size);
if (value == 0)
fatal ("virtual memory exhausted");
return value;
extern int datalbl_ndx, jmplbl_ndx, label_pending, program_counter;
extern enum section current_section;
extern char *sectname[4];
-extern char *xstrdup(), *float_label();
+extern char *float_label();
extern struct rtx_def *function_arg ();
extern char *movcnt_regno_adjust ();
extern char *mod_regno_adjust ();
exit (FATAL_EXIT_CODE);
}
-char *
+PTR
xmalloc (size)
- unsigned size;
+ size_t size;
{
- register char *ptr = (char *) malloc (size);
+ register PTR ptr = (PTR) malloc (size);
if (ptr == 0)
memory_full ();
return ptr;
}
-char *
+PTR
xrealloc (old, size)
- char *old;
- unsigned size;
+ PTR old;
+ size_t size;
{
- register char *ptr = (char *) realloc (old, size);
+ register PTR ptr = (PTR) realloc (old, size);
if (ptr == 0)
memory_full ();
return ptr;
#include "system.h"
#include "cpplib.h"
-extern char *xmalloc PARAMS ((unsigned));
-extern char *xrealloc PARAMS ((void *, unsigned));
-
#ifdef MULTIBYTE_CHARS
#include <locale.h>
#endif
static void hack_vms_include_specification PROTO ((char *));
#endif
-/* Not safe to prototype these. */
-extern char *xmalloc();
-extern char *xrealloc();
-
/* Windows does not natively support inodes, and neither does MSDOS.
VMS has non-numeric inodes. */
#ifdef VMS
#include "cpplib.h"
#include "cpphash.h"
-extern char *xmalloc PARAMS ((unsigned));
-
static HASHNODE *hashtab[HASHSIZE];
/* Return hash function on name. must be compatible with the one
/* Forward declarations. */
-char *xmalloc ();
extern void cpp_hash_cleanup PARAMS ((cpp_reader *));
static char *my_strerror PROTO ((int));
static void push_macro_expansion PARAMS ((cpp_reader *,
U_CHAR *, int, HASHNODE *));
static struct cpp_pending *nreverse_pending PARAMS ((struct cpp_pending *));
-extern char *xrealloc ();
-static char *xcalloc PROTO ((unsigned, unsigned));
static void conditional_skip PROTO ((cpp_reader *, int,
enum node_type, U_CHAR *));
be moved into cppalloc.c. We can't do that right now because
then we'd get multiple-symbol clashes with toplev.c and several
other people. */
-static char *
+PTR
xcalloc (number, size)
- unsigned number, size;
+ size_t number, size;
{
register unsigned total = number * size;
- register char *ptr = (char *) xmalloc (total);
+ register PTR ptr = (PTR) xmalloc (total);
bzero (ptr, total);
return ptr;
}
#include "system.h"
#include "dyn-string.h"
-extern char *xmalloc ();
-extern char *xrealloc ();
-
/* Create a new dynamic string capable of holding at least SPACE
characters, including the terminating NUL. If SPACE is 0, it
will be silently increased to 1. */
char *
xstrdup (str)
- char *str;
+ const char *str;
{
char *copy = (char *) xmalloc (strlen (str) + 1);
strcpy (copy, str);
#include "obstack.h"
-
/* ??? Need to find a GCC header to put these in. */
-extern int pexecute PROTO ((const char *, char * const *, const char *,
- const char *, char **, char **, int));
-extern int pwait PROTO ((int, int *, int));
extern char *update_path PROTO((char *, char *));
extern void set_std_prefix PROTO((char *, int));
-/* Flag arguments to pexecute. */
-#define PEXECUTE_FIRST 1
-#define PEXECUTE_LAST 2
-#define PEXECUTE_SEARCH 4
-#define PEXECUTE_VERBOSE 8
#ifdef VMS
#define exit __posix_exit
static int check_live_switch PROTO((int, int));
static char *handle_braces PROTO((char *));
static char *save_string PROTO((char *, int));
-static char *concat PVPROTO((char *, ...));
extern int do_spec PROTO((char *));
static int do_spec_1 PROTO((char *, int, char *));
static char *find_file PROTO((char *));
static void display_help PROTO((void));
void fancy_abort PROTO((void)) ATTRIBUTE_NORETURN;
-char *xmalloc ();
-char *xrealloc ();
#ifdef LANG_SPECIFIC_DRIVER
/* Called before processing to change/add/remove arguments. */
int filename_length; /* strlen (filename). */
struct temp_name *next;
} *temp_names;
-#else
-extern char *choose_temp_base PROTO((void));
#endif
return 0;
}
\f
-char *
+PTR
xmalloc (size)
- unsigned size;
+ size_t size;
{
- register char *value = (char *) malloc (size);
+ register PTR value = (PTR) malloc (size);
if (value == 0)
fatal ("virtual memory exhausted");
return value;
}
-char *
+PTR
xrealloc (ptr, size)
- char *ptr;
- unsigned size;
+ PTR ptr;
+ size_t size;
{
- register char *value = (char *) realloc (ptr, size);
+ register PTR value = (PTR) realloc (ptr, size);
if (value == 0)
fatal ("virtual memory exhausted");
return value;
}
-/* This function is based on the one in libiberty. */
-
-static char *
-concat VPROTO((char *first, ...))
-{
- register int length;
- register char *newstr;
- register char *end;
- register char *arg;
- va_list args;
-#ifndef ANSI_PROTOTYPES
- char *first;
-#endif
-
- /* First compute the size of the result and get sufficient memory. */
-
- VA_START (args, first);
-#ifndef ANSI_PROTOTYPES
- first = va_arg (args, char *);
-#endif
-
- arg = first;
- length = 0;
-
- while (arg != 0)
- {
- length += strlen (arg);
- arg = va_arg (args, char *);
- }
-
- newstr = (char *) xmalloc (length + 1);
- va_end (args);
-
- /* Now copy the individual pieces to the result string. */
-
- VA_START (args, first);
-#ifndef ANSI_PROTOTYPES
- first = va_arg (args, char *);
-#endif
-
- end = newstr;
- arg = first;
- while (arg != 0)
- {
- while (*arg)
- *end++ = *arg++;
- arg = va_arg (args, char *);
- }
- *end = '\000';
- va_end (args);
-
- return (newstr);
-}
-
static char *
save_string (s, len)
char *s;
static void scan_for_source_files PROTO ((void));
static void output_data PROTO ((void));
static void print_usage PROTO ((void)) ATTRIBUTE_NORETURN;
-char * xmalloc ();
int
main (argc, argv)
return 0;
}
-char *
+PTR
xmalloc (size)
- unsigned size;
+ size_t size;
{
- register char *value = (char *) malloc (size);
+ register PTR value = (PTR) malloc (size);
if (value == 0)
{
fprintf (stderr, "error: virtual memory exhausted");
#define obstack_chunk_alloc xmalloc
#define obstack_chunk_free free
-char *xmalloc PROTO((unsigned));
static void fatal PVPROTO ((char *, ...))
ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
void fancy_abort PROTO((void)) ATTRIBUTE_NORETURN;
printf ("#define INSN_QUEUE_SIZE %d\n", q_size);
}
-char *
+PTR
xmalloc (size)
- unsigned size;
+ size_t size;
{
- register char *val = (char *) malloc (size);
+ register PTR val = (PTR) malloc (size);
if (val == 0)
fatal ("virtual memory exhausted");
return val;
}
-char *
+PTR
xrealloc (ptr, size)
- char *ptr;
- unsigned size;
+ PTR ptr;
+ size_t size;
{
- char * result = (char *) realloc (ptr, size);
+ register PTR result = (PTR) realloc (ptr, size);
if (!result)
fatal ("virtual memory exhausted");
return result;
static rtx find_single_value PROTO((struct attr_desc *));
static rtx make_numeric_value PROTO((int));
static void extend_range PROTO((struct range *, int, int));
-char *xrealloc PROTO((char *, unsigned));
-char *xmalloc PROTO((unsigned));
#define oballoc(size) obstack_alloc (hash_obstack, size)
if (range->max < max) range->max = max;
}
-char *
+PTR
xrealloc (ptr, size)
- char *ptr;
- unsigned size;
+ PTR ptr;
+ size_t size;
{
- char *result = (char *) realloc (ptr, size);
+ register PTR result = (PTR) realloc (ptr, size);
if (!result)
fatal ("virtual memory exhausted");
return result;
}
-char *
+PTR
xmalloc (size)
- unsigned size;
+ size_t size;
{
- register char *val = (char *) malloc (size);
+ register PTR val = (PTR) malloc (size);
if (val == 0)
fatal ("virtual memory exhausted");
/* FIXME: We only need an xmalloc definition because we are forced to
link with alloca.o on some platforms. This should go away if/when
we link against libiberty.a. (ghazi@caip.rutgers.edu 6/3/98) */
-char *
+PTR
xmalloc (nbytes)
- int nbytes;
+ size_t nbytes;
{
- char *tmp = (char *) malloc (nbytes);
+ register PTR tmp = (PTR) malloc (nbytes);
if (!tmp)
{
#define obstack_chunk_alloc xmalloc
#define obstack_chunk_free free
-char *xmalloc PROTO((unsigned));
static void fatal PVPROTO ((char *, ...))
ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
void fancy_abort PROTO((void)) ATTRIBUTE_NORETURN;
insn_code_number);
}
-char *
+PTR
xmalloc (size)
- unsigned size;
+ size_t size;
{
- register char *val = (char *) malloc (size);
+ register PTR val = (PTR) malloc (size);
if (val == 0)
fatal ("virtual memory exhausted");
return val;
}
-char *
+PTR
xrealloc (ptr, size)
- char *ptr;
- unsigned size;
+ PTR ptr;
+ size_t size;
{
- char *result = (char *) realloc (ptr, size);
+ register PTR result = (PTR) realloc (ptr, size);
if (!result)
fatal ("virtual memory exhausted");
return result;
static int clobbers_seen_this_insn;
static int dup_operands_seen_this_insn;
-char *xmalloc PROTO((unsigned));
static void fatal PVPROTO ((char *, ...))
ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
void fancy_abort PROTO((void)) ATTRIBUTE_NORETURN;
walk_insn_part (XVECEXP (peep, 0, i), 1, 0);
}
\f
-char *
+PTR
xmalloc (size)
- unsigned size;
+ size_t size;
{
- register char *val = (char *) malloc (size);
+ register PTR val = (PTR) malloc (size);
if (val == 0)
fatal ("virtual memory exhausted");
return val;
}
-char *
+PTR
xrealloc (ptr, size)
- char *ptr;
- unsigned size;
+ PTR ptr;
+ size_t size;
{
- char *result = (char *) realloc (ptr, size);
+ register PTR result = (PTR) realloc (ptr, size);
if (!result)
fatal ("virtual memory exhausted");
return result;
#define obstack_chunk_alloc xmalloc
#define obstack_chunk_free free
-char *xmalloc PROTO((unsigned));
static void fatal PVPROTO ((char *, ...))
ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
void fancy_abort PROTO((void)) ATTRIBUTE_NORETURN;
#endif
}
\f
-char *
+PTR
xmalloc (size)
- unsigned size;
+ size_t size;
{
- register char *val = (char *) malloc (size);
+ register PTR val = (PTR) malloc (size);
if (val == 0)
fatal ("virtual memory exhausted");
return val;
}
-char *
+PTR
xrealloc (ptr, size)
- char *ptr;
- unsigned size;
+ PTR ptr;
+ size_t size;
{
- char *result = (char *) realloc (ptr, size);
+ register PTR result = (PTR) realloc (ptr, size);
if (!result)
fatal ("virtual memory exhausted");
return result;
static void gen_insn PROTO ((rtx));
static void walk_rtx PROTO ((rtx, char *));
static void print_path PROTO ((char *));
-char *xmalloc PROTO ((unsigned));
-char *xrealloc PROTO ((char *, unsigned));
static void fatal PVPROTO ((char *, ...))
ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
static char *copystr PROTO ((char *));
}
}
\f
-char *
+PTR
xmalloc (size)
- unsigned size;
+ size_t size;
{
- register char *val = (char *) malloc (size);
+ register PTR val = (PTR) malloc (size);
if (val == 0)
fatal ("virtual memory exhausted");
return val;
}
-char *
+PTR
xrealloc (ptr, size)
- char *ptr;
- unsigned size;
+ PTR ptr;
+ size_t size;
{
- char *result = (char *) realloc (ptr, size);
+ register PTR result = (PTR) realloc (ptr, size);
if (!result)
fatal ("virtual memory exhausted");
return result;
#define obstack_chunk_alloc xmalloc
#define obstack_chunk_free free
-char *xmalloc PROTO((unsigned));
static void fatal PVPROTO ((char *, ...))
ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
void fancy_abort PROTO((void)) ATTRIBUTE_NORETURN;
obstack_grow (obstack_ptr, &insn, sizeof (rtx));
}
\f
-char *
+PTR
xmalloc (size)
- unsigned size;
+ size_t size;
{
- register char *val = (char *) malloc (size);
+ register PTR val = (PTR) malloc (size);
if (val == 0)
fatal ("virtual memory exhausted");
return val;
}
-char *
+PTR
xrealloc (ptr, size)
- char *ptr;
- unsigned size;
+ PTR ptr;
+ size_t size;
{
- char *result = (char *) realloc (ptr, size);
+ register PTR result = (PTR) realloc (ptr, size);
if (!result)
fatal ("virtual memory exhausted");
return result;
}
#if defined(USE_C_ALLOCA)
-char *
+PTR
xmalloc (nbytes)
- int nbytes;
+ size_t nbytes;
{
- char *tmp = (char *) malloc (nbytes);
+ register PTR tmp = (PTR) malloc (nbytes);
if (!tmp)
{
#define obstack_chunk_alloc xmalloc
#define obstack_chunk_free free
-char *xmalloc PROTO((unsigned));
static void fatal PVPROTO ((char *, ...))
ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
void fancy_abort PROTO((void)) ATTRIBUTE_NORETURN;
printf (";\n");
}
\f
-char *
+PTR
xmalloc (size)
- unsigned size;
+ size_t size;
{
- register char *val = (char *) malloc (size);
+ register PTR val = (PTR) malloc (size);
if (val == 0)
fatal ("virtual memory exhausted");
return val;
}
-char *
+PTR
xrealloc (ptr, size)
- char *ptr;
- unsigned size;
+ PTR ptr;
+ size_t size;
{
- char *result = (char *) realloc (ptr, size);
+ register PTR result = (PTR) realloc (ptr, size);
if (!result)
fatal ("virtual memory exhausted");
return result;
#define obstack_chunk_alloc xmalloc
#define obstack_chunk_free free
-char *xmalloc PROTO((unsigned));
static void fatal PVPROTO ((char *, ...))
ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
void fancy_abort PROTO((void)) ATTRIBUTE_NORETURN;
d->outfun = 0;
}
\f
-char *
+PTR
xmalloc (size)
- unsigned size;
+ size_t size;
{
- register char *val = (char *) malloc (size);
+ register PTR val = (PTR) malloc (size);
if (val == 0)
fatal ("virtual memory exhausted");
return val;
}
-char *
+PTR
xrealloc (ptr, size)
- char *ptr;
- unsigned size;
+ PTR ptr;
+ size_t size;
{
- char *result = (char *) realloc (ptr, size);
+ register PTR result = (PTR) realloc (ptr, size);
if (!result)
fatal ("virtual memory exhausted");
return result;
int vecelt;
};
-char *xmalloc PROTO((unsigned));
static void fatal PVPROTO ((char *, ...))
ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
void fancy_abort PROTO((void)) ATTRIBUTE_NORETURN;
}
}
\f
-char *
+PTR
xmalloc (size)
- unsigned size;
+ size_t size;
{
- register char *val = (char *) malloc (size);
+ register PTR val = (PTR) malloc (size);
if (val == 0)
fatal ("virtual memory exhausted");
return val;
}
-char *
+PTR
xrealloc (ptr, size)
- char *ptr;
- unsigned size;
+ PTR ptr;
+ size_t size;
{
- char *result = (char *) realloc (ptr, size);
+ register PTR result = (PTR) realloc (ptr, size);
if (!result)
fatal ("virtual memory exhausted");
return result;
static void mybcopy PROTO((char *, char *, unsigned));
static void fatal PVPROTO((char *, ...))
ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
-char *xrealloc PROTO((char *, unsigned));
-char *xmalloc PROTO((unsigned));
void fancy_abort PROTO((void)) ATTRIBUTE_NORETURN;
\f
/* Construct and return a sequence of decisions
*out++ = *in++;
}
-char *
+PTR
xrealloc (ptr, size)
- char *ptr;
- unsigned size;
+ PTR ptr;
+ size_t size;
{
- char *result = (char *) realloc (ptr, size);
+ register PTR result = (PTR) realloc (ptr, size);
if (!result)
fatal ("virtual memory exhausted");
return result;
}
-char *
+PTR
xmalloc (size)
- unsigned size;
+ size_t size;
{
- register char *val = (char *) malloc (size);
+ register PTR val = (PTR) malloc (size);
if (val == 0)
fatal ("virtual memory exhausted");
#define GUESSPATHLEN 100
#endif /* (defined (USG) || defined (VMS)) */
-char *xmalloc ();
-
#if !(defined (VMS) || (defined(_WIN32) && !defined(__CYGWIN__)))
/* Get the working directory. Use the PWD environment variable if it's
#define obstack_chunk_alloc xmalloc
#define obstack_chunk_free free
-extern char *xmalloc ();
extern rtx eliminate_constant_term ();
extern void assemble_name ();
extern void output_addr_const ();
#define obstack_chunk_alloc xmalloc
#define obstack_chunk_free free
-extern char * xmalloc ();
-
/* The default number of entries to use when creating a hash table. */
#define DEFAULT_SIZE (1009)
#define MIPS_UNMARK_STAB(code) ((code)-CODE_MASK)
#endif
-#ifdef __STDC__
-typedef void *PTR_T;
-typedef const void *CPTR_T;
-#define __proto(x) x
-#else
-
-#if defined(_STDIO_H_) || defined(__STDIO_H__) /* Ultrix 4.0, SGI */
-typedef void *PTR_T;
-typedef void *CPTR_T;
-
-#else
-typedef char *PTR_T; /* Ultrix 3.1 */
-typedef char *CPTR_T;
-#endif
-
-#define __proto(x) ()
-#define const
-#endif
+#define __proto(x) PARAMS(x)
+typedef PTR PTR_T;
+typedef const PTR_T CPTR_T;
#define uchar unsigned char
#define ushort unsigned short
#define ulong unsigned long
+static void
+fatal(s)
+ const char *s;
+{
+ fprintf(stderr, "%s\n", s);
+ exit(FATAL_EXIT_CODE);
+}
+
+/* Same as `malloc' but report error if no memory available. */
+/* Do this before size_t is fiddled with so it matches the prototype
+ in libiberty.h . */
+PTR
+xmalloc (size)
+ size_t size;
+{
+ register PTR value = (PTR) malloc (size);
+ if (value == 0)
+ fatal ("Virtual memory exhausted.");
+ return value;
+}
+
/* Do to size_t being defined in sys/types.h and different
in stddef.h, we have to do this by hand..... Note, these
types are correct for MIPS based systems, and may not be
char *type_to_string __proto((AUXU *, int, FDR *));
#ifndef __alpha
+# ifdef NEED_DECLARATION_MALLOC
extern PTR_T malloc __proto((size_t));
+# endif
+# ifdef NEED_DECLARATION_CALLOC
extern PTR_T calloc __proto((size_t, size_t));
+# endif
+# ifdef NEED_DECLARATION_REALLOC
extern PTR_T realloc __proto((PTR_T, size_t));
-extern void free __proto((PTR_T));
+# endif
#endif
extern char *optarg;
fprintf (stderr, "mips-tdump internal error");
exit (1);
}
-
-void
-fatal(s)
-char *s;
-{
- fprintf(stderr, "%s\n", s);
- exit(1);
-}
-
-/* Same as `malloc' but report error if no memory available. */
-
-PTR_T
-xmalloc (size)
- unsigned size;
-{
- register PTR_T value = malloc (size);
- if (value == 0)
- fatal ("Virtual memory exhausted.");
- return value;
-}
#endif
#define __proto(x) PARAMS(x)
-/* Should PTR_T and CPTR_T be typedef'ed in terms of PTR ??? */
-#ifdef __STDC__
-typedef void *PTR_T;
-typedef const void *CPTR_T;
-#else
-
-#if defined(_STDIO_H_) || defined(__STDIO_H__) /* Ultrix 4.0, SGI */
-typedef void *PTR_T;
-typedef void *CPTR_T;
-
-#else
-typedef char *PTR_T; /* Ultrix 3.1 */
-typedef char *CPTR_T;
-#endif
+typedef PTR PTR_T;
+typedef const PTR_T CPTR_T;
-#endif
-
-/* Do to size_t being defined in sys/types.h and different
+/* Due to size_t being defined in sys/types.h and different
in stddef.h, we have to do this by hand..... Note, these
types are correct for MIPS based systems, and may not be
correct for other systems. Ultrix 4.0 and Silicon Graphics
__proto((char *));
extern void fancy_abort __proto((void));
void botch __proto((const char *));
-extern PTR_T xmalloc __proto((Size_t));
-extern PTR_T xcalloc __proto((Size_t, Size_t));
-extern PTR_T xrealloc __proto((PTR_T, Size_t));
-extern void xfree __proto((PTR_T));
+extern void xfree __proto((PTR));
extern void fatal PVPROTO((const char *format, ...));
extern void error PVPROTO((const char *format, ...));
fatal VPROTO((const char *format, ...))
{
#ifndef ANSI_PROTOTYPES
- char *format;
+ const char *format;
#endif
va_list ap;
VA_START (ap, format);
#ifndef ANSI_PROTOTYPES
- format = va_arg (ap, char *);
+ format = va_arg (ap, const char *);
#endif
if (line_number > 0)
/* Same as `malloc' but report error if no memory available. */
-PTR_T
+PTR
xmalloc (size)
- Size_t size;
+ size_t size;
{
- register PTR_T value = malloc (size);
+ register PTR value = (PTR) malloc (size);
if (value == 0)
fatal ("Virtual memory exhausted.");
/* Same as `calloc' but report error if no memory available. */
-PTR_T
+PTR
xcalloc (size1, size2)
- Size_t size1, size2;
+ size_t size1, size2;
{
- register PTR_T value = calloc (size1, size2);
+ register PTR value = (PTR) calloc (size1, size2);
if (value == 0)
fatal ("Virtual memory exhausted.");
/* Same as `realloc' but report error if no memory available. */
-PTR_T
+PTR
xrealloc (ptr, size)
- PTR_T ptr;
- Size_t size;
+ PTR ptr;
+ size_t size;
{
- register PTR_T result = realloc (ptr, size);
+ register PTR result = (PTR) realloc (ptr, size);
if (!result)
fatal ("Virtual memory exhausted.");
void
xfree (ptr)
- PTR_T ptr;
+ PTR ptr;
{
if (debug > 3)
{
static char *get_key_value PROTO((char *));
static char *translate_name PROTO((char *));
-static char *concat PVPROTO((char *, ...));
static char *save_string PROTO((char *, int));
#ifdef _WIN32
This function is based on the one in libiberty. */
-static char *
-concat VPROTO((char *first, ...))
+char *
+concat VPROTO((const char *first, ...))
{
register int length;
register char *newstr;
register char *end;
- register char *arg;
+ register const char *arg;
va_list args;
#ifndef ANSI_PROTOTYPES
- char *first;
+ const char *first;
#endif
/* First compute the size of the result and get sufficient memory. */
VA_START (args, first);
#ifndef ANSI_PROTOTYPES
- first = va_arg (args, char *);
+ first = va_arg (args, const char *);
#endif
arg = first;
while (arg != 0)
{
length += strlen (arg);
- arg = va_arg (args, char *);
+ arg = va_arg (args, const char *);
}
newstr = (char *) malloc (length + 1);
{
while (*arg)
*end++ = *arg++;
- arg = va_arg (args, char *);
+ arg = va_arg (args, const char *);
}
*end = '\000';
va_end (args);
static FILE *outfile;
-static char spaces[] = " ";
+static const char xspaces[] = " ";
static int sawclose = 0;
if (sawclose)
{
fprintf (outfile, "\n%s",
- (spaces + (sizeof spaces - 1 - indent * 2)));
+ (xspaces + (sizeof xspaces - 1 - indent * 2)));
sawclose = 0;
}
if (sawclose)
{
fprintf (outfile, "\n%s",
- (spaces + (sizeof spaces - 1 - indent * 2)));
+ (xspaces + (sizeof xspaces - 1 - indent * 2)));
sawclose = 0;
}
fputs ("[ ", outfile);
}
if (sawclose)
fprintf (outfile, "\n%s",
- (spaces + (sizeof spaces - 1 - indent * 2)));
+ (xspaces + (sizeof xspaces - 1 - indent * 2)));
fputs ("] ", outfile);
sawclose = 1;
#include "gcov-io.h"
#include "toplev.h"
-extern char * xmalloc ();
-
/* One of these is dynamically created whenever we identify an arc in the
function. */
extern char *getpwd ();
-extern char *choose_temp_base PROTO ((void));
extern char * my_strerror PROTO ((int));
-extern int pexecute PROTO ((const char *, char * const *, const char *,
- const char *, char **, char **, int));
-extern int pwait PROTO ((int, int *, int));
-/* Flag arguments to pexecute. */
-#define PEXECUTE_FIRST 1
-#define PEXECUTE_LAST 2
-#define PEXECUTE_SEARCH 4
-
static void usage PROTO ((void)) ATTRIBUTE_NORETURN;
static void aux_info_corrupted PROTO ((void)) ATTRIBUTE_NORETURN;
static void declare_source_confusing PROTO ((const char *)) ATTRIBUTE_NORETURN;
These were made to facilitate compilation with old brain-dead DEC C
compilers which didn't properly grok `void*' types. */
-#ifdef __STDC__
-typedef void * pointer_type;
-typedef const void * const_pointer_type;
-#else
-typedef char * pointer_type;
-typedef char * const_pointer_type;
-#endif
+typedef PTR pointer_type;
+typedef const PTR const_pointer_type;
#if defined(POSIX)
pointer_type
xmalloc (byte_count)
- size_t byte_count;
+ size_t byte_count;
{
- pointer_type rv;
-
- rv = (pointer_type) malloc (byte_count);
+ register pointer_type rv = (pointer_type) malloc (byte_count);
if (rv == NULL)
{
fprintf (stderr, "\n%s: virtual memory exceeded\n", pname);
exit (FATAL_EXIT_CODE);
- return 0; /* avoid warnings */
}
- else
- return rv;
+ return rv;
}
/* Reallocate some space, but check that the reallocation was successful. */
pointer_type old_space;
size_t byte_count;
{
- pointer_type rv;
-
- rv = (pointer_type) realloc (old_space, byte_count);
+ register pointer_type rv = (pointer_type) realloc (old_space, byte_count);
if (rv == NULL)
{
fprintf (stderr, "\n%s: virtual memory exceeded\n", pname);
exit (FATAL_EXIT_CODE);
- return 0; /* avoid warnings */
}
- else
- return rv;
+ return rv;
}
/* Deallocate the area pointed to by an arbitrary pointer, but first, strip
extern rtx read_rtx PROTO((FILE *));
#endif
-#if 0
-/* At present, don't prototype xrealloc, since all of the callers don't
- cast their pointers to char *, and all of the xrealloc's don't use
- void * yet. */
-extern char *xmalloc PROTO((size_t));
-extern char *xcalloc PROTO((size_t, size_t));
-extern char *xrealloc PROTO((void *, size_t));
-#else
-extern char *xmalloc ();
-extern char *xcalloc ();
-extern char *xrealloc ();
-#endif
-
extern char *oballoc PROTO((int));
extern char *permalloc PROTO((int));
extern rtx rtx_alloc PROTO((RTX_CODE));
extern int scan_ident _PARAMS((FILE *, sstring *, int));
extern int scan_string _PARAMS((FILE *, sstring *, int));
extern int read_upto _PARAMS((FILE *, sstring *, int));
-extern char *xmalloc _PARAMS((unsigned));
-extern char *xrealloc _PARAMS((char *, unsigned));
extern unsigned long hash _PARAMS((const char *));
extern void recognized_function _PARAMS((char *, int, int, char *, int, int, char *, int));
extern void recognized_extern _PARAMS((char *, int, char *, int));
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
#endif
+/* Get libiberty declarations. */
+#include "libiberty.h"
+
#endif /* __GCC_SYSTEM_H__ */
#define obstack_chunk_alloc xmalloc
#define obstack_chunk_free free
-extern char * xmalloc PARAMS((unsigned));
-
/* Defined in collect2.c. */
extern int vflag, debug;
extern char *ldout;
\f
/* Return time used so far, in microseconds. */
-int
+long
get_run_time ()
{
if (quiet_flag)
/* Same as `malloc' but report error if no memory available. */
-char *
+PTR
xmalloc (size)
- unsigned size;
+ size_t size;
{
- register char *value;
+ register PTR value;
if (size == 0)
size = 1;
- value = (char *) malloc (size);
+ value = (PTR) malloc (size);
if (value == 0)
fatal ("virtual memory exhausted");
return value;
/* Same as `calloc' but report error if no memory available. */
-char *
+PTR
xcalloc (size1, size2)
- unsigned size1, size2;
+ size_t size1, size2;
{
- register char *value;
+ register PTR value;
if (size1 == 0 || size2 == 0)
size1 = size2 = 1;
- value = (char *) calloc (size1, size2);
+ value = (PTR) calloc (size1, size2);
if (value == 0)
fatal ("virtual memory exhausted");
return value;
/* Same as `realloc' but report error if no memory available.
Also handle null PTR even if the vendor realloc gets it wrong. */
-char *
+PTR
xrealloc (ptr, size)
- char *ptr;
- int size;
+ PTR ptr;
+ size_t size;
{
- char *result;
+ register PTR result;
if (size == 0)
size = 1;
- result = (ptr
- ? (char *) realloc (ptr, size)
- : (char *) malloc (size));
+ result = (ptr ? (PTR) realloc (ptr, size) : (PTR) malloc (size));
if (!result)
fatal ("virtual memory exhausted");
char *
xstrdup (s)
- register char *s;
+ register const char *s;
{
register char *result = (char *) malloc (strlen (s) + 1);
extern int count_error PROTO ((int));
extern void strip_off_ending PROTO ((char *, int));
extern void print_time PROTO ((char *, int));
-extern int get_run_time PROTO ((void));
extern void debug_start_source_file PROTO ((char *));
extern void debug_end_source_file PROTO ((unsigned));
extern void debug_define PROTO ((unsigned, char *));
extern int exact_log2_wide PROTO((unsigned HOST_WIDE_INT));
extern int floor_log2_wide PROTO((unsigned HOST_WIDE_INT));
-#if 0
-/* At present, don't prototype xrealloc, since all of the callers don't
- cast their pointers to char *, and all of the xrealloc's don't use
- void * yet. */
-extern char *xmalloc PROTO((size_t));
-extern char *xcalloc PROTO((size_t, size_t));
-extern char *xrealloc PROTO((void *, size_t));
-#else
-extern char *xmalloc ();
-extern char *xcalloc ();
-extern char *xrealloc ();
-#endif
-
-extern char *xstrdup PROTO((char *));
-
extern char *oballoc PROTO((int));
extern char *permalloc PROTO((int));
extern char *savealloc PROTO((int));