toplev.h (read_integral_parameter): Declare.
authorTheodore Papadopoulo <Theodore.Papadopoulo@sophia.inria.fr>
Tue, 2 Feb 1999 21:43:19 +0000 (22:43 +0100)
committerJeff Law <law@gcc.gnu.org>
Tue, 2 Feb 1999 21:43:19 +0000 (14:43 -0700)
* toplev.h (read_integral_parameter): Declare.
* toplev.c (read_integral_parameter): New function.

From-SVN: r24985

gcc/ChangeLog
gcc/toplev.c
gcc/toplev.h

index c95413e879fdc8e59904beb4ad59c9b17dffebbb..86cca6d50a1551a35513134e4105561a95770441 100644 (file)
@@ -1,3 +1,8 @@
+Tue Feb  2 22:38:19 1999  Theodore Papadopoulo <Theodore.Papadopoulo@sophia.inria.fr>
+
+       * toplev.h (read_integral_parameter): Declare.
+       * toplev.c (read_integral_parameter): New function.
+
 Fri Jan 29 21:00:56 1999  Bob Manson  <manson@charmed.cygnus.com>
 
        * resource.c, resource.h: New files.
index c23292842c6efad6b3291473fc77bd23344b9aec..33fa3097fb02fd939f79e111c864684a5c8ade6f 100644 (file)
@@ -1244,6 +1244,33 @@ FILE *asm_out_file;
 FILE *aux_info_file;
 FILE *rtl_dump_file = NULL;
 
+/* Decode the string P as an integral parameter.
+   If the string is indeed an integer return its numeric value else
+   issue an Invalid Option error for the option PNAME and return DEFVAL. */
+   
+int
+read_integral_parameter (p, pname, defval)
+     char *p;
+     char *pname;
+     int  defval;
+{
+  char *endp = p;
+
+  while (*endp)
+    {
+      if (*endp >= '0' && *endp <= '9')
+       endp++;
+      else
+       {
+         error ("Invalid option `%s'", pname);
+         return defval;
+       }
+    }
+
+  return atoi (p);
+}
+
+
 /* Time accumulators, to count the total time spent in various passes.  */
 
 int parse_time;
index 1622a64662bcc7bf3a1c07628b789b13184c41c0..1363519cc4206679f8b494e3f28355d4a032c287 100644 (file)
@@ -26,6 +26,7 @@ union tree_node;
 struct rtx_def;
 #endif
 
+extern int read_integral_parameter     PROTO ((char *, char *, int));
 extern int count_error                 PROTO ((int));
 extern void strip_off_ending           PROTO ((char *, int));
 extern void print_time                 PROTO ((const char *, int));