summaryrefslogtreecommitdiffstats
path: root/contrib/gcc/c-aux-info.c
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>1999-08-26 09:30:50 +0000
committerobrien <obrien@FreeBSD.org>1999-08-26 09:30:50 +0000
commit0bedf4fb30066e5e1d4342a1d3914dae7d37cba7 (patch)
tree68d8110b41afd0ebbf39167b1a4918eea667a7c5 /contrib/gcc/c-aux-info.c
parentd4db5fb866b7ad5216abd5047774a3973b9901a9 (diff)
downloadFreeBSD-src-0bedf4fb30066e5e1d4342a1d3914dae7d37cba7.zip
FreeBSD-src-0bedf4fb30066e5e1d4342a1d3914dae7d37cba7.tar.gz
Virgin import of gcc from EGCS 1.1.2
Diffstat (limited to 'contrib/gcc/c-aux-info.c')
-rw-r--r--contrib/gcc/c-aux-info.c79
1 files changed, 39 insertions, 40 deletions
diff --git a/contrib/gcc/c-aux-info.c b/contrib/gcc/c-aux-info.c
index d8caa6a..3e2edde 100644
--- a/contrib/gcc/c-aux-info.c
+++ b/contrib/gcc/c-aux-info.c
@@ -1,7 +1,7 @@
/* Generate information regarding function declarations and definitions based
on information stored in GCC's tree structure. This code implements the
-aux-info option.
- Copyright (C) 1989, 1991, 1994, 1995 Free Software Foundation, Inc.
+ Copyright (C) 1989, 91, 94, 95, 97, 1998 Free Software Foundation, Inc.
Contributed by Ron Guilmette (rfg@segfault.us.com).
This file is part of GNU CC.
@@ -21,14 +21,12 @@ along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#include <stdio.h>
#include "config.h"
+#include "system.h"
#include "flags.h"
#include "tree.h"
#include "c-tree.h"
-extern char* xmalloc ();
-
enum formals_style_enum {
ansi,
k_and_r_names,
@@ -37,26 +35,26 @@ enum formals_style_enum {
typedef enum formals_style_enum formals_style;
-static char* data_type;
+static char *data_type;
-static char * concat ();
-static char * concat3 ();
-static char * gen_formal_list_for_type ();
-static int deserves_ellipsis ();
-static char * gen_formal_list_for_func_def ();
-static char * gen_type ();
-static char * gen_decl ();
-void gen_aux_info_record ();
+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_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. */
-static char*
+static char *
concat (s1, s2)
- char* s1;
- char* s2;
+ char *s1;
+ char *s2;
{
int size1, size2;
- char* ret_val;
+ char *ret_val;
if (!s1)
s1 = "";
@@ -73,14 +71,14 @@ concat (s1, s2)
/* Take three strings and mash them together into a newly allocated area. */
-static char*
+static char *
concat3 (s1, s2, s3)
- char* s1;
- char* s2;
- char* s3;
+ char *s1;
+ char *s2;
+ char *s3;
{
int size1, size2, size3;
- char* ret_val;
+ char *ret_val;
if (!s1)
s1 = "";
@@ -113,7 +111,7 @@ concat3 (s1, s2, s3)
`const char *foo;' and *not* `char const *foo;' so we try to create types
that look as expected. */
-static char*
+static char *
affix_data_type (type_or_decl)
char *type_or_decl;
{
@@ -156,14 +154,14 @@ affix_data_type (type_or_decl)
this function type. Return the whole formal parameter list (including
a pair of surrounding parens) as a string. Note that if the style
we are currently aiming for is non-ansi, then we just return a pair
- of empty parens here. */
+ of empty parens here. */
-static char*
+static char *
gen_formal_list_for_type (fntype, style)
tree fntype;
formals_style style;
{
- char* formal_list = "";
+ char *formal_list = "";
tree formal_type;
if (style != ansi)
@@ -172,16 +170,16 @@ gen_formal_list_for_type (fntype, style)
formal_type = TYPE_ARG_TYPES (fntype);
while (formal_type && TREE_VALUE (formal_type) != void_type_node)
{
- char* this_type;
+ char *this_type;
if (*formal_list)
formal_list = concat (formal_list, ", ");
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);
+ formal_list
+ = ((strlen (this_type))
+ ? concat (formal_list, affix_data_type (this_type))
+ : concat (formal_list, data_type));
formal_type = TREE_CHAIN (formal_type);
}
@@ -278,12 +276,12 @@ deserves_ellipsis (fntype)
This routine returns a string which is the source form for the entire
function formal parameter list. */
-static char*
+static char *
gen_formal_list_for_func_def (fndecl, style)
tree fndecl;
formals_style style;
{
- char* formal_list = "";
+ char *formal_list = "";
tree formal_decl;
formal_decl = DECL_ARGUMENTS (fndecl);
@@ -353,15 +351,16 @@ gen_formal_list_for_func_def (fndecl, style)
to do at this point is for the initial caller to prepend the "data_type"
string onto the returned "seed". */
-static char*
+static char *
gen_type (ret_val, t, style)
- char* ret_val;
+ char *ret_val;
tree t;
formals_style style;
{
tree chain_p;
- if (TYPE_NAME (t) && DECL_NAME (TYPE_NAME (t)))
+ /* If there is a typedef name for this type, use it. */
+ if (TYPE_NAME (t) && TREE_CODE (TYPE_NAME (t)) == TYPE_DECL)
data_type = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (t)));
else
{
@@ -517,13 +516,13 @@ gen_type (ret_val, t, style)
associated with a function definition. In this case, we can assume that
an attached list of DECL nodes for function formal arguments is present. */
-static char*
+static char *
gen_decl (decl, is_func_definition, style)
tree decl;
int is_func_definition;
formals_style style;
{
- char* ret_val;
+ char *ret_val;
if (DECL_NAME (decl))
ret_val = IDENTIFIER_POINTER (DECL_NAME (decl));
@@ -581,7 +580,7 @@ gen_decl (decl, is_func_definition, style)
ret_val = affix_data_type (ret_val);
- if (DECL_REGISTER (decl))
+ if (TREE_CODE (decl) != FUNCTION_DECL && DECL_REGISTER (decl))
ret_val = concat ("register ", ret_val);
if (TREE_PUBLIC (decl))
ret_val = concat ("extern ", ret_val);
@@ -591,7 +590,7 @@ gen_decl (decl, is_func_definition, style)
return ret_val;
}
-extern FILE* aux_info_file;
+extern FILE *aux_info_file;
/* Generate and write a new line of info to the aux-info (.X) file. This
routine is called once for each function declaration, and once for each
OpenPOWER on IntegriCloud