{
struct file_hash_entry *next;
cpp_dir *start_dir;
+ source_location location;
union
{
_cpp_file *file;
entry = new_file_hash_entry (pfile);
entry->next = *hash_slot;
entry->start_dir = start_dir;
+ entry->location = pfile->line_table->highest_location;
entry->u.file = file;
*hash_slot = entry;
entry = new_file_hash_entry (pfile);
entry->next = *hash_slot;
entry->start_dir = pfile->bracket_include;
+ entry->location = pfile->line_table->highest_location;
entry->u.file = file;
*hash_slot = entry;
}
entry = new_file_hash_entry (pfile);
entry->next = *hash_slot;
entry->start_dir = pfile->quote_include;
+ entry->location = pfile->line_table->highest_location;
entry->u.file = file;
*hash_slot = entry;
}
entry = new_file_hash_entry (pfile);
entry->next = *hash_slot;
entry->start_dir = NULL;
+ entry->location = pfile->line_table->highest_location;
entry->u.dir = dir;
*hash_slot = entry;
return entry != NULL;
}
+/* Returns TRUE if a file FNAME has ever been successfully opened
+ before LOCATION. This routine is not intended to correctly handle
+ filenames aliased by links or redundant . or .. traversals etc. */
+bool
+cpp_included_before (cpp_reader *pfile, const char *fname,
+ source_location location)
+{
+ struct file_hash_entry *entry;
+
+ entry = (struct 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
+ || entry->location > location))
+ entry = entry->next;
+
+ return entry != NULL;
+}
+
/* Calculate the hash value of a file hash entry P. */
static hashval_t