OSDN Git Service

Daily bump.
[pf3gnuchains/gcc-fork.git] / gcc / c-aux-info.c
index 429601f..1125d5a 100644 (file)
@@ -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,
@@ -39,14 +37,14 @@ typedef enum formals_style_enum formals_style;
 
 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));
 \f
 /*  Take two strings and mash them together into a newly allocated area.  */
 
@@ -178,10 +176,10 @@ gen_formal_list_for_type (fntype, style)
         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);
     }
@@ -361,7 +359,8 @@ gen_type (ret_val, t, 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
     {
@@ -479,8 +478,8 @@ gen_type (ret_val, t, style)
         case INTEGER_TYPE:
           data_type = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (t)));
           /* Normally, `unsigned' is part of the deal.  Not so if it comes
-            with `const' or `volatile'.  */
-          if (TREE_UNSIGNED (t) && (TYPE_READONLY (t) || TYPE_VOLATILE (t)))
+            with a type qualifier.  */
+          if (TREE_UNSIGNED (t) && TYPE_QUALS (t))
            data_type = concat ("unsigned ", data_type);
          break;
 
@@ -504,6 +503,8 @@ gen_type (ret_val, t, style)
     ret_val = concat ("const ", ret_val);
   if (TYPE_VOLATILE (t))
     ret_val = concat ("volatile ", ret_val);
+  if (TYPE_RESTRICT (t))
+    ret_val = concat ("restrict ", ret_val);
   return ret_val;
 }