#include "config.h"#include "system.h"#include "cpplib.h"#include "internal.h"#include "mkdeps.h"#include "hashtab.h"#include "md5.h"#include <dirent.h>

Go to the source code of this file.
| #define set_stdin_to_binary_mode | ( | ) |
| #define STAT_SIZE_RELIABLE | ( | ST | ) | true |
| void _cpp_cleanup_files | ( | cpp_reader * | pfile | ) |
| int _cpp_compare_file_date | ( | cpp_reader * | pfile, | |
| const char * | fname, | |||
| int | angle_brackets | |||
| ) |
| void _cpp_fake_include | ( | cpp_reader * | pfile, | |
| const char * | fname | |||
| ) |
Definition at line 1020 of file files.c.
References _cpp_find_file(), cpp_reader::buffer, _cpp_file::dir, and cpp_buffer::file.
| _cpp_file* _cpp_find_file | ( | cpp_reader * | pfile, | |
| const char * | fname, | |||
| cpp_dir * | start_dir, | |||
| bool | fake | |||
| ) |
Definition at line 393 of file files.c.
References cpp_reader::all_files, cpp_reader::bracket_include, CPP_DL_ERROR, CPP_DL_ICE, cpp_error(), cpp_get_options(), _cpp_file::dir, file_hash_entry::file, cpp_reader::file_hash, find_file_in_dir(), free(), htab_find_slot_with_hash(), htab_hash_string(), INSERT, make_cpp_file(), _cpp_file::name, new_file_hash_entry(), cpp_dir::next, file_hash_entry::next, _cpp_file::next_file, NULL, open_file_failed(), cpp_reader::quote_include, search_cache(), search_path_exhausted(), file_hash_entry::start_dir, and file_hash_entry::u.
Referenced by _cpp_compare_file_date(), _cpp_fake_include(), and _cpp_stack_include().
| void _cpp_init_files | ( | cpp_reader * | pfile | ) |
| void _cpp_mark_file_once_only | ( | cpp_reader * | pfile, | |
| _cpp_file * | file | |||
| ) |
| void _cpp_pop_file_buffer | ( | cpp_reader * | pfile, | |
| _cpp_file * | file | |||
| ) |
| bool _cpp_read_file_entries | ( | cpp_reader *pfile | ATTRIBUTE_UNUSED, | |
| FILE * | f | |||
| ) |
Definition at line 1502 of file files.c.
References pchf_data::count, pchf_data::entries, fread, memcpy, and xmalloc().
Referenced by cpp_read_state().
| void _cpp_report_missing_guards | ( | cpp_reader * | pfile | ) |
Definition at line 1086 of file files.c.
References cpp_reader::file_hash, htab_traverse(), and report_missing_guard().
| bool _cpp_save_file_entries | ( | cpp_reader * | pfile, | |
| FILE * | fp | |||
| ) |
| bool _cpp_stack_file | ( | cpp_reader * | pfile, | |
| _cpp_file * | file, | |||
| bool | import | |||
| ) |
| bool _cpp_stack_include | ( | cpp_reader * | pfile, | |
| const char * | fname, | |||
| int | angle_brackets, | |||
| enum include_type | type | |||
| ) |
| static void allocate_file_hash_entries | ( | cpp_reader * | pfile | ) | [static] |
Definition at line 933 of file files.c.
References cpp_reader::file_hash_entries, cpp_reader::file_hash_entries_allocated, cpp_reader::file_hash_entries_used, and xmalloc().
Referenced by _cpp_init_files(), and new_file_hash_entry().
| static char * append_file_to_dir | ( | const char * | fname, | |
| cpp_dir * | dir | |||
| ) | [static] |
Definition at line 1173 of file files.c.
References cpp_dir::len, memcpy, cpp_dir::name, path, strlen(), and xmalloc().
Referenced by find_file_in_dir(), and read_name_map().
| static bool check_file_against_entries | ( | cpp_reader *pfile | ATTRIBUTE_UNUSED, | |
| _cpp_file * | f, | |||
| bool | check_included | |||
| ) | [static] |
Definition at line 1575 of file files.c.
References bsearch(), pchf_compare_data::check_included, pchf_data::count, pchf_data::entries, pchf_compare_data::f, pchf_data::have_once_only, NULL, pchf_compare(), pchf_compare_data::size, _cpp_file::st, stat::st_size, and pchf_compare_data::sum_computed.
| static bool check_file_against_entries | ( | cpp_reader * | , | |
| _cpp_file * | , | |||
| bool | ||||
| ) | [static] |
Referenced by should_stack_file().
| void cpp_change_file | ( | cpp_reader * | pfile, | |
| enum lc_reason | reason, | |||
| const char * | new_name | |||
| ) |
Definition at line 1047 of file files.c.
Referenced by finish_options(), push_command_line_include(), and read_scan_file().
| cpp_buffer* cpp_get_buffer | ( | cpp_reader * | pfile | ) |
Definition at line 1373 of file files.c.
Referenced by _cpp_builtin_macro_text(), and find_subframework_header().
| _cpp_file* cpp_get_file | ( | cpp_buffer * | b | ) | [read] |
Definition at line 1381 of file files.c.
Referenced by _cpp_builtin_macro_text(), and find_subframework_header().
| cpp_buffer* cpp_get_prev | ( | cpp_buffer * | b | ) |
| bool cpp_included | ( | cpp_reader * | pfile, | |
| const char * | fname | |||
| ) |
Definition at line 955 of file files.c.
References _cpp_file::err_no, file_hash_entry::file, cpp_reader::file_hash, htab_find_with_hash(), htab_hash_string(), file_hash_entry::next, NULL, file_hash_entry::start_dir, and file_hash_entry::u.
| void cpp_make_system_header | ( | cpp_reader * | pfile, | |
| int | syshdr, | |||
| int | externc | |||
| ) |
Definition at line 1029 of file files.c.
References _cpp_do_file_change(), cpp_reader::buffer, flags, line_maps::highest_line, LC_RENAME, cpp_reader::line_table, line_table, map, line_maps::maps, SOURCE_LINE, cpp_buffer::sysp, line_map::to_file, and line_maps::used.
| bool cpp_push_include | ( | cpp_reader * | pfile, | |
| const char * | fname | |||
| ) |
Definition at line 1123 of file files.c.
Referenced by finish_options(), and push_command_line_include().
| void cpp_set_include_chains | ( | cpp_reader * | pfile, | |
| cpp_dir * | quote, | |||
| cpp_dir * | bracket, | |||
| int | quote_ignores_source_dir | |||
| ) |
Definition at line 1154 of file files.c.
Referenced by reader_init(), and register_include_chains().
Definition at line 883 of file files.c.
References _cpp_file::buffer, free(), and _cpp_file::name.
Referenced by should_stack_file().
| static const char * dir_name_of_file | ( | _cpp_file * | file | ) | [static] |
Definition at line 790 of file files.c.
References _cpp_file::dir_name, lbasename(), len, memcpy, _cpp_file::path, and xmalloc().
Referenced by search_path_head().
Definition at line 985 of file files.c.
References file_hash_entry::dir, file_hash_entry::file, _cpp_file::name, file_hash_entry::start_dir, strcmp(), and file_hash_entry::u.
Referenced by _cpp_init_files().
Definition at line 971 of file files.c.
References file_hash_entry::dir, file_hash_entry::file, htab_hash_string(), _cpp_file::name, file_hash_entry::start_dir, and file_hash_entry::u.
Referenced by _cpp_init_files().
| static bool find_file_in_dir | ( | cpp_reader * | pfile, | |
| _cpp_file * | file, | |||
| bool * | invalid_pch | |||
| ) | [static] |
Definition at line 310 of file files.c.
References append_file_to_dir(), cpp_dir::construct, CPP_OPTION, _cpp_file::dir, ENOENT, _cpp_file::err_no, free(), _cpp_file::name, NULL, open_file(), open_file_failed(), path, _cpp_file::path, pch_open_file(), and remap_filename().
Referenced by _cpp_find_file().
| static cpp_dir * make_cpp_dir | ( | cpp_reader * | pfile, | |
| const char * | dir_name, | |||
| int | sysp | |||
| ) | [static] |
Definition at line 899 of file files.c.
References cpp_dir::construct, file_hash_entry::dir, dir, cpp_reader::dir_hash, htab_find_slot_with_hash(), htab_hash_string(), INSERT, cpp_dir::len, cpp_dir::name, new_file_hash_entry(), cpp_dir::next, file_hash_entry::next, NULL, cpp_reader::quote_include, file_hash_entry::start_dir, strlen(), cpp_dir::sysp, file_hash_entry::u, and xcalloc().
Referenced by remap_filename(), and search_path_head().
| static _cpp_file * make_cpp_file | ( | cpp_reader * | pfile, | |
| cpp_dir * | dir, | |||
| const char * | fname | |||
| ) | [static] |
Definition at line 868 of file files.c.
References cpp_reader::buffer, _cpp_file::dir, _cpp_file::fd, _cpp_file::main_file, _cpp_file::name, xcalloc(), and xstrdup().
Referenced by _cpp_find_file(), and should_stack_file().
| static struct file_hash_entry * new_file_hash_entry | ( | cpp_reader * | pfile | ) | [static, read] |
Definition at line 943 of file files.c.
References allocate_file_hash_entries(), cpp_reader::file_hash_entries, cpp_reader::file_hash_entries_allocated, and cpp_reader::file_hash_entries_used.
Referenced by _cpp_find_file(), and make_cpp_dir().
Definition at line 200 of file files.c.
References close, ENOENT, ENOTDIR, _cpp_file::err_no, errno, _cpp_file::fd, fstat, O_BINARY, O_NOCTTY, O_RDONLY, open, _cpp_file::path, S_ISDIR, set_stdin_to_binary_mode, _cpp_file::st, and stat::st_mode.
| static void open_file_failed | ( | cpp_reader * | pfile, | |
| _cpp_file * | file | |||
| ) | [static] |
Definition at line 836 of file files.c.
References cpp_reader::buffer, CPP_DL_ERROR, CPP_DL_WARNING, cpp_errno(), CPP_OPTION, cpp_reader::deps, deps_add_dep(), ENOENT, _cpp_file::err_no, errno, line_maps::highest_line, cpp_reader::line_table, _cpp_file::name, _cpp_file::path, cpp_dir::sysp, and cpp_buffer::sysp.
Referenced by _cpp_find_file(), _cpp_save_file_entries(), find_file_in_dir(), and read_file().
| static bool pch_open_file | ( | cpp_reader * | pfile, | |
| _cpp_file * | file, | |||
| bool * | invalid_pch | |||
| ) | [static] |
Definition at line 242 of file files.c.
References cpp_reader::cb, closedir(), d, dirent::d_name, DIR, free(), len, memcpy, _cpp_file::name, NULL, opendir(), path, _cpp_file::path, _cpp_file::pch, _cpp_file::pchname, readdir(), S_ISDIR, stat::st_mode, strcmp(), strlen(), cpp_callbacks::valid_pch, validate_pch(), xmalloc(), and xrealloc().
Referenced by find_file_in_dir().
Definition at line 1542 of file files.c.
References _cpp_file::buffer, pchf_compare_data::check_included, d, pchf_compare_data::f, f, md5_buffer(), memcmp, pchf_entry::once_only, result, pchf_entry::size, pchf_compare_data::size, _cpp_file::st, stat::st_size, pchf_compare_data::sum, pchf_entry::sum, and pchf_compare_data::sum_computed.
Referenced by check_file_against_entries().
| static bool read_file | ( | cpp_reader * | pfile, | |
| _cpp_file * | file | |||
| ) | [static] |
Definition at line 565 of file files.c.
References _cpp_file::buffer_valid, close, _cpp_file::dont_read, _cpp_file::err_no, _cpp_file::fd, open_file(), open_file_failed(), and read_file_guts().
| static bool read_file_guts | ( | cpp_reader * | pfile, | |
| _cpp_file * | file | |||
| ) | [static] |
Definition at line 492 of file files.c.
References _cpp_convert_input(), buf, _cpp_file::buffer, _cpp_file::buffer_valid, count, CPP_DL_ERROR, CPP_DL_WARNING, cpp_errno(), cpp_error(), CPP_OPTION, _cpp_file::fd, INTTYPE_MAXIMUM, _cpp_file::path, read, S_ISBLK, S_ISREG, size, ssize_t, _cpp_file::st, stat::st_mode, stat::st_size, STAT_SIZE_RELIABLE, uchar, xmalloc(), and xrealloc().
Referenced by read_file().
| static char * read_filename_string | ( | int | ch, | |
| FILE * | f | |||
| ) | [static] |
Definition at line 1220 of file files.c.
References alloca, append_file_to_dir(), count, EOF, f, fclose(), FILE_NAME_MAP_FILE, fopen, free(), getc(), IS_ABSOLUTE_PATH, is_hspace, is_space, cpp_dir::len, len, memcpy, cpp_dir::name, cpp_dir::name_map, NULL, read_filename_string(), strcpy, xmalloc(), and xrealloc().
| static char * remap_filename | ( | cpp_reader * | pfile, | |
| _cpp_file * | file | |||
| ) | [static] |
Definition at line 1285 of file files.c.
References _cpp_file::dir, dir, index(), cpp_dir::len, len, make_cpp_dir(), memcpy, cpp_dir::name, _cpp_file::name, cpp_dir::name_map, NULL, p, read_name_map(), strchr, strcmp(), cpp_dir::sysp, xmalloc(), and xstrdup().
Definition at line 1055 of file files.c.
References _, _cpp_file::cmacro, file_hash_entry::file, fputs(), _cpp_file::main_file, NULL, _cpp_file::path, putc(), _cpp_file::stack_count, file_hash_entry::start_dir, and file_hash_entry::u.
| static struct file_hash_entry * search_cache | ( | struct file_hash_entry * | head, | |
| const cpp_dir * | start_dir | |||
| ) | [static, read] |
Definition at line 858 of file files.c.
References file_hash_entry::next, and file_hash_entry::start_dir.
Referenced by _cpp_find_file().
| static bool search_path_exhausted | ( | cpp_reader * | pfile, | |
| const char * | header, | |||
| _cpp_file * | file | |||
| ) | [static] |
Definition at line 351 of file files.c.
References cpp_reader::cb, _cpp_file::dir, free(), func, cpp_callbacks::missing_header, _cpp_file::name, NULL, open_file(), and _cpp_file::path.
Referenced by _cpp_find_file().
| static struct cpp_dir * search_path_head | ( | cpp_reader * | pfile, | |
| const char * | fname, | |||
| int | angle_brackets, | |||
| enum include_type | type | |||
| ) | [static, read] |
Definition at line 750 of file files.c.
References cpp_reader::bracket_include, cpp_reader::buffer, CPP_DL_ERROR, cpp_error(), _cpp_file::dir, dir, dir_name_of_file(), cpp_buffer::file, IS_ABSOLUTE_PATH, IT_CMDLINE, IT_INCLUDE_NEXT, cpp_reader::main_file, make_cpp_dir(), cpp_dir::next, cpp_reader::no_search_path, NULL, cpp_reader::quote_ignores_source_dir, cpp_reader::quote_include, and cpp_buffer::sysp.
Referenced by _cpp_compare_file_date(), and _cpp_stack_include().
| static bool should_stack_file | ( | cpp_reader * | pfile, | |
| _cpp_file * | file, | |||
| bool | import | |||
| ) | [static] |
Definition at line 591 of file files.c.
References _cpp_mark_file_once_only(), cpp_reader::all_files, _cpp_file::buffer, _cpp_file::buffer_valid, cpp_reader::cb, check_file_against_entries(), close, _cpp_file::cmacro, destroy_cpp_file(), _cpp_file::dir, _cpp_file::err_no, f, _cpp_file::fd, make_cpp_file(), memcmp, _cpp_file::name, _cpp_file::next_file, NT_MACRO, NULL, _cpp_file::once_only, _cpp_file::path, _cpp_file::pch, _cpp_file::pchname, read_file(), cpp_callbacks::read_pch, cpp_reader::seen_once_only, _cpp_file::st, stat::st_mtime, stat::st_size, and _cpp_file::stack_count.
Referenced by _cpp_stack_file().
| static bool validate_pch | ( | cpp_reader * | pfile, | |
| _cpp_file * | file, | |||
| const char * | pchname | |||
| ) | [static] |
Definition at line 1321 of file files.c.
References cpp_reader::cb, close, CPP_OPTION, line_maps::depth, _cpp_file::fd, fprintf(), i, cpp_reader::line_table, open_file(), _cpp_file::path, putc(), and cpp_callbacks::valid_pch.
Referenced by pch_open_file().
1.5.6