OSDN Git Service

* stor-layout.c (layout_type): Complain if an array's size can
[pf3gnuchains/gcc-fork.git] / gcc / genattr.c
index 770379a..cbb1175 100644 (file)
@@ -2,22 +2,22 @@
    Copyright (C) 1991, 1994, 1996, 1998, 1999, 2000 Free Software Foundation, Inc.
    Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu)
 
-This file is part of GNU CC.
+This file is part of GCC.
 
-GNU CC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
 
-GNU CC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the 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, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
+along with GCC; see the file COPYING.  If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA.  */
 
 
 #include "hconfig.h"
@@ -213,14 +213,16 @@ main (argc, argv)
   if (init_md_reader (argv[1]) != SUCCESS_EXIT_CODE)
     return (FATAL_EXIT_CODE);
 
-  printf ("/* Generated automatically by the program `genattr'\n\
-from the machine description file `md'.  */\n\n");
+  puts ("/* Generated automatically by the program `genattr'");
+  puts ("   from the machine description file `md'.  */\n");
+  puts ("#ifndef GCC_INSN_ATTR_H");
+  puts ("#define GCC_INSN_ATTR_H\n");
 
   /* For compatibility, define the attribute `alternative', which is just
      a reference to the variable `which_alternative'.  */
 
-  printf ("#define HAVE_ATTR_alternative\n");
-  printf ("#define get_attr_alternative(insn) which_alternative\n");
+  puts ("#define HAVE_ATTR_alternative");
+  puts ("#define get_attr_alternative(insn) which_alternative");
      
   /* Read the machine description.  */
 
@@ -279,11 +281,9 @@ from the machine description file `md'.  */\n\n");
 
          if (unit == 0)
            {
-             int len = strlen (name) + 1;
              unit = (struct function_unit *)
-               alloca (sizeof (struct function_unit));
-             unit->name = (char *) alloca (len);
-             bcopy (name, unit->name, len);
+               xmalloc (sizeof (struct function_unit));
+             unit->name = xstrdup (name);
              unit->multiplicity = multiplicity;
              unit->simultaneity = simultaneity;
              unit->ready_cost.min = unit->ready_cost.max = ready_cost;
@@ -361,8 +361,12 @@ from the machine description file `md'.  */\n\n");
   printf("#define ATTR_FLAG_unlikely\t0x10\n");
   printf("#define ATTR_FLAG_very_unlikely\t0x20\n");
 
-  fflush (stdout);
-  return (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
+  puts("\n#endif /* GCC_INSN_ATTR_H */");
+
+  if (ferror (stdout) || fflush (stdout) || fclose (stdout))
+    return FATAL_EXIT_CODE;
+
+  return SUCCESS_EXIT_CODE;
 }
 
 /* Define this so we can link with print-rtl.o to get debug_rtx function.  */