/* This structure represents a file searched for by CPP, whether it
exists or not. An instance may be pointed to by more than one
- file_hash_entry; at present no reference count is kept. */
+ cpp_file_hash_entry; at present no reference count is kept. */
struct _cpp_file
{
/* Filename as given to #include or command line switch. */
have to do more work re-preprocessing the file, and/or comparing
its contents against earlier once-only files.
*/
-struct file_hash_entry
+struct cpp_file_hash_entry
{
- struct file_hash_entry *next;
+ struct cpp_file_hash_entry *next;
cpp_dir *start_dir;
source_location location;
union
} u;
};
-/* Number of entries to put in a file_hash_entry pool. */
+/* Number of entries to put in a cpp_file_hash_entry pool. */
#define FILE_HASH_POOL_SIZE 127
-/* A file hash entry pool. We allocate file_hash_entry object from
+/* A file hash entry pool. We allocate cpp_file_hash_entry object from
one of these. */
struct file_hash_entry_pool
{
/* Next pool in the chain; used when freeing. */
struct file_hash_entry_pool *next;
/* The memory pool. */
- struct file_hash_entry pool[FILE_HASH_POOL_SIZE];
+ struct cpp_file_hash_entry pool[FILE_HASH_POOL_SIZE];
};
static bool open_file (_cpp_file *file);
int angle_brackets, enum include_type);
static const char *dir_name_of_file (_cpp_file *file);
static void open_file_failed (cpp_reader *pfile, _cpp_file *file, int);
-static struct file_hash_entry *search_cache (struct file_hash_entry *head,
+static struct cpp_file_hash_entry *search_cache (struct cpp_file_hash_entry *head,
const cpp_dir *start_dir);
static _cpp_file *make_cpp_file (cpp_reader *, cpp_dir *, const char *fname);
static void destroy_cpp_file (_cpp_file *);
static cpp_dir *make_cpp_dir (cpp_reader *, const char *dir_name, int sysp);
static void allocate_file_hash_entries (cpp_reader *pfile);
-static struct file_hash_entry *new_file_hash_entry (cpp_reader *pfile);
+static struct cpp_file_hash_entry *new_file_hash_entry (cpp_reader *pfile);
static int report_missing_guard (void **slot, void *b);
static hashval_t file_hash_hash (const void *p);
static int file_hash_eq (const void *p, const void *q);
_cpp_find_file (cpp_reader *pfile, const char *fname, cpp_dir *start_dir,
bool fake, int angle_brackets, bool implicit_preinclude)
{
- struct file_hash_entry *entry;
+ struct cpp_file_hash_entry *entry;
void **hash_slot;
_cpp_file *file;
bool invalid_pch = false;
htab_hash_string (fname), INSERT);
/* First check the cache before we resort to memory allocation. */
- entry = search_cache ((struct file_hash_entry *) *hash_slot, start_dir);
+ entry = search_cache ((struct cpp_file_hash_entry *) *hash_slot, start_dir);
if (entry)
return entry->u.file;
else
continue;
- entry = search_cache ((struct file_hash_entry *) *hash_slot, file->dir);
+ entry = search_cache ((struct cpp_file_hash_entry *) *hash_slot, file->dir);
if (entry)
{
found_in_cache = file->dir;
/* Store this new result in the hash table. */
entry = new_file_hash_entry (pfile);
- entry->next = (struct file_hash_entry *) *hash_slot;
+ entry->next = (struct cpp_file_hash_entry *) *hash_slot;
entry->start_dir = start_dir;
entry->location = pfile->line_table->highest_location;
entry->u.file = file;
&& found_in_cache != pfile->bracket_include)
{
entry = new_file_hash_entry (pfile);
- entry->next = (struct file_hash_entry *) *hash_slot;
+ entry->next = (struct cpp_file_hash_entry *) *hash_slot;
entry->start_dir = pfile->bracket_include;
entry->location = pfile->line_table->highest_location;
entry->u.file = file;
&& found_in_cache != pfile->quote_include)
{
entry = new_file_hash_entry (pfile);
- entry->next = (struct file_hash_entry *) *hash_slot;
+ entry->next = (struct cpp_file_hash_entry *) *hash_slot;
entry->start_dir = pfile->quote_include;
entry->location = pfile->line_table->highest_location;
entry->u.file = file;
/* Search in the chain beginning at HEAD for a file whose search path
started at START_DIR != NULL. */
-static struct file_hash_entry *
-search_cache (struct file_hash_entry *head, const cpp_dir *start_dir)
+static struct cpp_file_hash_entry *
+search_cache (struct cpp_file_hash_entry *head, const cpp_dir *start_dir)
{
while (head && head->start_dir != start_dir)
head = head->next;
static cpp_dir *
make_cpp_dir (cpp_reader *pfile, const char *dir_name, int sysp)
{
- struct file_hash_entry *entry, **hash_slot;
+ struct cpp_file_hash_entry *entry, **hash_slot;
cpp_dir *dir;
- hash_slot = (struct file_hash_entry **)
+ hash_slot = (struct cpp_file_hash_entry **)
htab_find_slot_with_hash (pfile->dir_hash, dir_name,
htab_hash_string (dir_name),
INSERT);
}
/* Return a new file hash entry. */
-static struct file_hash_entry *
+static struct cpp_file_hash_entry *
new_file_hash_entry (cpp_reader *pfile)
{
unsigned int idx;
bool
cpp_included (cpp_reader *pfile, const char *fname)
{
- struct file_hash_entry *entry;
+ struct cpp_file_hash_entry *entry;
- entry = (struct file_hash_entry *)
+ entry = (struct cpp_file_hash_entry *)
htab_find_with_hash (pfile->file_hash, fname, htab_hash_string (fname));
while (entry && (entry->start_dir == NULL || entry->u.file->err_no))
cpp_included_before (cpp_reader *pfile, const char *fname,
source_location location)
{
- struct file_hash_entry *entry;
+ struct cpp_file_hash_entry *entry;
- entry = (struct file_hash_entry *)
+ entry = (struct cpp_file_hash_entry *)
htab_find_with_hash (pfile->file_hash, fname, htab_hash_string (fname));
while (entry && (entry->start_dir == NULL || entry->u.file->err_no
static hashval_t
file_hash_hash (const void *p)
{
- struct file_hash_entry *entry = (struct file_hash_entry *) p;
+ struct cpp_file_hash_entry *entry = (struct cpp_file_hash_entry *) p;
const char *hname;
if (entry->start_dir)
hname = entry->u.file->name;
static int
file_hash_eq (const void *p, const void *q)
{
- struct file_hash_entry *entry = (struct file_hash_entry *) p;
+ struct cpp_file_hash_entry *entry = (struct cpp_file_hash_entry *) p;
const char *fname = (const char *) q;
const char *hname;
static int
report_missing_guard (void **slot, void *d)
{
- struct file_hash_entry *entry = (struct file_hash_entry *) *slot;
+ struct cpp_file_hash_entry *entry = (struct cpp_file_hash_entry *) *slot;
struct report_missing_guard_data *data
= (struct report_missing_guard_data *) d;