diff options
author | Zack Weinberg <zack@wolery.cumb.org> | 2000-03-07 20:58:47 +0000 |
---|---|---|
committer | Zack Weinberg <zack@gcc.gnu.org> | 2000-03-07 20:58:47 +0000 |
commit | b0699daddf1eead3861e67808ac915f21f82dcf3 (patch) | |
tree | 1a0ac2a2bf6f6751175dddcf0bf7464c1266fe1a /gcc/cppfiles.c | |
parent | 79e69af0254238d0b5fa1940c5f7ecfce9e11bcd (diff) | |
download | gcc-b0699daddf1eead3861e67808ac915f21f82dcf3.zip gcc-b0699daddf1eead3861e67808ac915f21f82dcf3.tar.gz gcc-b0699daddf1eead3861e67808ac915f21f82dcf3.tar.bz2 |
cppfiles.c (_cpp_find_include_file): Make sure ih->name is initialized.
* cppfiles.c (_cpp_find_include_file): Make sure ih->name is
initialized.
* cppinit.c (cpp_cleanup): Free imp->nshort also.
* cpperror.c (cpp_print_containing_files,
cpp_print_file_and_line, v_cpp_message): Rename to
print_containing_files, print_file_and_line, and v_message.
* cppexp.c (cpp_parse_expr, cpp_parse_escape, cpp_lex): Rename
to _cpp_parse_expr, parse_escape, and lex.
(parse_charconst): Remove broken multibyte support.
* cppfiles.c (include_hash): Make static.
(cpp_included): New function.
(merge_include_chains, find_include_file, finclude,
simplify_pathname): Rename to _cpp_merge_include_chains,
_cpp_find_include_file, _cpp_read_include_file, and
_cpp_simplify_pathname.
* cpphash.c (cpp_lookup, free_definition, delete_macro,
cpp_install, create_definition, macroexpand, compare_defs,
dump_definition): Rename to _cpp_lookup, _cpp_free_definition,
_cpp_delete_macro, _cpp_install, _cpp_create_definition,
_cpp_macroexpand, _cpp_compare_defs, and _cpp_dump_definition.
* cppinit.c (cpp_handle_option): Rename to handle_option, make
static.
* cpplib.c: Remove extern prototype of cpp_parse_expr.
* cpphash.h: Update prototypes.
* cpplib.h: Likewise. Prototype _cpp_parse_expr here.
From-SVN: r32390
Diffstat (limited to 'gcc/cppfiles.c')
-rw-r--r-- | gcc/cppfiles.c | 44 |
1 files changed, 28 insertions, 16 deletions
diff --git a/gcc/cppfiles.c b/gcc/cppfiles.c index d8d518d..dc56b24 100644 --- a/gcc/cppfiles.c +++ b/gcc/cppfiles.c @@ -29,11 +29,8 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "cpplib.h" #include "intl.h" -/* The entry points to this file are: find_include_file, - cpp_read_file, finclude, include_hash, append_include_chain, and - file_cleanup. file_cleanup is only called through - CPP_BUFFER(pfile)->cleanup, so it's static anyway. */ - +static struct include_hash *include_hash PARAMS ((cpp_reader *, + const char *, int)); static struct include_hash *redundant_include_p PARAMS ((cpp_reader *, struct include_hash *, @@ -83,7 +80,7 @@ static void hack_vms_include_specification PARAMS ((char *)); how?) and possibly preload the include hash. */ void -merge_include_chains (opts) +_cpp_merge_include_chains (opts) struct cpp_options *opts; { struct file_name_list *prev, *cur, *other; @@ -208,7 +205,7 @@ merge_include_chains (opts) #include name (there are at least three ways this can happen). The hash function could probably be improved a bit. */ -struct include_hash * +static struct include_hash * include_hash (pfile, fname, add) cpp_reader *pfile; const char *fname; @@ -293,6 +290,19 @@ redundant_include_p (pfile, ihash, ilist) return 0; } +/* Return 1 if the file named by FNAME has been included before in + any context, 0 otherwise. */ +int +cpp_included (pfile, fname) + cpp_reader *pfile; + const char *fname; +{ + struct include_hash *ptr; + + ptr = include_hash (pfile, fname, 0); + return (ptr != NULL); +} + static int file_cleanup (pbuf, pfile) cpp_buffer *pbuf; @@ -316,7 +326,7 @@ file_cleanup (pbuf, pfile) *BEFORE is 1 if the file was included before (but needs to be read again). */ int -find_include_file (pfile, fname, search_start, ihash, before) +_cpp_find_include_file (pfile, fname, search_start, ihash, before) cpp_reader *pfile; const char *fname; struct file_name_list *search_start; @@ -362,6 +372,7 @@ find_include_file (pfile, fname, search_start, ihash, before) } *before = 0; *ihash = ih; + ih->name = NULL; ih->nshort = xstrdup (fname); ih->control_macro = NULL; @@ -383,7 +394,7 @@ find_include_file (pfile, fname, search_start, ihash, before) bcopy (l->name, name, l->nlen); name[l->nlen] = '/'; strcpy (&name[l->nlen+1], fname); - simplify_pathname (name); + _cpp_simplify_pathname (name); if (CPP_OPTIONS (pfile)->remap) name = remap_filename (pfile, name, l); @@ -626,10 +637,11 @@ cpp_read_file (pfile, fname) } /* Open the file in nonblocking mode, so we don't get stuck if - someone clever has asked cpp to process /dev/rmt0. finclude() - will check that we have a real file to work with. Also take - care not to acquire a controlling terminal by mistake (this can't - happen on sane systems, but paranoia is a virtue). */ + someone clever has asked cpp to process /dev/rmt0. + _cpp_read_include_file will check that we have a real file to + work with. Also take care not to acquire a controlling terminal + by mistake (this can't happen on sane systems, but paranoia is a + virtue). */ else if ((f = open (fname, O_RDONLY|O_NONBLOCK|O_NOCTTY, 0666)) < 0) { cpp_notice_from_errno (pfile, fname); @@ -651,7 +663,7 @@ cpp_read_file (pfile, fname) ih_fake->control_macro = 0; ih_fake->buf = (char *)-1; ih_fake->limit = 0; - if (!finclude (pfile, f, ih_fake)) + if (!_cpp_read_include_file (pfile, f, ih_fake)) goto failed_finclude; return 1; @@ -672,7 +684,7 @@ cpp_read_file (pfile, fname) The caller is responsible for the cpp_push_buffer. */ int -finclude (pfile, fd, ihash) +_cpp_read_include_file (pfile, fd, ihash) cpp_reader *pfile; int fd; struct include_hash *ihash; @@ -1245,7 +1257,7 @@ initialize_input_buffer (pfile, fd, st) of the string. */ void -simplify_pathname (path) +_cpp_simplify_pathname (path) char *path; { char *from, *to; |