aboutsummaryrefslogtreecommitdiff
path: root/gcc/cpplib.h
diff options
context:
space:
mode:
authorNeil Booth <neil@daikokuya.co.uk>2003-03-01 14:31:21 +0000
committerNeil Booth <neil@gcc.gnu.org>2003-03-01 14:31:21 +0000
commit5793b27668ae1b63e6518f84eab151ad66890eec (patch)
treea780e502dea6f5dd1bc734c51de06a64223427b4 /gcc/cpplib.h
parent6620997bdc9419cd243613ecb7b958788ab082cc (diff)
downloadgcc-5793b27668ae1b63e6518f84eab151ad66890eec.zip
gcc-5793b27668ae1b63e6518f84eab151ad66890eec.tar.gz
gcc-5793b27668ae1b63e6518f84eab151ad66890eec.tar.bz2
Makefile.in (C_AND_OBJC_OBJS, [...]): Update.
* Makefile.in (C_AND_OBJC_OBJS, c-incpath.o, c-lex.o, LIBCPP_OBJS, cppinit.o, cppdefault.o, fix-header): Update. * c-incpath.c: New file. * c-incpath.h: New file. * c-lex.c: Include c-incpath.h. (init_c_lex): Register path simplifier. * c-opts.c: Include cppdefault.h and c-incpath.h. (TARGET_SYSTEM_ROOT, verbose, iprefix, sysroot, std_inc, std_cxx_inc, quote_chain_split, add_prefixed_path): New. (COMMAND_LINE_OPTIONS): Add more options from cpplib. (missing_arg, c_common_decode_option): Handle them. (c_common_post_options): Register include chains. (print_help): Update. * cppdefault.h (struct default include): Update. Move some macros to ... * cppdefault.c: ... here. (cpp_include_defaults): Add extra field add_sysroot. * cppfiles.c (include_file, search_from, find_or_create_entry, cpp_included, find_include_file, remap_filename): Update for renaming of search_path to cpp_path, and of the chain headers. (remove_component_p, _cpp_simplify_pathname): Move to c-incpath.c. * cpphash.h (struct search_path): Move to cpplib.h. (struct cpp_buffer, struct cpp_reader): Update. (_cpp_simplify_pathname): Remove. * cppinit.c: Don't include prefix.h and cppdefault.h. (INO_T_EQ, INO_T_COPY, path_include, append_include_chain, remove_dup_dir, remove_dup_nonsys_dirs, remove_dup_dirs, init_standard_includes, BRACKET, SYSTEM, AFTER, no_dir, no_pth, cpp_handle_options): Remove. (struct pending_option): Remove chain members. (cpp_destroy, cpp_read_main_file, COMMAND_LINE_OPTIONS, cpp_handle_option): Update. * cpplib.h (struct cpp_path, cpp_set_include_chains): New. (struct cpp_options): Remove quote_include, bracket_include, include_prefix, include_prefix_len, verbose, ignore_srcdir, no_standard_includes, no_standard_cplusplus_includes. (struct cpp_callbacks): Add simplify_path. (cpp_handle_options): Remove. * fix-header.c: Include c-incpath.h. (read_scan_file): Update to use c-incpath functionality. * doc/passes.texi: Update. cp: * Make-lang.in (CXX_C_OBJS): Update. From-SVN: r63612
Diffstat (limited to 'gcc/cpplib.h')
-rw-r--r--gcc/cpplib.h63
1 files changed, 32 insertions, 31 deletions
diff --git a/gcc/cpplib.h b/gcc/cpplib.h
index 3225627..384dd20 100644
--- a/gcc/cpplib.h
+++ b/gcc/cpplib.h
@@ -39,6 +39,7 @@ typedef struct cpp_string cpp_string;
typedef struct cpp_hashnode cpp_hashnode;
typedef struct cpp_macro cpp_macro;
typedef struct cpp_callbacks cpp_callbacks;
+typedef struct cpp_path cpp_path;
struct answer;
struct file_name_map_list;
@@ -224,29 +225,13 @@ struct cpp_options
/* Pending options - -D, -U, -A, -I, -ixxx. */
struct cpp_pending *pending;
- /* Search paths for include files. */
- struct search_path *quote_include; /* "" */
- struct search_path *bracket_include; /* <> */
-
/* Map between header names and file names, used only on DOS where
file names are limited in length. */
struct file_name_map_list *map_list;
- /* Directory prefix that should replace `/usr/lib/gcc-lib/TARGET/VERSION'
- in the standard include file directories. */
- const char *include_prefix;
- unsigned int include_prefix_len;
-
- /* Directory prefix for system include directories in the standard search
- path. */
- const char *sysroot;
-
/* The language we're preprocessing. */
enum c_lang lang;
- /* Non-0 means -v, so print the full set of include dirs. */
- unsigned char verbose;
-
/* Nonzero means use extra default include directories for C++. */
unsigned char cplusplus;
@@ -332,10 +317,6 @@ struct cpp_options
/* Nonzero means don't output line number information. */
unsigned char no_line_commands;
- /* Nonzero means -I- has been seen, so don't look for #include "foo"
- the source-file directory. */
- unsigned char ignore_srcdir;
-
/* Zero means dollar signs are punctuation. */
unsigned char dollars_in_ident;
@@ -358,12 +339,6 @@ struct cpp_options
bother trying to do macro expansion and whatnot. */
unsigned char preprocessed;
- /* Nonzero disables all the standard directories for headers. */
- unsigned char no_standard_includes;
-
- /* Nonzero disables the C++-specific standard directories for headers. */
- unsigned char no_standard_cplusplus_includes;
-
/* Nonzero means dump macros in some fashion - see above. */
unsigned char dump_macros;
@@ -427,6 +402,7 @@ struct cpp_callbacks
void (*undef) PARAMS ((cpp_reader *, unsigned int, cpp_hashnode *));
void (*ident) PARAMS ((cpp_reader *, unsigned int, const cpp_string *));
void (*def_pragma) PARAMS ((cpp_reader *, unsigned int));
+ void (*simplify_path) PARAMS ((char *));
/* Called when the client has a chance to properly register
built-ins with cpp_define() and cpp_assert(). */
void (*register_builtins) PARAMS ((cpp_reader *));
@@ -434,6 +410,30 @@ struct cpp_callbacks
void (*read_pch) PARAMS ((cpp_reader *, const char *, int, const char *));
};
+/* Chain of directories to look for include files in. */
+struct cpp_path
+{
+ /* NULL-terminated singly-linked list. */
+ struct cpp_path *next;
+
+ /* NAME need not be NUL-terminated once inside cpplib. */
+ char *name;
+ unsigned int len;
+
+ /* One if a system header, two if a system header that has extern
+ "C" guards for C++. */
+ unsigned char sysp;
+
+ /* Mapping of file names for this directory for MS-DOS and
+ related platforms. */
+ struct file_name_map *name_map;
+
+ /* The C front end uses these to recognize duplicated
+ directories in the search path. */
+ ino_t ino;
+ dev_t dev;
+};
+
/* Name under which this program was invoked. */
extern const char *progname;
@@ -526,6 +526,10 @@ extern void cpp_add_dependency_target PARAMS ((cpp_reader *,
const char * target,
int quote));
+/* Set the include paths. */
+extern void cpp_set_include_chains PARAMS ((cpp_reader *, cpp_path *,
+ cpp_path *, int));
+
/* Call these to get pointers to the options and callback structures
for a given reader. These pointers are good until you call
cpp_finish on that reader. You can either edit the callbacks
@@ -536,12 +540,9 @@ extern const struct line_maps *cpp_get_line_maps PARAMS ((cpp_reader *));
extern cpp_callbacks *cpp_get_callbacks PARAMS ((cpp_reader *));
extern void cpp_set_callbacks PARAMS ((cpp_reader *, cpp_callbacks *));
-/* Now call cpp_handle_option[s] to handle 1[or more] switches. The
- return value is the number of arguments used. If
- cpp_handle_options returns without using all arguments, it couldn't
- understand the next switch. Options processing is not completed
+/* Now call cpp_handle_option to handle 1 switch. The return value is
+ the number of arguments used. Options processing is not completed
until you call cpp_finish_options. */
-extern int cpp_handle_options PARAMS ((cpp_reader *, int, char **));
extern int cpp_handle_option PARAMS ((cpp_reader *, int, char **));
/* This function reads the file, but does not start preprocessing. It