[PATCH,gfortran] Remove homegrown isdigit and isalpha in module.c

Steve Kargl sgk@troutmask.apl.washington.edu
Sun Jan 9 21:29:00 GMT 2005


On Sun, Jan 09, 2005 at 01:16:46PM -0800, Steve Kargl wrote:
> On Sun, Jan 09, 2005 at 01:15:43PM -0800, Steve Kargl wrote:
> > 2005-01-09  Steven G. Kargl  <kargls@comcast.net>
> > 
> >         *  module.c: Fix typos in comments.
> >         (parse_atom): Use isdigit() and isalpha() instead of homegrown
> 
> Oh yeah, bubblestrapped and regtested on i386-*-freebsd6.0
> 

Well, I just learned that isdigit and isalpha are spelled 
as ISDIGIT and ISALPHA in gcc source.  Update the patch.

-- 
Steve
-------------- next part --------------
Index: module.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/module.c,v
retrieving revision 1.23
diff -u -b -u -r1.23 module.c
--- module.c	3 Jan 2005 21:43:50 -0000	1.23
+++ module.c	9 Jan 2005 21:28:07 -0000
@@ -1,7 +1,7 @@
 /* Handle modules, which amounts to loading and saving symbols and
    their attendant structures.
-   Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, 
-   Inc.
+   Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 Free Software
+   Foundation, Inc.
    Contributed by Andy Vaught
 
 This file is part of GCC.
@@ -23,7 +23,7 @@
 
 /* The syntax of gfortran modules resembles that of lisp lists, ie a
    sequence of atoms, which can be left or right parenthesis, names,
-   integers or strings.  Parenthesis are always matched which allows
+   integers or strings.  Parentheses are always matched which allows
    us to skip over sections at high speed without having to know
    anything about the internal structure of the lists.  A "name" is
    usually a fortran 95 identifier, but can also start with '@' in
@@ -778,7 +778,7 @@
 
 
 /* Report problems with a module.  Error reporting is not very
-   elaborate, since this sorts of errors shouldn't really happen.
+   elaborate, since these sorts of errors shouldn't really happen.
    This subroutine never returns.  */
 
 static void bad_module (const char *) ATTRIBUTE_NORETURN;
@@ -986,89 +986,27 @@
     }
   while (c == ' ' || c == '\n');
 
-  switch (c)
-    {
-    case '(':
+  if (c == '(')
       return ATOM_LPAREN;
-
-    case ')':
+  else if (c == ')')
       return ATOM_RPAREN;
-
-    case '\'':
+  else if (c == '\'')
+    {
       parse_string ();
       return ATOM_STRING;
-
-    case '0':
-    case '1':
-    case '2':
-    case '3':
-    case '4':
-    case '5':
-    case '6':
-    case '7':
-    case '8':
-    case '9':
+    }
+  else if (ISDIGIT(c))
+    {
       parse_integer (c);
       return ATOM_INTEGER;
-
-    case 'a':
-    case 'b':
-    case 'c':
-    case 'd':
-    case 'e':
-    case 'f':
-    case 'g':
-    case 'h':
-    case 'i':
-    case 'j':
-    case 'k':
-    case 'l':
-    case 'm':
-    case 'n':
-    case 'o':
-    case 'p':
-    case 'q':
-    case 'r':
-    case 's':
-    case 't':
-    case 'u':
-    case 'v':
-    case 'w':
-    case 'x':
-    case 'y':
-    case 'z':
-    case 'A':
-    case 'B':
-    case 'C':
-    case 'D':
-    case 'E':
-    case 'F':
-    case 'G':
-    case 'H':
-    case 'I':
-    case 'J':
-    case 'K':
-    case 'L':
-    case 'M':
-    case 'N':
-    case 'O':
-    case 'P':
-    case 'Q':
-    case 'R':
-    case 'S':
-    case 'T':
-    case 'U':
-    case 'V':
-    case 'W':
-    case 'X':
-    case 'Y':
-    case 'Z':
+    }
+  else if (ISALPHA(c))
+    {
       parse_name (c);
       return ATOM_NAME;
-
-    default:
-      bad_module ("Bad name");
     }
+  else
+    bad_module ("Bad name");
 
   /* Not reached */
 }
@@ -3008,7 +2946,7 @@
       /* Get the local name for this symbol.  */
       p = find_use_name (name);
 
-      /* Skip symtree nodes not in an ONLY caluse.  */
+      /* Skip symtree nodes not in an ONLY clause.  */
       if (p == NULL)
 	continue;
 


More information about the Fortran mailing list