#define GCC_CPPHASH_H
#include "hashtable.h"
-#include "hashtab.h"
#ifdef HAVE_ICONV
#include <iconv.h>
struct directive; /* Deliberately incomplete. */
struct pending_option;
struct op;
-struct strbuf;
-struct _cpp_file;
+struct _cpp_strbuf;
typedef bool (*convert_f) (iconv_t, const unsigned char *, size_t,
- struct strbuf *);
+ struct _cpp_strbuf *);
struct cset_converter
{
convert_f func;
} exp;
/* Definition line number. */
- unsigned int line;
+ fileline line;
/* Number of tokens in expansion, or bytes for traditional macros. */
unsigned int count;
include files has been calculated and stored in "dir" below. */
unsigned char search_cached;
- /* At EOF, a buffer is automatically popped. If RETURN_AT_EOF is
- true, a CPP_EOF token is then returned. Otherwise, the next
- token from the enclosing buffer is returned. */
- bool return_at_eof;
-
/* The directory of the this buffer's file. Its NAME member is not
allocated, so we don't need to worry about freeing it. */
struct cpp_dir dir;
/* Source line tracking. */
struct line_maps line_maps;
const struct line_map *map;
- unsigned int line;
+ fileline line;
/* The line of the '#' of the current directive. */
- unsigned int directive_line;
+ fileline directive_line;
/* Memory buffers. */
_cpp_buff *a_buff; /* Aligned permanent storage. */
struct cpp_dir *bracket_include; /* <> */
struct cpp_dir no_search_path; /* No path. */
- /* Chain of files that were #import-ed or contain #pragma once. */
- struct _cpp_file *once_only_files;
+ /* Chain of all hashed _cpp_file instances. */
+ struct _cpp_file *all_files;
+
+ struct _cpp_file *main_file;
/* File and directory hash table. */
- htab_t file_hash;
+ struct htab *file_hash;
struct file_hash_entry *file_hash_entries;
unsigned int file_hash_entries_allocated, file_hash_entries_used;
directory. */
bool quote_ignores_source_dir;
- /* Non-zero if any file has contained #pragma once. */
- bool saw_pragma_once;
+ /* Nonzero if any file has contained #pragma once or #import has
+ been used. */
+ bool seen_once_only;
/* Multiple include optimization. */
const cpp_hashnode *mi_cmacro;
uchar *base;
uchar *limit;
uchar *cur;
- unsigned int first_line;
+ fileline first_line;
} out;
/* Used to save the original line number during traditional
#define CPP_WTRADITIONAL(PF) CPP_OPTION (PF, warn_traditional)
/* In cpperror.c */
-extern int _cpp_begin_message (cpp_reader *, int, unsigned int, unsigned int);
+extern int _cpp_begin_message (cpp_reader *, int, fileline, unsigned int);
/* In cppmacro.c */
extern void _cpp_free_definition (cpp_hashnode *);
extern void _cpp_destroy_hashtable (cpp_reader *);
/* In cppfiles.c */
-extern void _cpp_mark_file_once_only (cpp_reader *, struct _cpp_file *, bool);
+typedef struct _cpp_file _cpp_file;
+extern _cpp_file *_cpp_find_file (cpp_reader *, const char *fname,
+ cpp_dir *start_dir, bool fake);
+extern bool _cpp_find_failed (_cpp_file *);
+extern void _cpp_mark_file_once_only (cpp_reader *, struct _cpp_file *);
extern void _cpp_fake_include (cpp_reader *, const char *);
-extern bool _cpp_stack_file (cpp_reader *, const char *);
+extern bool _cpp_stack_file (cpp_reader *, _cpp_file*, bool);
extern bool _cpp_stack_include (cpp_reader *, const char *, int,
enum include_type);
extern int _cpp_compare_file_date (cpp_reader *, const char *, int);