diff options
Diffstat (limited to 'contrib/gcc/scan-decls.c')
| -rw-r--r-- | contrib/gcc/scan-decls.c | 32 | 
1 files changed, 17 insertions, 15 deletions
diff --git a/contrib/gcc/scan-decls.c b/contrib/gcc/scan-decls.c index e8309b813ece..d2f32a86cf91 100644 --- a/contrib/gcc/scan-decls.c +++ b/contrib/gcc/scan-decls.c @@ -1,5 +1,5 @@  /* scan-decls.c - Extracts declarations from cpp output. -   Copyright (C) 1993, 1995 Free Software Foundation, Inc. +   Copyright (C) 1993, 1995, 1997, 1998 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,11 @@ 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 "gansidecl.h"  #include "cpplib.h" +#include "scan.h"  int brace_nesting = 0; @@ -78,19 +79,20 @@ int  scan_decls (pfile, argc, argv)       cpp_reader *pfile;       int argc; -     char**argv; +     char **argv;  {    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. */ +     decl-specs, or prev_id_start marks the start of the declarator.  */    int declarator_start;    int prev_id_start, prev_id_end;    enum cpp_token token;   new_statement:    CPP_SET_WRITTEN (pfile, 0); +  start_written = 0;    token = cpp_get_token (pfile);   handle_statement: @@ -122,13 +124,10 @@ 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: -	  /* Looks like this is the start of a formal parameter list. */ +	  /* Looks like this is the start of a formal parameter list.  */  	  if (prev_id_start)  	    {  	      int nesting = 1; @@ -187,7 +186,7 @@ scan_decls (pfile, argc, argv)  				 pfile->token_buffer,  				 prev_id_start);  	    } -	  /* ... fall through ... */ +	  /* ... fall through ...  */  	maybe_handle_comma:  	  if (token != CPP_COMMA)  	    goto new_statement; @@ -225,22 +224,22 @@ scan_decls (pfile, argc, argv)  		    }  		}  	      else -		goto handle_token; +		continue;  	      break;  	    } -	  /* This may be the name of a variable or function. */ +	  /* This may be the name of a variable or function.  */  	  prev_id_start = start_written;  	  prev_id_end = CPP_WRITTEN (pfile);  	  break;  	case CPP_EOF: -	  return;  /* ??? FIXME */ +	  return 0;  	case CPP_LBRACE:  case CPP_RBRACE:  case CPP_DIRECTIVE:  	  goto new_statement;  /* handle_statement? */  	case CPP_HSPACE:  case CPP_VSPACE:  case CPP_COMMENT:  case CPP_POP: -	  /* Skip initial white space. */ +	  /* Skip initial white space.  */  	  if (start_written == 0)  	    CPP_SET_WRITTEN (pfile, 0);  	  break; @@ -248,5 +247,8 @@ scan_decls (pfile, argc, argv)  	 default:  	  prev_id_start = 0;  	} + +      start_written = CPP_WRITTEN (pfile); +      token = cpp_get_token (pfile);      }  }  | 
