This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

cpplib: Minor cleanup and comment update.


Committed as obvious.

Neil.

	* cpplex.c: Update TODO comment.
	* cpplib.c (do_error, do_warning): Merge common code of
	do_error and do_warning	into do_diagnostic.  Use it.
	(do_diagnostic): New function.
	* cpplib.h: Fix comment typo.

Index: cpplex.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cpplex.c,v
retrieving revision 1.100
diff -c -p -r1.100 cpplex.c
*** cpplex.c	2000/09/23 21:41:40	1.100
--- cpplex.c	2000/09/24 10:36:25
*************** Foundation, 59 Temple Place - Suite 330,
*** 24,35 ****
  
  Cleanups to do:-
  
- o Check line numbers assigned to all errors.
  o Distinguish integers, floats, and 'other' pp-numbers.
  o Store ints and char constants as binary values.
  o New command-line assertion syntax.
- o Work towards functions in cpperror.c taking a message level parameter.
-   If we do this, merge the common code of do_warning and do_error.
  o Comment all functions, and describe macro expansion algorithm.
  o Move as much out of header files as possible.
  o Remove single quote pairs `', and some '', from diagnostics.
--- 24,32 ----
Index: cpplib.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cpplib.c,v
retrieving revision 1.204
diff -c -p -r1.204 cpplib.c
*** cpplib.c	2000/09/23 21:41:41	1.204
--- cpplib.c	2000/09/24 10:36:29
*************** static void push_conditional	PARAMS ((cp
*** 52,58 ****
  static int  read_line_number	PARAMS ((cpp_reader *, int *));
  static int  strtoul_for_line	PARAMS ((const U_CHAR *, unsigned int,
  					 unsigned long *));
! 
  static const cpp_hashnode *
  	    parse_ifdef		PARAMS ((cpp_reader *, const U_CHAR *));
  static const cpp_hashnode *
--- 52,58 ----
  static int  read_line_number	PARAMS ((cpp_reader *, int *));
  static int  strtoul_for_line	PARAMS ((const U_CHAR *, unsigned int,
  					 unsigned long *));
! static void do_diagnostic	PARAMS ((cpp_reader *, enum error_type));
  static const cpp_hashnode *
  	    parse_ifdef		PARAMS ((cpp_reader *, const U_CHAR *));
  static const cpp_hashnode *
*************** do_line (pfile)
*** 583,598 ****
  }
  
  /*
!  * Report an error detected by the program we are processing.
!  * Use the text of the line in the error message.
!  * (We use error because it prints the filename & line#.)
   */
  
  static void
! do_error (pfile)
       cpp_reader *pfile;
  {
!   if (_cpp_begin_message (pfile, ERROR, NULL, 0, 0))
      {
        cpp_output_list (pfile, stderr, &pfile->token_list,
  		       pfile->first_directive_token);
--- 583,598 ----
  }
  
  /*
!  * Report a warning or error detected by the program we are
!  * processing.  Use the directive's tokens in the error message.
   */
  
  static void
! do_diagnostic (pfile, code)
       cpp_reader *pfile;
+      enum error_type code;
  {
!   if (_cpp_begin_message (pfile, code, NULL, 0, 0))
      {
        cpp_output_list (pfile, stderr, &pfile->token_list,
  		       pfile->first_directive_token);
*************** do_error (pfile)
*** 600,620 ****
      }
  }
  
! /*
!  * Report a warning detected by the program we are processing.
!  * Use the text of the line in the warning message, then continue.
!  */
  
  static void
  do_warning (pfile)
       cpp_reader *pfile;
  {
!   if (_cpp_begin_message (pfile, WARNING, NULL, 0, 0))
!     {
!       cpp_output_list (pfile, stderr, &pfile->token_list,
! 		       pfile->first_directive_token);
!       putc ('\n', stderr);
!     }
  }
  
  /* Report program identification.  */
--- 600,617 ----
      }
  }
  
! static void
! do_error (pfile)
!      cpp_reader *pfile;
! {
!   do_diagnostic (pfile, ERROR);
! }
  
  static void
  do_warning (pfile)
       cpp_reader *pfile;
  {
!   do_diagnostic (pfile, WARNING);
  }
  
  /* Report program identification.  */
Index: cpplib.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cpplib.h,v
retrieving revision 1.123
diff -c -p -r1.123 cpplib.h
*** cpplib.h	2000/09/23 21:41:41	1.123
--- cpplib.h	2000/09/24 10:36:31
*************** struct lexer_state
*** 457,463 ****
       all directives apart from #define.  */
    unsigned char save_comments;
  
!   /* Nonzero to get force the lexer to skip newlines.  */
    unsigned char skip_newlines;
  
    /* Nonzero if we're in the subroutine lex_line.  */
--- 457,463 ----
       all directives apart from #define.  */
    unsigned char save_comments;
  
!   /* Nonzero to force the lexer to skip newlines.  */
    unsigned char skip_newlines;
  
    /* Nonzero if we're in the subroutine lex_line.  */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]