aboutsummaryrefslogtreecommitdiff
path: root/gcc/cpplib.h
diff options
context:
space:
mode:
authorZack Weinberg <zack@rabi.columbia.edu>1999-03-15 18:42:46 +0000
committerZack Weinberg <zack@gcc.gnu.org>1999-03-15 18:42:46 +0000
commit0b22d65c9a10ce316cb28c4c4a988cb3ccc73785 (patch)
treef623648ee905a401d8832cf9a4d6cb970ff07507 /gcc/cpplib.h
parent56dc4d15c417a62c298d31654d1be448b49c364a (diff)
downloadgcc-0b22d65c9a10ce316cb28c4c4a988cb3ccc73785.zip
gcc-0b22d65c9a10ce316cb28c4c4a988cb3ccc73785.tar.gz
gcc-0b22d65c9a10ce316cb28c4c4a988cb3ccc73785.tar.bz2
cppinit.c: Instead of one pending list...
1999-03-15 21:39 -0500 Zack Weinberg <zack@rabi.columbia.edu> * cppinit.c: Instead of one pending list, keep separate lists for each category of pending option: -D/-U, -A, -include, -imacros. Move the four partial include-path lists into the pending block. Use head and tail pointers so we don't ever have to reverse the lists. (cpp_start_read): Break out blocks of code to their own functions: install_predefs and initialize_dependency_output. Use path_include for C_INCLUDE_PATH and friends as well as CPATH. Remove include_defaults gunk. Warn about the combination of -lang-chill and -trigraphs. Optimize string bashing. Walk each pending list once, deallocating as we go. (append_include_chain): Brought over from cppfiles.c. Mark dirs as system include dirs if and only if appending to system include path. If opts->verbose, print a notice when a dir is dropped from the include path because it doesn't exist. Fix memory leak: this function is not supposed to copy its DIR argument. (nreverse_pending, push_pending): Removed. (APPEND): New macro for adding to pending lists. (path_include): Can now add to any partial include path. (base_name): Bring over from cccp.c. (cpp_options_init): Allocate the pending block. (cpp_handle_option): Add --version. Exit after --help. Fix formatting. Order -ifoo options by frequency of usage. (install_predefs): New function, simplified version of code that was in cpp_start_read. (initialize_dependency_output): Likewise. Understand OBJECT_SUFFIX. * cppfiles.c (simplify_pathname): Export. (merge_include_chains): Don't nreverse the lists. If opts->verbose, print a notice when a duplicate dir is detected and dropped from the include path. (finclude): Fix excessive cleverness in setting fp->system_header_p. (actual_directory): Set x->sysp from CPP_BUFFER (pfile)->system_header_p so that one system header may include another with "". (deps_output): Fix double adjustment of deps_size which would cause all dependencies after the first two lines to be lost. * cpplib.c (cpp_unassert): New function. * cpplib.h: Lay out struct cpp_pending here. Adjust prototypes. Add include_prefix_len to struct cpp_options. From-SVN: r25793
Diffstat (limited to 'gcc/cpplib.h')
-rw-r--r--gcc/cpplib.h36
1 files changed, 25 insertions, 11 deletions
diff --git a/gcc/cpplib.h b/gcc/cpplib.h
index 895aa87..e2bb414 100644
--- a/gcc/cpplib.h
+++ b/gcc/cpplib.h
@@ -145,7 +145,6 @@ struct cpp_buffer
char has_escapes;
};
-struct cpp_pending; /* Forward declaration - for C++. */
struct file_name_map_list;
/* Maximum nesting of cpp_buffers. We use a static limit, partly for
@@ -297,6 +296,24 @@ struct cpp_reader
/* The bottom of the buffer stack. */
#define CPP_NULL_BUFFER(PFILE) NULL
+/* The `pending' structure accumulates all the options that are not
+ actually processed until we hit cpp_start_read. It consists of
+ several lists, one for each type of option. We keep both head and
+ tail pointers for quick insertion. */
+struct cpp_pending
+{
+ struct pending_option *define_head, *define_tail;
+ struct pending_option *assert_head, *assert_tail;
+
+ struct file_name_list *quote_head, *quote_tail;
+ struct file_name_list *brack_head, *brack_tail;
+ struct file_name_list *systm_head, *systm_tail;
+ struct file_name_list *after_head, *after_tail;
+
+ struct pending_option *imacros_head, *imacros_tail;
+ struct pending_option *include_head, *include_tail;
+};
+
/* Pointed to by cpp_reader.opts. */
struct cpp_options {
char *in_fname;
@@ -435,16 +452,14 @@ struct cpp_options {
char done_initializing;
- /* Search paths for include files. system_include, after_include are
- only used during option parsing. */
+ /* Search paths for include files. */
struct file_name_list *quote_include; /* First dir to search for "file" */
struct file_name_list *bracket_include;/* First dir to search for <file> */
- struct file_name_list *system_include; /* First dir with system headers */
- struct file_name_list *after_include; /* Headers to search after system */
- /* Directory prefix that should replace `/usr' in the standard
- include file directories. */
+ /* Directory prefix that should replace `/usr/lib/gcc-lib/TARGET/VERSION'
+ in the standard include file directories. */
char *include_prefix;
+ int include_prefix_len;
char inhibit_predefs;
char no_standard_includes;
@@ -472,7 +487,7 @@ struct cpp_options {
even if they are ifdefed out. */
int dump_includes;
- /* Pending -D, -U and -A options, in reverse order. */
+ /* Pending options - -D, -U, -A, -I, -ixxx. */
struct cpp_pending *pending;
/* File name which deps are being written to.
@@ -671,6 +686,7 @@ extern cpp_buffer* cpp_file_buffer PARAMS((cpp_reader *));
extern void cpp_define PARAMS ((cpp_reader *, unsigned char *));
extern void cpp_assert PARAMS ((cpp_reader *, unsigned char *));
extern void cpp_undef PARAMS ((cpp_reader *, unsigned char *));
+extern void cpp_unassert PARAMS ((cpp_reader *, unsigned char *));
extern void cpp_error PVPROTO ((cpp_reader *, const char *, ...))
ATTRIBUTE_PRINTF_2;
@@ -728,9 +744,7 @@ extern void cpp_print_containing_files PROTO ((cpp_reader *));
extern void cpp_notice PVPROTO ((const char *msgid, ...)) ATTRIBUTE_PRINTF_1;
/* In cppfiles.c */
-extern void append_include_chain PROTO ((cpp_reader *,
- struct file_name_list **,
- const char *, int));
+extern void simplify_pathname PROTO ((char *));
extern void merge_include_chains PROTO ((struct cpp_options *));
extern int find_include_file PROTO ((cpp_reader *, char *,
struct file_name_list *,