[multiple changes]

1998-10-28 16:10 -0500	Zack Weinberg  <zack@rabi.phys.columbia.edu>
	 * c-lang.c: Declare extern char *yy_cur if USE_CPPLIB.
	   (lang_init): Call check_newline always.
	 * c-lex.c (init_parse) [USE_CPPLIB=1]: After calling
	   cpp_start_read, set yy_cur and yy_lim to read from
	   parse_in.token_buffer, so that we'll see the first #line
	   directive.
	 * cpplib.c (cpp_start_read): finclude the main input file
	   before processing -include/-imacros.	 Process -imacros and
	   -include separately, and handle -include by stacking a
	   buffer for the file in question as if it'd been #included.
	 * toplev.c (documented_lang_options) Recognize -H when
	   USE_CPPLIB is on.
1998-10-28 16:09 -0500	Zack Weinberg  <zack@rabi.phys.columbia.edu>
	 * cpplib.c: Merge do_once into do_pragma.  Break file handling
	   code out of do_include.
	   Move append_include_chain, deps_output,
	   file_cleanup, redundant_include_p, import_hash,
	   lookup_import, add_import, read_filename_string, read_name_map,
	   open_include_file, finclude, safe_read to cppfiles.c.
	   Move prototypes for deps_output, append_include_chain,
	   finclude to cpplib.h.  Move definition of struct
	   file_name_list there also.
	 * cppfiles.c: New file.  Contains all the above functions
	   broken out of cpplib.c; also hack_vms_include_specification
	   from cccp.c and find_include_file, a new function broken out of
	   do_include.
	 * Makefile.in (cppmain): Depend on cppfiles.o.
	   (fix-header): Likewise.
	   (cppfiles.o): New target.
	 * configure.in (--enable-c-cpplib): Add cppfiles.o to
	   extra_c_objs.  Add ../cppfiles.o to extra_cxx_objs.

From-SVN: r23424
This commit is contained in:
Zack Weinberg 1998-10-29 11:54:13 +00:00 committed by Dave Brolley
parent 0fc1434bd0
commit add7091b5b
8 changed files with 1285 additions and 925 deletions

View File

@ -86,6 +86,44 @@ Wed Oct 28 16:46:07 1998 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
(purge_addressof_replacements): New variable.
(purge_addressof): Clear it at end.
1998-10-28 16:10 -0500 Zack Weinberg <zack@rabi.phys.columbia.edu>
* c-lang.c: Declare extern char *yy_cur if USE_CPPLIB.
(lang_init): Call check_newline always.
* c-lex.c (init_parse) [USE_CPPLIB=1]: After calling
cpp_start_read, set yy_cur and yy_lim to read from
parse_in.token_buffer, so that we'll see the first #line
directive.
* cpplib.c (cpp_start_read): finclude the main input file
before processing -include/-imacros. Process -imacros and
-include separately, and handle -include by stacking a
buffer for the file in question as if it'd been #included.
* toplev.c (documented_lang_options) Recognize -H when
USE_CPPLIB is on.
1998-10-28 16:09 -0500 Zack Weinberg <zack@rabi.phys.columbia.edu>
* cpplib.c: Merge do_once into do_pragma. Break file handling
code out of do_include.
Move append_include_chain, deps_output,
file_cleanup, redundant_include_p, import_hash,
lookup_import, add_import, read_filename_string, read_name_map,
open_include_file, finclude, safe_read to cppfiles.c.
Move prototypes for deps_output, append_include_chain,
finclude to cpplib.h. Move definition of struct
file_name_list there also.
* cppfiles.c: New file. Contains all the above functions
broken out of cpplib.c; also hack_vms_include_specification
from cccp.c and find_include_file, a new function broken out of
do_include.
* Makefile.in (cppmain): Depend on cppfiles.o.
(fix-header): Likewise.
(cppfiles.o): New target.
* configure.in (--enable-c-cpplib): Add cppfiles.o to
extra_c_objs. Add ../cppfiles.o to extra_cxx_objs.
Wed Oct 28 14:06:49 1998 Jim Wilson <wilson@cygnus.com>
* dwarfout.c (dwarfout_file_scope_decl): If DECL_CONTEXT, don't abort

View File

@ -1881,7 +1881,7 @@ cccp.o: cccp.c $(CONFIG_H) pcp.h version.c config.status system.h gansidecl.h \
-DTOOL_INCLUDE_DIR=\"$(tooldir)/include\" \
-c `echo $(srcdir)/cccp.c | sed 's,^\./,,'`
LIBCPP_OBJS = cpplib.o cpphash.o cppalloc.o cpperror.o cppexp.o \
LIBCPP_OBJS = cpplib.o cpphash.o cppalloc.o cpperror.o cppexp.o cppfiles.o \
cppulp.o prefix.o version.o mbchar.o @extra_cpp_objs@
libcpp.a: $(LIBCPP_OBJS)
@ -1907,6 +1907,8 @@ cpperror.o: cpperror.c $(CONFIG_H) cpplib.h system.h gansidecl.h
cppexp.o: cppexp.c $(CONFIG_H) cpplib.h system.h gansidecl.h
cppfiles.o: cppfiles.c $(CONFIG_H) cpplib.h system.h gansidecl.h
cpphash.o: cpphash.c cpplib.h cpphash.h $(CONFIG_H) system.h gansidecl.h
cppalloc.o: cppalloc.c $(CONFIG_H) cpplib.h system.h gansidecl.h

View File

@ -28,6 +28,10 @@ Boston, MA 02111-1307, USA. */
#include "toplev.h"
#include "output.h"
#if USE_CPPLIB
extern char *yy_cur;
#endif
/* Each of the functions defined here
is an alternative to a function in objc-actions.c. */
@ -47,12 +51,15 @@ lang_init_options ()
void
lang_init ()
{
#if !USE_CPPLIB
/* the beginning of the file is a new line; check for # */
/* With luck, we discover the real source file's name from that
and put it in input_filename. */
#if !USE_CPPLIB
ungetc (check_newline (), finput);
#endif
#else
check_newline ();
yy_cur--;
#endif
}
void

View File

@ -194,12 +194,14 @@ init_parse (filename)
init_lex ();
#if USE_CPPLIB
yy_cur = "\n";
yy_lim = yy_cur+1;
parse_in.show_column = 1;
if (! cpp_start_read (&parse_in, filename))
abort ();
/* cpp_start_read always puts at least one line directive into the
token buffer. We must arrange to read it out here. */
yy_cur = parse_in.token_buffer;
yy_lim = CPP_PWRITTEN (&parse_in);
#endif
return filename;

1023
gcc/cppfiles.c Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -510,6 +510,27 @@ struct cpp_options {
#define CPP_PEDANTIC(PFILE) (CPP_OPTIONS (PFILE)->pedantic)
#define CPP_PRINT_DEPS(PFILE) (CPP_OPTIONS (PFILE)->print_deps)
struct file_name_list
{
struct file_name_list *next;
char *fname;
/* If the following is nonzero, it is a macro name.
Don't include the file again if that macro is defined. */
U_CHAR *control_macro;
/* If the following is nonzero, it is a C-language system include
directory. */
int c_system_include_path;
/* Mapping of file names for this directory. */
struct file_name_map *name_map;
/* Non-zero if name_map is valid. */
int got_name_map;
};
/* If a buffer's dir field is SELF_DIR_DUMMY, it means the file was found
via the same directory as the file that #included it. */
#define SELF_DIR_DUMMY ((struct file_name_list *) (~0))
/* Name under which this program was invoked. */
extern char *progname;
@ -623,6 +644,8 @@ struct definition {
};
extern unsigned char is_idchar[256];
extern unsigned char is_hor_space[256];
extern unsigned char is_space[256];
/* Stack of conditionals currently in progress
(including both successful and failing conditionals). */
@ -685,6 +708,25 @@ extern void cpp_pfatal_with_name PROTO ((cpp_reader *, const char *));
extern void cpp_file_line_for_message PROTO ((cpp_reader *, char *, int, int));
extern void cpp_print_containing_files PROTO ((cpp_reader *));
/* In cppfiles.c */
extern void append_include_chain PROTO ((cpp_reader *,
struct file_name_list *,
struct file_name_list *));
extern int finclude PROTO ((cpp_reader *, int, char *,
int, struct file_name_list *));
extern int find_include_file PROTO ((cpp_reader *, char *,
unsigned long, char *, int,
struct file_name_list *,
struct file_name_list **));
extern void deps_output PROTO ((cpp_reader *, char *, int));
/* Bleargh. */
extern char *savestring PROTO ((char *));
#ifndef INCLUDE_LEN_FUDGE
#define INCLUDE_LEN_FUDGE 0
#endif
#ifdef __cplusplus
}
#endif

View File

@ -1058,6 +1058,7 @@ documented_lang_options[] =
{ "-D", "" },
{ "-I", "" },
{ "-U", "" },
{ "-H", "" },
{ "-idirafter", "" },
{ "-imacros", "" },
{ "-include", "" },