]> sourceware.org Git - automake.git/commitdiff
* ansi2knr.c: New version from Pavel Roskin (via ansi2knr.c
authorTom Tromey <tromey@redhat.com>
Mon, 12 Apr 1999 15:15:01 +0000 (15:15 +0000)
committerTom Tromey <tromey@redhat.com>
Mon, 12 Apr 1999 15:15:01 +0000 (15:15 +0000)
maintainer).

ChangeLog
TODO
ansi2knr.c
lib/ansi2knr.c

index 2321fc9295732574ac6db4a5cb9342f3dc3be249..b5c55b067a520c99d47700327230db131bc062e5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+1999-04-12  Tom Tromey  <tromey@cygnus.com>
+
+       * ansi2knr.c: New version from Pavel Roskin (via ansi2knr.c
+       maintainer).
+
 1999-04-11  Tom Tromey  <tromey@cygnus.com>
 
        * automake.in (handle_dist): Use AMTAR.
diff --git a/TODO b/TODO
index 94244426f7c67e7e87221c5629df5410459d3ca7..e39c08720513ec718bec30245b2c4c17a500dcb8 100644 (file)
--- a/TODO
+++ b/TODO
@@ -7,6 +7,8 @@
   try to find a losing compiler and see if it really works.
   (actually: hack config.cache and do it)
 
+* test `make clean' with subdir-objects
+
 * Test nodist_SOURCES with lex, yacc, etc.
 
 * Support subdir-objects with fortran
index af7b07d5e9cb94d45115f5de45bda535a2666e9e..ed5ba195d1bc1c57586f75bdde0100db9515027a 100644 (file)
@@ -44,7 +44,10 @@ program under the GPL.
  * consisting of only
  *     identifier1(identifier2)
  * will not be considered a function definition unless identifier2 is
- * the word "void".  ansi2knr will recognize a multi-line header provided
+ * the word "void", and a line consisting of
+ *     identifier1(identifier2, <<arbitrary>>)
+ * will not be considered a function definition.
+ * ansi2knr will recognize a multi-line header provided
  * that no intervening line ends with a left or right brace or a semicolon.
  * These algorithms ignore whitespace and comments, except that
  * the function name must be the first thing on the line.
@@ -58,6 +61,12 @@ program under the GPL.
  * The original and principal author of ansi2knr is L. Peter Deutsch
  * <ghost@aladdin.com>.  Other authors are noted in the change history
  * that follows (in reverse chronological order):
+       lpd 1999-04-12 added minor fixes from Pavel Roskin
+               <pavel_roskin@geocities.com> for clean compilation with
+               gcc -W -Wall
+       lpd 1999-03-22 added hack to recognize lines consisting of
+               identifier1(identifier2, xxx) as *not* being procedures
+       lpd 1999-02-03 made indentation of preprocessor commands consistent
        lpd 1999-01-28 fixed two bugs: a '/' in an argument list caused an
                endless loop; quoted strings within an argument list
                confused the parser
@@ -158,19 +167,24 @@ program under the GPL.
 
 #endif
 
+/* Define NULL (for *very* old compilers). */
+#ifndef NULL
+# define NULL (0)
+#endif
+
 /*
  * The ctype macros don't always handle 8-bit characters correctly.
  * Compensate for this here.
  */
 #ifdef isascii
-#  undef HAVE_ISASCII          /* just in case */
-#  define HAVE_ISASCII 1
+# undef HAVE_ISASCII           /* just in case */
+# define HAVE_ISASCII 1
 #else
 #endif
 #if STDC_HEADERS || !HAVE_ISASCII
-#  define is_ascii(c) 1
+# define is_ascii(c) 1
 #else
-#  define is_ascii(c) isascii(c)
+# define is_ascii(c) isascii(c)
 #endif
 
 #define is_space(c) (is_ascii(c) && isspace(c))
@@ -263,6 +277,11 @@ main(argc, argv)
        if ( filename )
          fprintf(out, "#line 1 \"%s\"\n", filename);
        buf = malloc(bufsize);
+       if ( buf == NULL )
+          {
+               fprintf(stderr, "Unable to allocate read buffer!\n");
+               exit(1);
+          }
        line = buf;
        while ( fgets(line, (unsigned)(buf + bufsize - line), in) != NULL )
           {
@@ -430,7 +449,7 @@ test1(buf)
                   };
                char **key = words;
                char *kp;
-               int len = endfn - buf;
+               unsigned len = endfn - buf;
 
                while ( (kp = *key) != 0 )
                   {    if ( strlen(kp) == len && !strncmp(kp, buf, len) )
@@ -443,14 +462,16 @@ test1(buf)
               int len;
               /*
                * Check for identifier1(identifier2) and not
-               * identifier1(void).
+               * identifier1(void), or identifier1(identifier2, xxxx).
                */
 
               while ( isidchar(*p) )
                   p++;
               len = p - id;
               p = skipspace(p, 1);
-              if ( *p == ')' && (len != 4 || strncmp(id, "void", 4)) )
+              if (*p == ',' ||
+                  (*p == ')' && (len != 4 || strncmp(id, "void", 4)))
+                  )
                   return 0;    /* not a function */
           }
        /*
@@ -495,7 +516,7 @@ convert1(buf, out, header, convert_varargs)
          ;
 top:   p = endfn;
        breaks = (char **)malloc(sizeof(char *) * num_breaks * 2);
-       if ( breaks == 0 )
+       if ( breaks == NULL )
           {    /* Couldn't allocate break table, give up */
                fprintf(stderr, "Unable to allocate break table!\n");
                fputs(buf, out);
@@ -507,7 +528,7 @@ top:        p = endfn;
        do
           {    int level = 0;
                char *lp = NULL;
-               char *rp;
+               char *rp = NULL;
                char *end = NULL;
 
                if ( bp >= btop )
@@ -545,7 +566,7 @@ top:        p = endfn;
                           }
                   }
                /* Erase any embedded prototype parameters. */
-               if ( lp )
+               if ( lp && rp )
                  writeblanks(lp + 1, rp);
                p--;                    /* back up over terminator */
                /* Find the name being declared. */
index af7b07d5e9cb94d45115f5de45bda535a2666e9e..ed5ba195d1bc1c57586f75bdde0100db9515027a 100644 (file)
@@ -44,7 +44,10 @@ program under the GPL.
  * consisting of only
  *     identifier1(identifier2)
  * will not be considered a function definition unless identifier2 is
- * the word "void".  ansi2knr will recognize a multi-line header provided
+ * the word "void", and a line consisting of
+ *     identifier1(identifier2, <<arbitrary>>)
+ * will not be considered a function definition.
+ * ansi2knr will recognize a multi-line header provided
  * that no intervening line ends with a left or right brace or a semicolon.
  * These algorithms ignore whitespace and comments, except that
  * the function name must be the first thing on the line.
@@ -58,6 +61,12 @@ program under the GPL.
  * The original and principal author of ansi2knr is L. Peter Deutsch
  * <ghost@aladdin.com>.  Other authors are noted in the change history
  * that follows (in reverse chronological order):
+       lpd 1999-04-12 added minor fixes from Pavel Roskin
+               <pavel_roskin@geocities.com> for clean compilation with
+               gcc -W -Wall
+       lpd 1999-03-22 added hack to recognize lines consisting of
+               identifier1(identifier2, xxx) as *not* being procedures
+       lpd 1999-02-03 made indentation of preprocessor commands consistent
        lpd 1999-01-28 fixed two bugs: a '/' in an argument list caused an
                endless loop; quoted strings within an argument list
                confused the parser
@@ -158,19 +167,24 @@ program under the GPL.
 
 #endif
 
+/* Define NULL (for *very* old compilers). */
+#ifndef NULL
+# define NULL (0)
+#endif
+
 /*
  * The ctype macros don't always handle 8-bit characters correctly.
  * Compensate for this here.
  */
 #ifdef isascii
-#  undef HAVE_ISASCII          /* just in case */
-#  define HAVE_ISASCII 1
+# undef HAVE_ISASCII           /* just in case */
+# define HAVE_ISASCII 1
 #else
 #endif
 #if STDC_HEADERS || !HAVE_ISASCII
-#  define is_ascii(c) 1
+# define is_ascii(c) 1
 #else
-#  define is_ascii(c) isascii(c)
+# define is_ascii(c) isascii(c)
 #endif
 
 #define is_space(c) (is_ascii(c) && isspace(c))
@@ -263,6 +277,11 @@ main(argc, argv)
        if ( filename )
          fprintf(out, "#line 1 \"%s\"\n", filename);
        buf = malloc(bufsize);
+       if ( buf == NULL )
+          {
+               fprintf(stderr, "Unable to allocate read buffer!\n");
+               exit(1);
+          }
        line = buf;
        while ( fgets(line, (unsigned)(buf + bufsize - line), in) != NULL )
           {
@@ -430,7 +449,7 @@ test1(buf)
                   };
                char **key = words;
                char *kp;
-               int len = endfn - buf;
+               unsigned len = endfn - buf;
 
                while ( (kp = *key) != 0 )
                   {    if ( strlen(kp) == len && !strncmp(kp, buf, len) )
@@ -443,14 +462,16 @@ test1(buf)
               int len;
               /*
                * Check for identifier1(identifier2) and not
-               * identifier1(void).
+               * identifier1(void), or identifier1(identifier2, xxxx).
                */
 
               while ( isidchar(*p) )
                   p++;
               len = p - id;
               p = skipspace(p, 1);
-              if ( *p == ')' && (len != 4 || strncmp(id, "void", 4)) )
+              if (*p == ',' ||
+                  (*p == ')' && (len != 4 || strncmp(id, "void", 4)))
+                  )
                   return 0;    /* not a function */
           }
        /*
@@ -495,7 +516,7 @@ convert1(buf, out, header, convert_varargs)
          ;
 top:   p = endfn;
        breaks = (char **)malloc(sizeof(char *) * num_breaks * 2);
-       if ( breaks == 0 )
+       if ( breaks == NULL )
           {    /* Couldn't allocate break table, give up */
                fprintf(stderr, "Unable to allocate break table!\n");
                fputs(buf, out);
@@ -507,7 +528,7 @@ top:        p = endfn;
        do
           {    int level = 0;
                char *lp = NULL;
-               char *rp;
+               char *rp = NULL;
                char *end = NULL;
 
                if ( bp >= btop )
@@ -545,7 +566,7 @@ top:        p = endfn;
                           }
                   }
                /* Erase any embedded prototype parameters. */
-               if ( lp )
+               if ( lp && rp )
                  writeblanks(lp + 1, rp);
                p--;                    /* back up over terminator */
                /* Find the name being declared. */
This page took 0.039344 seconds and 5 git commands to generate.