Commit e56e519d by Dave Brolley Committed by Jeff Law

c-lex.c (finput): New global.

        * c-lex.c (finput): New global.
        (init_parse): Always included.  Handle !USE_CPPLIB using
        code originally in compile_file.
        (finish_parse): Update for CPPLIB.
        * toplev.c (init_parse, finish_parse): Declare.
        (finput): Delete variable.  Now in front-ends.
        (compile_file): Remove code which is now handled by init_parse
        which is unconditionally called.  Similarly for finish_parse.

From-SVN: r19063
parent 62db76ee
Thu Apr 9 00:18:44 1998 Dave Brolley (brolley@cygnus.com)
* c-lex.c (finput): New global.
(init_parse): Always included. Handle !USE_CPPLIB using
code originally in compile_file.
(finish_parse): Update for CPPLIB.
* toplev.c (init_parse, finish_parse): Declare.
(finput): Delete variable. Now in front-ends.
(compile_file): Remove code which is now handled by init_parse
which is unconditionally called. Similarly for finish_parse.
Wed Apr 8 23:13:50 1998 Gavin Koch <gavin@cygnus.com> Wed Apr 8 23:13:50 1998 Gavin Koch <gavin@cygnus.com>
* config/mips/r3900.h (ASM_OUTPUT_DEF,SUPPORTS_WEAK, * config/mips/r3900.h (ASM_OUTPUT_DEF,SUPPORTS_WEAK,
......
...@@ -47,6 +47,9 @@ Boston, MA 02111-1307, USA. */ ...@@ -47,6 +47,9 @@ Boston, MA 02111-1307, USA. */
cpp_reader parse_in; cpp_reader parse_in;
cpp_options parse_options; cpp_options parse_options;
static enum cpp_token cpp_token; static enum cpp_token cpp_token;
#else
/* Stream for reading from the input file. */
FILE *finput;
#endif #endif
/* The elements of `ridpointers' are identifier nodes /* The elements of `ridpointers' are identifier nodes
...@@ -182,12 +185,30 @@ remember_protocol_qualifiers () ...@@ -182,12 +185,30 @@ remember_protocol_qualifiers ()
wordlist[i].name = "oneway"; wordlist[i].name = "oneway";
} }
#if USE_CPPLIB
void void
init_parse (filename) init_parse (filename)
char *filename; char *filename;
{ {
#if !USE_CPPLIB
/* Open input file. */
if (filename == 0 || !strcmp (filename, "-"))
{
finput = stdin;
filename = "stdin";
}
else
finput = fopen (filename, "r");
if (finput == 0)
pfatal_with_name (filename);
#ifdef IO_BUFFER_SIZE
setvbuf (finput, (char *) xmalloc (IO_BUFFER_SIZE), _IOFBF, IO_BUFFER_SIZE);
#endif
#endif /* !USE_CPPLIB */
init_lex (); init_lex ();
#if USE_CPPLIB
yy_cur = "\n"; yy_cur = "\n";
yy_lim = yy_cur+1; yy_lim = yy_cur+1;
...@@ -198,14 +219,18 @@ init_parse (filename) ...@@ -198,14 +219,18 @@ init_parse (filename)
parse_in.show_column = 1; parse_in.show_column = 1;
if (! cpp_start_read (&parse_in, filename)) if (! cpp_start_read (&parse_in, filename))
abort (); abort ();
#endif
} }
void void
finish_parse () finish_parse ()
{ {
#if USE_CPPLIB
cpp_finish (&parse_in); cpp_finish (&parse_in);
} #else
fclose (finput);
#endif #endif
}
void void
init_lex () init_lex ()
......
...@@ -132,6 +132,8 @@ extern int size_directive_output; ...@@ -132,6 +132,8 @@ extern int size_directive_output;
extern tree last_assemble_variable_decl; extern tree last_assemble_variable_decl;
extern void init_lex (); extern void init_lex ();
extern void init_parse PVPROTO((char *));
extern void finish_parse ();
extern void init_decl_processing (); extern void init_decl_processing ();
extern void init_obstacks (); extern void init_obstacks ();
extern void init_tree_codes (); extern void init_tree_codes ();
...@@ -200,11 +202,6 @@ char *input_filename; ...@@ -200,11 +202,6 @@ char *input_filename;
char *main_input_filename; char *main_input_filename;
#if !USE_CPPLIB
/* Stream for reading from the input file. */
FILE *finput;
#endif
/* Current line number in real source file. */ /* Current line number in real source file. */
int lineno; int lineno;
...@@ -2273,33 +2270,11 @@ compile_file (name) ...@@ -2273,33 +2270,11 @@ compile_file (name)
symout_time = 0; symout_time = 0;
dump_time = 0; dump_time = 0;
#if !USE_CPPLIB
/* Open input file. */
if (name == 0 || !strcmp (name, "-"))
{
finput = stdin;
name = "stdin";
}
else
finput = fopen (name, "r");
if (finput == 0)
pfatal_with_name (name);
#ifdef IO_BUFFER_SIZE
setvbuf (finput, (char *) xmalloc (IO_BUFFER_SIZE), _IOFBF, IO_BUFFER_SIZE);
#endif
#endif /* !USE_CPPLIB */
/* Initialize data in various passes. */ /* Initialize data in various passes. */
init_obstacks (); init_obstacks ();
init_tree_codes (); init_tree_codes ();
#if USE_CPPLIB
init_parse (name); init_parse (name);
#else
init_lex ();
#endif
init_rtl (); init_rtl ();
init_emit_once (debug_info_level == DINFO_LEVEL_NORMAL init_emit_once (debug_info_level == DINFO_LEVEL_NORMAL
|| debug_info_level == DINFO_LEVEL_VERBOSE || debug_info_level == DINFO_LEVEL_VERBOSE
...@@ -2827,11 +2802,8 @@ compile_file (name) ...@@ -2827,11 +2802,8 @@ compile_file (name)
whether fclose returns an error, since the pages might still be on the whether fclose returns an error, since the pages might still be on the
buffer chain while the file is open. */ buffer chain while the file is open. */
#if USE_CPPLIB
finish_parse (); finish_parse ();
#else
fclose (finput);
#endif
if (ferror (asm_out_file) != 0 || fclose (asm_out_file) != 0) if (ferror (asm_out_file) != 0 || fclose (asm_out_file) != 0)
fatal_io_error (asm_file_name); fatal_io_error (asm_file_name);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment