re PR target/65697 (__atomic memory barriers not strong enough for __sync builtins)
[gcc.git] / gcc / genhooks.c
index 89f60c9ce4438cd86a9dc79b87ee9cb919970a04..b191fb5a0e257e71d3c8d0f738549c19769d1f20 100644 (file)
@@ -1,6 +1,6 @@
 /* Process target.def to create initialization macros definition in
    target-hooks-def.h and documentation in target-hooks.texi.
-   Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
+   Copyright (C) 2009-2015 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -19,7 +19,6 @@ along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 #include "bconfig.h"
 #include "system.h"
-#include "hashtab.h"
 #include "errors.h"
 
 struct hook_desc { const char *doc, *type, *name, *param, *init, *docname; };
@@ -34,10 +33,11 @@ static struct hook_desc hook_array[] = {
   { "*", #TYPE, HOOK_PREFIX #NAME, #PARAMS, #INIT, HOOK_TYPE },
 #include "target.def"
 #include "c-family/c-target.def"
+#include "common/common-target.def"
 #undef DEFHOOK
 };
 
-/* For each @Fcode in the the first paragraph of the documentation string DOC,
+/* For each @Fcode in the first paragraph of the documentation string DOC,
    print an @findex directive.  HOOK_NAME is the name of the hook this bit of
    documentation pertains to.  */
 static void
@@ -90,7 +90,7 @@ s_hook_eq_p (const void *p1, const void *p2)
 }
 
 /* Read the documentation file with name IN_FNAME, perform substitutions
-   to incorporate informtion from hook_array, and emit the result on stdout.
+   to incorporate information from hook_array, and emit the result on stdout.
    Hooks defined with DEFHOOK / DEFHOOKPOD are emitted at the place of a
    matching @hook in the input file; if there is no matching @hook, the
    hook is emitted after the hook that precedes it in target.def .
@@ -119,7 +119,6 @@ emit_documentation (const char *in_fname)
   char buf[1000];
   htab_t start_hooks = htab_create (99, s_hook_hash, s_hook_eq_p, (htab_del) 0);
   FILE *f;
-  bool found_start = false;
 
   /* Enter all the start hooks in start_hooks.  */
   f = fopen (in_fname, "r");
@@ -163,9 +162,8 @@ emit_documentation (const char *in_fname)
          if (shp->pos >= 0)
            fatal ("Duplicate hook %s\n", sh.name);
          shp->pos = i;
-         found_start = true;
        }
-      else if (!found_start)
+      else
        fatal ("No place specified to document hook %s\n", sh.name);
       free (sh.name);
     }
@@ -340,6 +338,8 @@ emit_init_macros (const char *docname)
 int
 main (int argc, char **argv)
 {
+  progname = "genhooks";
+
   if (argc >= 3)
     emit_documentation (argv[2]);
   else