OSDN Git Service

* decl.c (init_decl_processing): Remove duplicate decl of
[pf3gnuchains/gcc-fork.git] / gcc / scan-decls.c
index 253f3fc..13a09ac 100644 (file)
@@ -1,5 +1,5 @@
 /* scan-decls.c - Extracts declarations from cpp output.
-   Copyright (C) 1993, 1995 Free Software Foundation, Inc.
+   Copyright (C) 1993, 1995, 97-99, 2000 Free Software Foundation, Inc.
 
 This program is free software; you can redistribute it and/or modify it
 under the terms of the GNU General Public License as published by the
@@ -17,10 +17,12 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
    Written by Per Bothner <bothner@cygnus.com>, July 1993.  */
 
-#include <stdio.h>
-#include <ctype.h>
 #include "hconfig.h"
+#include "system.h"
 #include "cpplib.h"
+#include "scan.h"
+
+static void skip_to_closing_brace PARAMS ((cpp_reader *));
 
 int brace_nesting = 0;
 
@@ -77,20 +79,21 @@ Here dname is the actual name being declared.
 int
 scan_decls (pfile, argc, argv)
      cpp_reader *pfile;
-     int argc;
-     char **argv;
+     int argc ATTRIBUTE_UNUSED;
+     char **argv ATTRIBUTE_UNUSED;
 {
   int saw_extern, saw_inline;
-  int old_written;
+  int start_written;
   /* If declarator_start is non-zero, it marks the start of the current
      declarator.  If it is zero, we are either still parsing the
      decl-specs, or prev_id_start marks the start of the declarator.  */
   int declarator_start;
-  int prev_id_start, prev_id_end;
+  int prev_id_start, prev_id_end = 0;
   enum cpp_token token;
 
  new_statement:
   CPP_SET_WRITTEN (pfile, 0);
+  start_written = 0;
   token = cpp_get_token (pfile);
 
  handle_statement:
@@ -122,9 +125,6 @@ scan_decls (pfile, argc, argv)
   declarator_start = 0;
   for (;;)
     {
-      int start_written = CPP_WRITTEN (pfile);
-      token = cpp_get_token (pfile);
-    handle_token:
       switch (token)
        {
        case CPP_LPAREN:
@@ -171,7 +171,7 @@ scan_decls (pfile, argc, argv)
            }
          break;
        case CPP_OTHER:
-         if (CPP_WRITTEN (pfile) == start_written + 1
+         if (CPP_WRITTEN (pfile) == (size_t) start_written + 1
              && (CPP_PWRITTEN (pfile)[-1] == '*'
                  || CPP_PWRITTEN (pfile)[-1] == '&'))
            declarator_start = start_written;
@@ -191,7 +191,9 @@ scan_decls (pfile, argc, argv)
        maybe_handle_comma:
          if (token != CPP_COMMA)
            goto new_statement;
+#if 0
        handle_comma:
+#endif
          /* Handle multiple declarators in a single declaration,
             as in:  extern char *strcpy (), *strcat (), ... ; */
          if (declarator_start == 0)
@@ -225,7 +227,7 @@ scan_decls (pfile, argc, argv)
                    }
                }
              else
-               goto handle_token;
+               continue;
              break;
            }
          /* This may be the name of a variable or function.  */
@@ -234,7 +236,7 @@ scan_decls (pfile, argc, argv)
          break;
 
        case CPP_EOF:
-         return;  /* ??? FIXME */
+         return 0;
 
        case CPP_LBRACE:  case CPP_RBRACE:  case CPP_DIRECTIVE:
          goto new_statement;  /* handle_statement? */
@@ -248,5 +250,8 @@ scan_decls (pfile, argc, argv)
         default:
          prev_id_start = 0;
        }
+
+      start_written = CPP_WRITTEN (pfile);
+      token = cpp_get_token (pfile);
     }
 }