]> gcc.gnu.org Git - gcc.git/commitdiff
genautomata.c (parse_automata_opt): New static function.
authorBernd Schmidt <bernds@codesourcery.com>
Mon, 5 Mar 2012 15:38:06 +0000 (15:38 +0000)
committerBernd Schmidt <bernds@gcc.gnu.org>
Mon, 5 Mar 2012 15:38:06 +0000 (15:38 +0000)
* genautomata.c (parse_automata_opt): New static function.
(initiate_automaton_gen): Remove all option handling code.  Remove
argc argument.  All callers changed.
(main): Call init_rtx_reader_args_cb with the new function as
argument.

From-SVN: r184936

gcc/ChangeLog
gcc/genautomata.c

index 444e514977e5b1e1aaa4873ae1637c701c7b833e..6242143782b284a5742436df20072571f2a211ac 100644 (file)
@@ -1,3 +1,11 @@
+2012-03-05  Bernd Schmidt  <bernds@codesourcery.com>
+
+       * genautomata.c (parse_automata_opt): New static function.
+       (initiate_automaton_gen): Remove all option handling code.  Remove
+       argc argument.  All callers changed.
+       (main): Call init_rtx_reader_args_cb with the new function as
+       argument.
+
 2012-03-05  Richard Guenther  <rguenther@suse.de>
 
        * cfgexpand.c (gimple_expand_cfg): Free dominator info.
index f331f507dae86bd1138c795f60f39e035cd750c3..434b42e0ed3a63cd3fb8a9c08c46e6771e486458 100644 (file)
@@ -9285,46 +9285,45 @@ base_file_name (const char *file_name)
   return file_name + directory_name_length + 1;
 }
 
+/* A function passed as argument to init_rtx_reader_args_cb.  It parses the
+   options available for genautomata.  Returns true if the option was
+   recognized.  */
+static bool
+parse_automata_opt (const char *str)
+{
+  if (strcmp (str, NO_MINIMIZATION_OPTION) == 0)
+    no_minimization_flag = 1;
+  else if (strcmp (str, TIME_OPTION) == 0)
+    time_flag = 1;
+  else if (strcmp (str, STATS_OPTION) == 0)
+    stats_flag = 1;
+  else if (strcmp (str, V_OPTION) == 0)
+    v_flag = 1;
+  else if (strcmp (str, W_OPTION) == 0)
+    w_flag = 1;
+  else if (strcmp (str, NDFA_OPTION) == 0)
+    ndfa_flag = 1;
+  else if (strcmp (str, COLLAPSE_OPTION) == 0)
+    collapse_flag = 1;
+  else if (strcmp (str, PROGRESS_OPTION) == 0)
+    progress_flag = 1;
+  else if (strcmp (str, "-split") == 0)
+    {
+      fatal ("option `-split' has not been implemented yet\n");
+      /* split_argument = atoi (argument_vect [i + 1]); */
+    }
+  else
+    return false;
+
+  return true;
+}
+
 /* The following is top level function to initialize the work of
    pipeline hazards description translator.  */
 static void
-initiate_automaton_gen (int argc, char **argv)
+initiate_automaton_gen (char **argv)
 {
   const char *base_name;
-  int i;
-
-  ndfa_flag = 0;
-  split_argument = 0;  /* default value */
-  no_minimization_flag = 0;
-  time_flag = 0;
-  stats_flag = 0;
-  v_flag = 0;
-  w_flag = 0;
-  progress_flag = 0;
-  for (i = 2; i < argc; i++)
-    if (strcmp (argv [i], NO_MINIMIZATION_OPTION) == 0)
-      no_minimization_flag = 1;
-    else if (strcmp (argv [i], TIME_OPTION) == 0)
-      time_flag = 1;
-    else if (strcmp (argv [i], STATS_OPTION) == 0)
-      stats_flag = 1;
-    else if (strcmp (argv [i], V_OPTION) == 0)
-      v_flag = 1;
-    else if (strcmp (argv [i], W_OPTION) == 0)
-      w_flag = 1;
-    else if (strcmp (argv [i], NDFA_OPTION) == 0)
-      ndfa_flag = 1;
-    else if (strcmp (argv [i], COLLAPSE_OPTION) == 0)
-      collapse_flag = 1;
-    else if (strcmp (argv [i], PROGRESS_OPTION) == 0)
-      progress_flag = 1;
-    else if (strcmp (argv [i], "-split") == 0)
-      {
-       if (i + 1 >= argc)
-         fatal ("-split has no argument.");
-       fatal ("option `-split' has not been implemented yet\n");
-       /* split_argument = atoi (argument_vect [i + 1]); */
-      }
 
   /* Initialize IR storage.  */
   obstack_init (&irp);
@@ -9620,10 +9619,10 @@ main (int argc, char **argv)
 
   progname = "genautomata";
 
-  if (!init_rtx_reader_args (argc, argv))
+  if (!init_rtx_reader_args_cb (argc, argv, parse_automata_opt))
     return (FATAL_EXIT_CODE);
 
-  initiate_automaton_gen (argc, argv);
+  initiate_automaton_gen (argv);
   while (1)
     {
       int lineno;
This page took 0.070819 seconds and 5 git commands to generate.