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]

Convert C front-ends to work with abstract cpp_reader


Committed as obvious.

Neil.

	* c-lex.c (init_c_lex): Use cpp_get_callbacks to set
	callbacks.
	* c-parse.in (finish_parse): Use cpp_errors.
	(__yylex): Use return value of cpp_pop_buffer.
	* cp/lex.c (finish_parse): Use cpp_errors.
	* cp/spew.c (read_token): Use return value of cpp_pop_buffer.

Index: c-lex.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-lex.c,v
retrieving revision 1.126
diff -u -p -r1.126 c-lex.c
--- c-lex.c	2001/01/07 03:25:06	1.126
+++ c-lex.c	2001/01/13 14:08:42
@@ -99,6 +99,7 @@ const char *
 init_c_lex (filename)
      const char *filename;
 {
+  struct cpp_callbacks *cb;
   struct c_fileinfo *toplevel;
 
   orig_filename = filename;
@@ -121,16 +122,18 @@ init_c_lex (filename)
   GET_ENVIRONMENT (literal_codeset, "LANG");
 #endif
 
-  parse_in->cb.ident = cb_ident;
-  parse_in->cb.file_change = cb_file_change;
-  parse_in->cb.def_pragma = cb_def_pragma;
+  cb = cpp_get_callbacks (parse_in);
 
+  cb->ident = cb_ident;
+  cb->file_change = cb_file_change;
+  cb->def_pragma = cb_def_pragma;
+
   /* Set the debug callbacks if we can use them.  */
   if (debug_info_level == DINFO_LEVEL_VERBOSE
       && (write_symbols == DWARF_DEBUG || write_symbols == DWARF2_DEBUG))
     {
-      parse_in->cb.define = cb_define;
-      parse_in->cb.undef = cb_undef;
+      cb->define = cb_define;
+      cb->undef = cb_undef;
     }
 
   if (filename == 0 || !strcmp (filename, "-"))
Index: c-parse.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-parse.in,v
retrieving revision 1.77
diff -u -p -r1.77 c-parse.in
--- c-parse.in	2001/01/02 23:49:43	1.77
+++ c-parse.in	2001/01/13 14:08:55
@@ -3161,7 +3161,7 @@ void
 finish_parse ()
 {
   cpp_finish (parse_in);
-  errorcount += parse_in->errors;
+  errorcount += cpp_errors (parse_in);
 }
 
 #define NAME(type) cpp_type2name (type)
@@ -3257,8 +3257,7 @@ _yylex ()
     case CPP_DOT:					return '.';
 
     case CPP_EOF:
-      cpp_pop_buffer (parse_in);
-      if (! CPP_BUFFER (parse_in))
+      if (cpp_pop_buffer (parse_in) == 0)
 	return 0;
       goto retry;
 
Index: cp/lex.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/lex.c,v
retrieving revision 1.233
diff -u -p -r1.233 lex.c
--- lex.c	2001/01/10 07:51:10	1.233
+++ lex.c	2001/01/13 14:08:55
@@ -755,7 +755,7 @@ void
 finish_parse ()
 {
   cpp_finish (parse_in);
-  errorcount += parse_in->errors;
+  errorcount += cpp_errors (parse_in);
 }
 
 inline void
Index: cp/spew.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/spew.c,v
retrieving revision 1.42
diff -u -p -r1.42 spew.c
--- spew.c	2001/01/11 12:29:18	1.42
+++ spew.c	2001/01/13 14:08:57
@@ -329,8 +329,7 @@ read_token (t)
 #undef YYCODE
 
     case CPP_EOF:
-      cpp_pop_buffer (parse_in);
-      if (CPP_BUFFER (parse_in))
+      if (cpp_pop_buffer (parse_in) != 0)
 	goto retry;
       t->yychar = 0;
       break;

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