/* 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.
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"
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;
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.
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:
formals_style style;
{
char* ret_val;
- char* outer_modifier = "";
if (DECL_NAME (decl))
ret_val = IDENTIFIER_POINTER (DECL_NAME (decl));
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);
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");
}