diff options
author | Zack Weinberg <zack@wolery.cumb.org> | 2000-03-08 23:35:19 +0000 |
---|---|---|
committer | Zack Weinberg <zack@gcc.gnu.org> | 2000-03-08 23:35:19 +0000 |
commit | 88ae23e71dffcd197fc5410a582a470fcbcc2ba9 (patch) | |
tree | d22a67043ad8f0cb553637f8f1774978410ad8d9 /gcc/cppfiles.c | |
parent | 737faf1404678b40cb1f5dcf2ca816d2872fb347 (diff) | |
download | gcc-88ae23e71dffcd197fc5410a582a470fcbcc2ba9.zip gcc-88ae23e71dffcd197fc5410a582a470fcbcc2ba9.tar.gz gcc-88ae23e71dffcd197fc5410a582a470fcbcc2ba9.tar.bz2 |
Makefile.in (LIBCPP_DEPS): New macro.
* Makefile.in (LIBCPP_DEPS): New macro.
(cpplib.o, cpphash.o, cpperror.o, cppexp.o, cppfiles.o): Use
it to declare deps.
* cpperror.c: Include cpphash.h.
* cppexp.c: Include cpphash.h. Remove MULTIBYTE_CHARS
dingleberry.
(lex): Don't use CPP_WARN_UNDEF.
(_cpp_parse_expr): Return an int, the truth value.
* cppfiles.c: Include cpphash.h.
(_cpp_merge_include_chains): Move to cppinit.c and make static.
* cppinit.c (include_defaults_array): Disentangle.
(cpp_cleanup): Don't free the if stack here.
(cpp_finish): Pop off all buffers, not just one.
* cpplib.c (eval_if_expr): Return int.
(do_xifdef): Rename do_ifdef.
(handle_directive): Don't use CPP_PREPROCESSED.
(cpp_get_token): Don't use CPP_C89.
* fix-header.c: Don't use CPP_OPTIONS.
* cpplib.h: Move U_CHAR, enum node_type, struct
file_name_list, struct ihash, is_idchar, is_idstart,
is_numchar, is_numstart, is_hspace, is_space, CPP_BUF_PEEK,
CPP_BUF_GET, CPP_FORWARD, CPP_PUTS, CPP_PUTS_Q, CPP_PUTC,
CPP_PUTC_Q, CPP_NUL_TERMINATE, CPP_NUL_TERMINATE_Q,
CPP_BUMP_BUFFER_LINE, CPP_BUMP_LINE, CPP_PREV_BUFFER,
CPP_PRINT_DEPS, CPP_TRADITIONAL, CPP_PEDANTIC, and prototypes
of _cpp_simplify_pathname, _cpp_find_include_file,
_cpp_read_include_file, and _cpp_parse_expr to cpphash.h.
Move struct if_stack to cpplib.c. Move struct cpp_pending to
cppinit.c.
Change all uses of U_CHAR to be unsigned char instead.
Delete CPP_WARN_UNDEF, CPP_C89, and CPP_PREPROCESSED.
From-SVN: r32435
Diffstat (limited to 'gcc/cppfiles.c')
-rw-r--r-- | gcc/cppfiles.c | 142 |
1 files changed, 1 insertions, 141 deletions
diff --git a/gcc/cppfiles.c b/gcc/cppfiles.c index f4d2423..43d9bfd 100644 --- a/gcc/cppfiles.c +++ b/gcc/cppfiles.c @@ -27,6 +27,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "config.h" #include "system.h" #include "cpplib.h" +#include "cpphash.h" #include "intl.h" static IHASH *include_hash PARAMS ((cpp_reader *, const char *, int)); @@ -49,151 +50,10 @@ static U_CHAR *find_position PARAMS ((U_CHAR *, U_CHAR *, unsigned long *)); static void hack_vms_include_specification PARAMS ((char *)); #endif -/* Windows does not natively support inodes, and neither does MSDOS. - Cygwin's emulation can generate non-unique inodes, so don't use it. - VMS has non-numeric inodes. */ -#ifdef VMS -#define INO_T_EQ(a, b) (!bcmp((char *) &(a), (char *) &(b), sizeof (a))) -#elif (defined _WIN32 && ! defined (_UWIN)) \ - || defined __MSDOS__ -#define INO_T_EQ(a, b) 0 -#else -#define INO_T_EQ(a, b) ((a) == (b)) -#endif - #ifndef INCLUDE_LEN_FUDGE #define INCLUDE_LEN_FUDGE 0 #endif -/* Merge the four include chains together in the order quote, bracket, - system, after. Remove duplicate dirs (as determined by - INO_T_EQ()). The system_include and after_include chains are never - referred to again after this function; all access is through the - bracket_include path. - - For the future: Check if the directory is empty (but - how?) and possibly preload the include hash. */ - -void -_cpp_merge_include_chains (opts) - struct cpp_options *opts; -{ - struct file_name_list *prev, *cur, *other; - struct file_name_list *quote, *brack, *systm, *after; - struct file_name_list *qtail, *btail, *stail, *atail; - - qtail = opts->pending->quote_tail; - btail = opts->pending->brack_tail; - stail = opts->pending->systm_tail; - atail = opts->pending->after_tail; - - quote = opts->pending->quote_head; - brack = opts->pending->brack_head; - systm = opts->pending->systm_head; - after = opts->pending->after_head; - - /* Paste together bracket, system, and after include chains. */ - if (stail) - stail->next = after; - else - systm = after; - if (btail) - btail->next = systm; - else - brack = systm; - - /* This is a bit tricky. - First we drop dupes from the quote-include list. - Then we drop dupes from the bracket-include list. - Finally, if qtail and brack are the same directory, - we cut out qtail. - - We can't just merge the lists and then uniquify them because - then we may lose directories from the <> search path that should - be there; consider -Ifoo -Ibar -I- -Ifoo -Iquux. It is however - safe to treat -Ibar -Ifoo -I- -Ifoo -Iquux as if written - -Ibar -I- -Ifoo -Iquux. - - Note that this algorithm is quadratic in the number of -I switches, - which is acceptable since there aren't usually that many of them. */ - - for (cur = quote, prev = NULL; cur; cur = cur->next) - { - for (other = quote; other != cur; other = other->next) - if (INO_T_EQ (cur->ino, other->ino) - && cur->dev == other->dev) - { - if (opts->verbose) - fprintf (stderr, _("ignoring duplicate directory `%s'\n"), - cur->name); - - prev->next = cur->next; - free (cur->name); - free (cur); - cur = prev; - break; - } - prev = cur; - } - qtail = prev; - - for (cur = brack; cur; cur = cur->next) - { - for (other = brack; other != cur; other = other->next) - if (INO_T_EQ (cur->ino, other->ino) - && cur->dev == other->dev) - { - if (opts->verbose) - fprintf (stderr, _("ignoring duplicate directory `%s'\n"), - cur->name); - - prev->next = cur->next; - free (cur->name); - free (cur); - cur = prev; - break; - } - prev = cur; - } - - if (quote) - { - if (INO_T_EQ (qtail->ino, brack->ino) && qtail->dev == brack->dev) - { - if (quote == qtail) - { - if (opts->verbose) - fprintf (stderr, _("ignoring duplicate directory `%s'\n"), - quote->name); - - free (quote->name); - free (quote); - quote = brack; - } - else - { - cur = quote; - while (cur->next != qtail) - cur = cur->next; - cur->next = brack; - if (opts->verbose) - fprintf (stderr, _("ignoring duplicate directory `%s'\n"), - qtail->name); - - free (qtail->name); - free (qtail); - } - } - else - qtail->next = brack; - } - else - quote = brack; - - opts->quote_include = quote; - opts->bracket_include = brack; -} - /* Look up or add an entry to the table of all includes. This table is indexed by the name as it appears in the #include line. The ->next_this_file chain stores all different files with the same |