OSDN Git Service

Update header.
[pf3gnuchains/gcc-fork.git] / gcc / c-aux-info.c
index fddf496..f74ac0a 100644 (file)
@@ -1,10 +1,8 @@
 /* Generate information regarding function declarations and definitions based
    on information stored in GCC's tree structure.  This code implements the
-   -fgen-aux-info option.
-
-   This code was written by Ron Guilmette (rfg@mcc.com).
-
-   Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+   -aux-info option.
+   Copyright (C) 1989, 1991, 1994, 1995 Free Software Foundation, Inc.
+   Contributed by Ron Guilmette (rfg@segfault.us.com).
 
 This file is part of GNU CC.
 
@@ -20,7 +18,8 @@ GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with GNU CC; see the file COPYING.  If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
 
 #include <stdio.h>
 #include "config.h"
@@ -126,12 +125,12 @@ affix_data_type (type_or_decl)
 
   for (;;)
     {
-      if (!strncmp (p, "volatile", 8))
+      if (!strncmp (p, "volatile ", 9))
         {
           p += 9;
           continue;
         }
-      if (!strncmp (p, "const", 5))
+      if (!strncmp (p, "const ", 6))
         {
           p += 6;
           continue;
@@ -210,7 +209,7 @@ gen_formal_list_for_type (fntype, style)
      to output the "void" verbatim, and that what we do.  In the former case,
      we do our best to give protoize something nice to insert.
 
-     This "something nice" should be something that is still legal (when
+     This "something nice" should be something that is still valid (when
      re-compiled) but something that can clearly indicate to the user that
      more typing information (for the parameter list) should be added (by
      hand) at some convenient moment.
@@ -384,7 +383,18 @@ gen_type (ret_val, t, style)
           return ret_val;
 
         case ARRAY_TYPE:
-          ret_val = gen_type (concat (ret_val, "[]"), TREE_TYPE (t), style);
+         if (TYPE_SIZE (t) == 0 || TREE_CODE (TYPE_SIZE (t)) != INTEGER_CST)
+           ret_val = gen_type (concat (ret_val, "[]"), TREE_TYPE (t), style);
+         else if (int_size_in_bytes (t) == 0)
+           ret_val = gen_type (concat (ret_val, "[0]"), 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),
+                                 TREE_TYPE (t), style);
+           }
           break;
 
         case FUNCTION_TYPE:
@@ -510,7 +520,6 @@ gen_decl (decl, is_func_definition, style)
      formals_style style;
 {
   char* ret_val;
-  char* outer_modifier = "";
 
   if (DECL_NAME (decl))
     ret_val = IDENTIFIER_POINTER (DECL_NAME (decl));
@@ -568,7 +577,7 @@ gen_decl (decl, is_func_definition, style)
 
   ret_val = affix_data_type (ret_val);
 
-  if (TREE_REGDECL (decl))
+  if (DECL_REGISTER (decl))
     ret_val = concat ("register ", ret_val);
   if (TREE_PUBLIC (decl))
     ret_val = concat ("extern ", ret_val);
@@ -601,7 +610,7 @@ gen_aux_info_record (fndecl, is_definition, is_implicit, is_prototyped)
       if (! compiled_from_record++)
        {
          /* The first line tells which directory file names are relative to.
-            Currently, -fgen-aux-info works only for files in the working
+            Currently, -aux-info works only for files in the working
             directory, so just use a `.' as a placeholder for now.  */
          fprintf (aux_info_file, "/* compiled from: . */\n");
        }