OSDN Git Service

* toplev.h (read_integral_parameter): Declare.
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 2 Feb 1999 21:43:19 +0000 (21:43 +0000)
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 2 Feb 1999 21:43:19 +0000 (21:43 +0000)
* toplev.c (read_integral_parameter): New function.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@24985 138bc75d-0d04-0410-961f-82ee72b054a4

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

index c95413e..86cca6d 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 c232928..33fa309 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 1622a64..1363519 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));