system.h: Include libiberty.h.
* 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. From-SVN: r23931
This commit is contained in:
parent
3081a3ada6
commit
2778b98d90
45 changed files with 426 additions and 552 deletions
|
@ -1,3 +1,66 @@
|
|||
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.
|
||||
|
|
185
gcc/c-aux-info.c
185
gcc/c-aux-info.c
|
@ -37,8 +37,6 @@ typedef enum formals_style_enum formals_style;
|
|||
|
||||
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));
|
||||
|
@ -46,55 +44,60 @@ static char *gen_formal_list_for_func_def PROTO((tree, formals_style));
|
|||
static char *gen_type PROTO((char *, tree, formals_style));
|
||||
static char *gen_decl PROTO((tree, int, formals_style));
|
||||
|
||||
/* 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
|
||||
|
||||
if (!s1)
|
||||
s1 = "";
|
||||
if (!s2)
|
||||
s2 = "";
|
||||
/* First compute the size of the result and get sufficient memory. */
|
||||
|
||||
size1 = strlen (s1);
|
||||
size2 = strlen (s2);
|
||||
ret_val = xmalloc (size1 + size2 + 1);
|
||||
strcpy (ret_val, s1);
|
||||
strcpy (&ret_val[size1], s2);
|
||||
return ret_val;
|
||||
}
|
||||
VA_START (args, first);
|
||||
#ifndef ANSI_PROTOTYPES
|
||||
first = va_arg (args, const char *);
|
||||
#endif
|
||||
|
||||
/* Take three strings and mash them together into a newly allocated area. */
|
||||
arg = first;
|
||||
length = 0;
|
||||
|
||||
static char *
|
||||
concat3 (s1, s2, s3)
|
||||
char *s1;
|
||||
char *s2;
|
||||
char *s3;
|
||||
{
|
||||
int size1, size2, size3;
|
||||
char *ret_val;
|
||||
while (arg != 0)
|
||||
{
|
||||
length += strlen (arg);
|
||||
arg = va_arg (args, const char *);
|
||||
}
|
||||
|
||||
if (!s1)
|
||||
s1 = "";
|
||||
if (!s2)
|
||||
s2 = "";
|
||||
if (!s3)
|
||||
s3 = "";
|
||||
newstr = (char *) malloc (length + 1);
|
||||
va_end (args);
|
||||
|
||||
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;
|
||||
/* 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, const char *);
|
||||
}
|
||||
*end = '\000';
|
||||
va_end (args);
|
||||
|
||||
return (newstr);
|
||||
}
|
||||
|
||||
/* Given a string representing an entire type or an entire declaration
|
||||
|
@ -140,13 +143,13 @@ affix_data_type (type_or_decl)
|
|||
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
|
||||
|
@ -173,13 +176,13 @@ gen_formal_list_for_type (fntype, style)
|
|||
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);
|
||||
}
|
||||
|
@ -228,10 +231,10 @@ gen_formal_list_for_type (fntype, style)
|
|||
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
|
||||
|
@ -290,23 +293,23 @@ gen_formal_list_for_func_def (fndecl, style)
|
|||
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;
|
||||
}
|
||||
|
||||
|
@ -368,14 +371,14 @@ gen_type (ret_val, t, style)
|
|||
{
|
||||
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);
|
||||
|
||||
|
@ -383,21 +386,26 @@ gen_type (ret_val, 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:
|
||||
|
@ -424,13 +432,14 @@ gen_type (ret_val, t, style)
|
|||
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:
|
||||
|
@ -442,13 +451,14 @@ gen_type (ret_val, t, style)
|
|||
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:
|
||||
|
@ -461,14 +471,14 @@ gen_type (ret_val, t, style)
|
|||
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:
|
||||
|
@ -480,7 +490,7 @@ gen_type (ret_val, t, style)
|
|||
/* 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:
|
||||
|
@ -500,11 +510,11 @@ gen_type (ret_val, t, style)
|
|||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -546,9 +556,9 @@ gen_decl (decl, is_func_definition, style)
|
|||
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 = "";
|
||||
|
||||
|
@ -566,7 +576,8 @@ gen_decl (decl, is_func_definition, style)
|
|||
|
||||
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
|
||||
|
@ -583,11 +594,11 @@ gen_decl (decl, is_func_definition, style)
|
|||
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;
|
||||
}
|
||||
|
|
24
gcc/cccp.c
24
gcc/cccp.c
|
@ -1035,9 +1035,6 @@ static void pfatal_with_name PROTO((char *)) __attribute__ ((noreturn));
|
|||
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));
|
||||
|
||||
|
@ -10678,34 +10675,33 @@ memory_full ()
|
|||
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);
|
||||
|
|
97
gcc/cexp.c
97
gcc/cexp.c
|
@ -164,7 +164,6 @@ extern int c89;
|
|||
|
||||
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));
|
||||
|
@ -181,7 +180,7 @@ static void integer_overflow PROTO((void));
|
|||
#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;
|
||||
|
@ -262,10 +261,10 @@ static const short yyrhs[] = { 35,
|
|||
|
||||
#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
|
||||
|
||||
|
@ -869,7 +868,7 @@ yyreduce:
|
|||
switch (yyn) {
|
||||
|
||||
case 1:
|
||||
#line 226 "cexp.y"
|
||||
#line 219 "cexp.y"
|
||||
{
|
||||
expression_value = yyvsp[0].integer.value;
|
||||
#ifdef TEST_EXP_READER
|
||||
|
@ -878,55 +877,55 @@ case 1:
|
|||
;
|
||||
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)
|
||||
{
|
||||
|
@ -941,7 +940,7 @@ case 12:
|
|||
* yyvsp[0].integer.value); ;
|
||||
break;}
|
||||
case 13:
|
||||
#line 286 "cexp.y"
|
||||
#line 279 "cexp.y"
|
||||
{ if (yyvsp[0].integer.value == 0)
|
||||
{
|
||||
if (!skip_evaluation)
|
||||
|
@ -960,7 +959,7 @@ case 13:
|
|||
/ yyvsp[0].integer.value); ;
|
||||
break;}
|
||||
case 14:
|
||||
#line 303 "cexp.y"
|
||||
#line 296 "cexp.y"
|
||||
{ if (yyvsp[0].integer.value == 0)
|
||||
{
|
||||
if (!skip_evaluation)
|
||||
|
@ -975,7 +974,7 @@ case 14:
|
|||
% 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,
|
||||
|
@ -983,7 +982,7 @@ case 15:
|
|||
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,
|
||||
|
@ -991,7 +990,7 @@ case 16:
|
|||
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);
|
||||
|
@ -999,7 +998,7 @@ case 17:
|
|||
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);
|
||||
|
@ -1007,17 +1006,17 @@ case 18:
|
|||
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;
|
||||
|
@ -1026,7 +1025,7 @@ case 21:
|
|||
<= 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;
|
||||
|
@ -1035,7 +1034,7 @@ case 22:
|
|||
>= 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;
|
||||
|
@ -1044,7 +1043,7 @@ case 23:
|
|||
< 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;
|
||||
|
@ -1053,64 +1052,64 @@ case 24:
|
|||
> 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);
|
||||
|
@ -1118,11 +1117,11 @@ case 37:
|
|||
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;
|
||||
|
@ -1137,7 +1136,7 @@ case 39:
|
|||
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;
|
||||
|
@ -1341,7 +1340,7 @@ yyerrhandle:
|
|||
yystate = yyn;
|
||||
goto yynewstate;
|
||||
}
|
||||
#line 435 "cexp.y"
|
||||
#line 428 "cexp.y"
|
||||
|
||||
|
||||
/* During parsing of a C expression, the pointer to the next character
|
||||
|
@ -2156,10 +2155,10 @@ lookup (name, len, hash)
|
|||
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
|
||||
|
|
|
@ -168,7 +168,6 @@ extern int c89;
|
|||
|
||||
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));
|
||||
|
@ -1240,10 +1239,10 @@ lookup (name, len, hash)
|
|||
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
|
||||
|
|
|
@ -302,10 +302,6 @@ static char *resolve_lib_name PROTO((char *));
|
|||
static int use_import_list PROTO((char *));
|
||||
static int ignore_library PROTO((char *));
|
||||
#endif
|
||||
|
||||
char *xcalloc ();
|
||||
char *xmalloc ();
|
||||
|
||||
|
||||
#ifdef NO_DUP2
|
||||
int
|
||||
|
@ -514,36 +510,32 @@ handler (signo)
|
|||
}
|
||||
|
||||
|
||||
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;
|
||||
|
|
|
@ -66,7 +66,7 @@ extern struct jumplabel_array jmplbl[];
|
|||
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 ();
|
||||
|
|
|
@ -35,22 +35,22 @@ memory_full ()
|
|||
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;
|
||||
|
|
|
@ -28,9 +28,6 @@ Written by Per Bothner 1994. */
|
|||
#include "system.h"
|
||||
#include "cpplib.h"
|
||||
|
||||
extern char *xmalloc PARAMS ((unsigned));
|
||||
extern char *xrealloc PARAMS ((void *, unsigned));
|
||||
|
||||
#ifdef MULTIBYTE_CHARS
|
||||
#include <locale.h>
|
||||
#endif
|
||||
|
|
|
@ -47,10 +47,6 @@ static void simplify_pathname PROTO ((char *));
|
|||
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
|
||||
|
|
|
@ -27,8 +27,6 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#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
|
||||
|
|
|
@ -184,7 +184,6 @@ struct cpp_pending {
|
|||
|
||||
/* Forward declarations. */
|
||||
|
||||
char *xmalloc ();
|
||||
extern void cpp_hash_cleanup PARAMS ((cpp_reader *));
|
||||
|
||||
static char *my_strerror PROTO ((int));
|
||||
|
@ -213,8 +212,6 @@ static void free_token_list PROTO ((struct arglist *));
|
|||
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 *));
|
||||
|
@ -6436,12 +6433,12 @@ free_token_list (tokens)
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -22,9 +22,6 @@
|
|||
#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. */
|
||||
|
|
|
@ -873,7 +873,7 @@ write_rbrac ()
|
|||
|
||||
char *
|
||||
xstrdup (str)
|
||||
char *str;
|
||||
const char *str;
|
||||
{
|
||||
char *copy = (char *) xmalloc (strlen (str) + 1);
|
||||
strcpy (copy, str);
|
||||
|
|
82
gcc/gcc.c
82
gcc/gcc.c
|
@ -38,18 +38,9 @@ compilation is specified by a string called a "spec". */
|
|||
|
||||
#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
|
||||
|
@ -195,7 +186,6 @@ static void clear_failure_queue PROTO((void));
|
|||
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 *));
|
||||
|
@ -215,8 +205,6 @@ static void error PVPROTO((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. */
|
||||
|
@ -1292,8 +1280,6 @@ static struct temp_name {
|
|||
int filename_length; /* strlen (filename). */
|
||||
struct temp_name *next;
|
||||
} *temp_names;
|
||||
#else
|
||||
extern char *choose_temp_base PROTO((void));
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -5220,81 +5206,27 @@ lookup_compiler (name, length, language)
|
|||
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)
|
||||
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;
|
||||
|
|
|
@ -218,7 +218,6 @@ static void read_files PROTO ((void));
|
|||
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)
|
||||
|
@ -238,11 +237,11 @@ 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");
|
||||
|
|
|
@ -31,7 +31,6 @@ struct obstack *rtl_obstack = &obstack;
|
|||
#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;
|
||||
|
@ -199,23 +198,23 @@ write_units (num_units, multiplicity, simultaneity,
|
|||
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;
|
||||
|
|
|
@ -453,8 +453,6 @@ static struct attr_value *find_most_used PROTO((struct attr_desc *));
|
|||
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)
|
||||
|
||||
|
@ -5752,22 +5750,22 @@ extend_range (range, min, max)
|
|||
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");
|
||||
|
|
|
@ -66,11 +66,11 @@ int main (argc, argv)
|
|||
/* 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)
|
||||
{
|
||||
|
|
|
@ -33,7 +33,6 @@ struct obstack *rtl_obstack = &obstack;
|
|||
#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;
|
||||
|
@ -57,23 +56,23 @@ gen_insn (insn)
|
|||
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;
|
||||
|
|
|
@ -49,7 +49,6 @@ static int max_insns_per_split = 1;
|
|||
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;
|
||||
|
@ -245,11 +244,11 @@ gen_peephole (peep)
|
|||
walk_insn_part (XVECEXP (peep, 0, i), 1, 0);
|
||||
}
|
||||
|
||||
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");
|
||||
|
@ -257,12 +256,12 @@ xmalloc (size)
|
|||
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;
|
||||
|
|
|
@ -30,7 +30,6 @@ struct obstack *rtl_obstack = &obstack;
|
|||
#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;
|
||||
|
@ -679,11 +678,11 @@ output_init_mov_optab ()
|
|||
#endif
|
||||
}
|
||||
|
||||
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");
|
||||
|
@ -691,12 +690,12 @@ xmalloc (size)
|
|||
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;
|
||||
|
|
|
@ -98,8 +98,6 @@ static struct code_ptr *peepholes;
|
|||
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 *));
|
||||
|
@ -348,23 +346,23 @@ print_path (path)
|
|||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
|
|
@ -33,7 +33,6 @@ struct obstack *rtl_obstack = &obstack;
|
|||
#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;
|
||||
|
@ -176,11 +175,11 @@ gen_insn (insn)
|
|||
obstack_grow (obstack_ptr, &insn, sizeof (rtx));
|
||||
}
|
||||
|
||||
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");
|
||||
|
@ -188,12 +187,12 @@ xmalloc (size)
|
|||
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;
|
||||
|
|
|
@ -281,11 +281,11 @@ gencode (f)
|
|||
}
|
||||
|
||||
#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)
|
||||
{
|
||||
|
|
|
@ -30,7 +30,6 @@ struct obstack *rtl_obstack = &obstack;
|
|||
#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;
|
||||
|
@ -281,11 +280,11 @@ gen_insn (insn)
|
|||
printf (";\n");
|
||||
}
|
||||
|
||||
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");
|
||||
|
@ -293,12 +292,12 @@ xmalloc (size)
|
|||
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;
|
||||
|
|
|
@ -107,7 +107,6 @@ struct obstack *rtl_obstack = &obstack;
|
|||
#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;
|
||||
|
@ -881,23 +880,23 @@ gen_split (split)
|
|||
d->outfun = 0;
|
||||
}
|
||||
|
||||
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;
|
||||
|
|
|
@ -46,7 +46,6 @@ struct link
|
|||
int vecelt;
|
||||
};
|
||||
|
||||
char *xmalloc PROTO((unsigned));
|
||||
static void fatal PVPROTO ((char *, ...))
|
||||
ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
|
||||
void fancy_abort PROTO((void)) ATTRIBUTE_NORETURN;
|
||||
|
@ -385,23 +384,23 @@ print_code (code)
|
|||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
|
|
@ -193,8 +193,6 @@ static void mybzero PROTO((char *, unsigned));
|
|||
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;
|
||||
|
||||
/* Construct and return a sequence of decisions
|
||||
|
@ -1660,22 +1658,22 @@ mybcopy (in, out, length)
|
|||
*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");
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
#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
|
||||
|
|
|
@ -40,7 +40,6 @@ Boston, MA 02111-1307, USA. */
|
|||
#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 ();
|
||||
|
|
|
@ -28,8 +28,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|||
#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)
|
||||
|
||||
|
|
|
@ -47,24 +47,9 @@ Boston, MA 02111-1307, USA. */
|
|||
#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
|
||||
|
@ -72,6 +57,27 @@ typedef char *CPTR_T;
|
|||
#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
|
||||
|
@ -270,10 +276,15 @@ char *lang_to_string __proto((lang_t));
|
|||
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;
|
||||
|
@ -1590,23 +1601,3 @@ fancy_abort ()
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -611,24 +611,10 @@ Boston, MA 02111-1307, USA. */
|
|||
#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
|
||||
typedef PTR PTR_T;
|
||||
typedef const PTR_T CPTR_T;
|
||||
|
||||
#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
|
||||
|
||||
#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
|
||||
|
@ -650,10 +636,7 @@ extern void pfatal_with_name
|
|||
__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, ...));
|
||||
|
@ -5597,14 +5580,14 @@ void
|
|||
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)
|
||||
|
@ -5675,11 +5658,11 @@ botch (s)
|
|||
|
||||
/* 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.");
|
||||
|
||||
|
@ -5695,11 +5678,11 @@ xmalloc (size)
|
|||
|
||||
/* 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.");
|
||||
|
||||
|
@ -5717,12 +5700,12 @@ xcalloc (size1, size2)
|
|||
|
||||
/* 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.");
|
||||
|
||||
|
@ -5740,7 +5723,7 @@ xrealloc (ptr, size)
|
|||
|
||||
void
|
||||
xfree (ptr)
|
||||
PTR_T ptr;
|
||||
PTR ptr;
|
||||
{
|
||||
if (debug > 3)
|
||||
{
|
||||
|
|
15
gcc/prefix.c
15
gcc/prefix.c
|
@ -73,7 +73,6 @@ static char *std_prefix = PREFIX;
|
|||
|
||||
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
|
||||
|
@ -110,23 +109,23 @@ get_key_value (key)
|
|||
|
||||
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;
|
||||
|
@ -135,7 +134,7 @@ concat VPROTO((char *first, ...))
|
|||
while (arg != 0)
|
||||
{
|
||||
length += strlen (arg);
|
||||
arg = va_arg (args, char *);
|
||||
arg = va_arg (args, const char *);
|
||||
}
|
||||
|
||||
newstr = (char *) malloc (length + 1);
|
||||
|
@ -154,7 +153,7 @@ concat VPROTO((char *first, ...))
|
|||
{
|
||||
while (*arg)
|
||||
*end++ = *arg++;
|
||||
arg = va_arg (args, char *);
|
||||
arg = va_arg (args, const char *);
|
||||
}
|
||||
*end = '\000';
|
||||
va_end (args);
|
||||
|
|
|
@ -45,7 +45,7 @@ static char *reg_names[] = REGISTER_NAMES;
|
|||
|
||||
static FILE *outfile;
|
||||
|
||||
static char spaces[] = " ";
|
||||
static const char xspaces[] = " ";
|
||||
|
||||
static int sawclose = 0;
|
||||
|
||||
|
@ -77,7 +77,7 @@ print_rtx (in_rtx)
|
|||
if (sawclose)
|
||||
{
|
||||
fprintf (outfile, "\n%s",
|
||||
(spaces + (sizeof spaces - 1 - indent * 2)));
|
||||
(xspaces + (sizeof xspaces - 1 - indent * 2)));
|
||||
sawclose = 0;
|
||||
}
|
||||
|
||||
|
@ -185,7 +185,7 @@ print_rtx (in_rtx)
|
|||
if (sawclose)
|
||||
{
|
||||
fprintf (outfile, "\n%s",
|
||||
(spaces + (sizeof spaces - 1 - indent * 2)));
|
||||
(xspaces + (sizeof xspaces - 1 - indent * 2)));
|
||||
sawclose = 0;
|
||||
}
|
||||
fputs ("[ ", outfile);
|
||||
|
@ -202,7 +202,7 @@ print_rtx (in_rtx)
|
|||
}
|
||||
if (sawclose)
|
||||
fprintf (outfile, "\n%s",
|
||||
(spaces + (sizeof spaces - 1 - indent * 2)));
|
||||
(xspaces + (sizeof xspaces - 1 - indent * 2)));
|
||||
|
||||
fputs ("] ", outfile);
|
||||
sawclose = 1;
|
||||
|
|
|
@ -53,8 +53,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|||
#include "gcov-io.h"
|
||||
#include "toplev.h"
|
||||
|
||||
extern char * xmalloc ();
|
||||
|
||||
/* One of these is dynamically created whenever we identify an arc in the
|
||||
function. */
|
||||
|
||||
|
|
|
@ -109,17 +109,8 @@ extern char *version_string;
|
|||
|
||||
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;
|
||||
|
@ -128,13 +119,8 @@ 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)
|
||||
|
||||
|
@ -605,19 +591,15 @@ my_strerror(e)
|
|||
|
||||
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. */
|
||||
|
@ -627,17 +609,13 @@ xrealloc (old_space, byte_count)
|
|||
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
|
||||
|
|
13
gcc/rtl.h
13
gcc/rtl.h
|
@ -842,19 +842,6 @@ extern rtvec gen_rtvec PVPROTO((int, ...));
|
|||
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));
|
||||
|
|
|
@ -57,8 +57,6 @@ extern int skip_spaces _PARAMS((FILE *, int));
|
|||
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));
|
||||
|
|
|
@ -370,4 +370,7 @@ extern void abort ();
|
|||
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
||||
#endif
|
||||
|
||||
/* Get libiberty declarations. */
|
||||
#include "libiberty.h"
|
||||
|
||||
#endif /* __GCC_SYSTEM_H__ */
|
||||
|
|
|
@ -32,8 +32,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|||
#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;
|
||||
|
|
32
gcc/toplev.c
32
gcc/toplev.c
|
@ -1251,7 +1251,7 @@ int dump_time;
|
|||
|
||||
/* Return time used so far, in microseconds. */
|
||||
|
||||
int
|
||||
long
|
||||
get_run_time ()
|
||||
{
|
||||
if (quiet_flag)
|
||||
|
@ -2173,16 +2173,16 @@ botch (s)
|
|||
|
||||
/* 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;
|
||||
|
@ -2190,16 +2190,16 @@ xmalloc (size)
|
|||
|
||||
/* 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;
|
||||
|
@ -2209,19 +2209,17 @@ xcalloc (size1, size2)
|
|||
/* 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");
|
||||
|
@ -2233,7 +2231,7 @@ xrealloc (ptr, size)
|
|||
|
||||
char *
|
||||
xstrdup (s)
|
||||
register char *s;
|
||||
register const char *s;
|
||||
{
|
||||
register char *result = (char *) malloc (strlen (s) + 1);
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@ struct rtx_def;
|
|||
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 *));
|
||||
|
|
15
gcc/tree.h
15
gcc/tree.h
|
@ -1385,21 +1385,6 @@ union tree_node
|
|||
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));
|
||||
|
|
Loading…
Add table
Reference in a new issue