charset.c (conversion): Rename to ...

* charset.c (conversion): Rename to ...
	(cpp_conversion): ... this one; update.
	* files.c (file_hash_entry): Rename to ...
	(cpp_file_hash_entry): ... this one ; update.

From-SVN: r215482
This commit is contained in:
Jan Hubicka 2014-09-22 21:43:02 +02:00 committed by Jan Hubicka
parent 46842bfe9c
commit d87fc69983
3 changed files with 35 additions and 28 deletions

View file

@ -1,3 +1,10 @@
2014-09-17 Jan Hubicka <hubicka@ucw.cz>
* charset.c (conversion): Rename to ...
(cpp_conversion): ... this one; update.
* files.c (file_hash_entry): Rename to ...
(cpp_file_hash_entry): ... this one ; update.
2014-09-17 Marek Polacek <polacek@redhat.com> 2014-09-17 Marek Polacek <polacek@redhat.com>
PR c/61854 PR c/61854

View file

@ -608,13 +608,13 @@ convert_using_iconv (iconv_t cd, const uchar *from, size_t flen,
#define APPLY_CONVERSION(CONVERTER, FROM, FLEN, TO) \ #define APPLY_CONVERSION(CONVERTER, FROM, FLEN, TO) \
CONVERTER.func (CONVERTER.cd, FROM, FLEN, TO) CONVERTER.func (CONVERTER.cd, FROM, FLEN, TO)
struct conversion struct cpp_conversion
{ {
const char *pair; const char *pair;
convert_f func; convert_f func;
iconv_t fake_cd; iconv_t fake_cd;
}; };
static const struct conversion conversion_tab[] = { static const struct cpp_conversion conversion_tab[] = {
{ "UTF-8/UTF-32LE", convert_utf8_utf32, (iconv_t)0 }, { "UTF-8/UTF-32LE", convert_utf8_utf32, (iconv_t)0 },
{ "UTF-8/UTF-32BE", convert_utf8_utf32, (iconv_t)1 }, { "UTF-8/UTF-32BE", convert_utf8_utf32, (iconv_t)1 },
{ "UTF-8/UTF-16LE", convert_utf8_utf16, (iconv_t)0 }, { "UTF-8/UTF-16LE", convert_utf8_utf16, (iconv_t)0 },

View file

@ -50,7 +50,7 @@ along with this program; see the file COPYING3. If not see
/* This structure represents a file searched for by CPP, whether it /* This structure represents a file searched for by CPP, whether it
exists or not. An instance may be pointed to by more than one 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 struct _cpp_file
{ {
/* Filename as given to #include or command line switch. */ /* Filename as given to #include or command line switch. */
@ -140,9 +140,9 @@ struct _cpp_file
have to do more work re-preprocessing the file, and/or comparing have to do more work re-preprocessing the file, and/or comparing
its contents against earlier once-only files. 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; cpp_dir *start_dir;
source_location location; source_location location;
union union
@ -152,10 +152,10 @@ struct file_hash_entry
} u; } 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 #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. */ one of these. */
struct file_hash_entry_pool struct file_hash_entry_pool
{ {
@ -164,7 +164,7 @@ struct file_hash_entry_pool
/* Next pool in the chain; used when freeing. */ /* Next pool in the chain; used when freeing. */
struct file_hash_entry_pool *next; struct file_hash_entry_pool *next;
/* The memory pool. */ /* 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); static bool open_file (_cpp_file *file);
@ -179,13 +179,13 @@ static struct cpp_dir *search_path_head (cpp_reader *, const char *fname,
int angle_brackets, enum include_type); int angle_brackets, enum include_type);
static const char *dir_name_of_file (_cpp_file *file); static const char *dir_name_of_file (_cpp_file *file);
static void open_file_failed (cpp_reader *pfile, _cpp_file *file, int); 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); const cpp_dir *start_dir);
static _cpp_file *make_cpp_file (cpp_reader *, cpp_dir *, const char *fname); static _cpp_file *make_cpp_file (cpp_reader *, cpp_dir *, const char *fname);
static void destroy_cpp_file (_cpp_file *); static void destroy_cpp_file (_cpp_file *);
static cpp_dir *make_cpp_dir (cpp_reader *, const char *dir_name, int sysp); static cpp_dir *make_cpp_dir (cpp_reader *, const char *dir_name, int sysp);
static void allocate_file_hash_entries (cpp_reader *pfile); 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 int report_missing_guard (void **slot, void *b);
static hashval_t file_hash_hash (const void *p); static hashval_t file_hash_hash (const void *p);
static int file_hash_eq (const void *p, const void *q); static int file_hash_eq (const void *p, const void *q);
@ -498,7 +498,7 @@ _cpp_file *
_cpp_find_file (cpp_reader *pfile, const char *fname, cpp_dir *start_dir, _cpp_find_file (cpp_reader *pfile, const char *fname, cpp_dir *start_dir,
bool fake, int angle_brackets, bool implicit_preinclude) bool fake, int angle_brackets, bool implicit_preinclude)
{ {
struct file_hash_entry *entry; struct cpp_file_hash_entry *entry;
void **hash_slot; void **hash_slot;
_cpp_file *file; _cpp_file *file;
bool invalid_pch = false; bool invalid_pch = false;
@ -515,7 +515,7 @@ _cpp_find_file (cpp_reader *pfile, const char *fname, cpp_dir *start_dir,
htab_hash_string (fname), INSERT); htab_hash_string (fname), INSERT);
/* First check the cache before we resort to memory allocation. */ /* 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) if (entry)
return entry->u.file; return entry->u.file;
@ -588,7 +588,7 @@ _cpp_find_file (cpp_reader *pfile, const char *fname, cpp_dir *start_dir,
else else
continue; 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) if (entry)
{ {
found_in_cache = file->dir; found_in_cache = file->dir;
@ -612,7 +612,7 @@ _cpp_find_file (cpp_reader *pfile, const char *fname, cpp_dir *start_dir,
/* Store this new result in the hash table. */ /* Store this new result in the hash table. */
entry = new_file_hash_entry (pfile); 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->start_dir = start_dir;
entry->location = pfile->line_table->highest_location; entry->location = pfile->line_table->highest_location;
entry->u.file = file; entry->u.file = file;
@ -625,7 +625,7 @@ _cpp_find_file (cpp_reader *pfile, const char *fname, cpp_dir *start_dir,
&& found_in_cache != pfile->bracket_include) && found_in_cache != pfile->bracket_include)
{ {
entry = new_file_hash_entry (pfile); 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->start_dir = pfile->bracket_include;
entry->location = pfile->line_table->highest_location; entry->location = pfile->line_table->highest_location;
entry->u.file = file; entry->u.file = file;
@ -636,7 +636,7 @@ _cpp_find_file (cpp_reader *pfile, const char *fname, cpp_dir *start_dir,
&& found_in_cache != pfile->quote_include) && found_in_cache != pfile->quote_include)
{ {
entry = new_file_hash_entry (pfile); 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->start_dir = pfile->quote_include;
entry->location = pfile->line_table->highest_location; entry->location = pfile->line_table->highest_location;
entry->u.file = file; entry->u.file = file;
@ -1058,8 +1058,8 @@ open_file_failed (cpp_reader *pfile, _cpp_file *file, int angle_brackets)
/* Search in the chain beginning at HEAD for a file whose search path /* Search in the chain beginning at HEAD for a file whose search path
started at START_DIR != NULL. */ started at START_DIR != NULL. */
static struct file_hash_entry * static struct cpp_file_hash_entry *
search_cache (struct file_hash_entry *head, const cpp_dir *start_dir) search_cache (struct cpp_file_hash_entry *head, const cpp_dir *start_dir)
{ {
while (head && head->start_dir != start_dir) while (head && head->start_dir != start_dir)
head = head->next; head = head->next;
@ -1114,10 +1114,10 @@ destroy_all_cpp_files (cpp_reader *pfile)
static cpp_dir * static cpp_dir *
make_cpp_dir (cpp_reader *pfile, const char *dir_name, int sysp) 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; 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_find_slot_with_hash (pfile->dir_hash, dir_name,
htab_hash_string (dir_name), htab_hash_string (dir_name),
INSERT); INSERT);
@ -1156,7 +1156,7 @@ allocate_file_hash_entries (cpp_reader *pfile)
} }
/* Return a new file hash entry. */ /* Return a new file hash entry. */
static struct file_hash_entry * static struct cpp_file_hash_entry *
new_file_hash_entry (cpp_reader *pfile) new_file_hash_entry (cpp_reader *pfile)
{ {
unsigned int idx; unsigned int idx;
@ -1186,9 +1186,9 @@ free_file_hash_entries (cpp_reader *pfile)
bool bool
cpp_included (cpp_reader *pfile, const char *fname) 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)); htab_find_with_hash (pfile->file_hash, fname, htab_hash_string (fname));
while (entry && (entry->start_dir == NULL || entry->u.file->err_no)) while (entry && (entry->start_dir == NULL || entry->u.file->err_no))
@ -1204,9 +1204,9 @@ bool
cpp_included_before (cpp_reader *pfile, const char *fname, cpp_included_before (cpp_reader *pfile, const char *fname,
source_location location) 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)); htab_find_with_hash (pfile->file_hash, fname, htab_hash_string (fname));
while (entry && (entry->start_dir == NULL || entry->u.file->err_no while (entry && (entry->start_dir == NULL || entry->u.file->err_no
@ -1221,7 +1221,7 @@ cpp_included_before (cpp_reader *pfile, const char *fname,
static hashval_t static hashval_t
file_hash_hash (const void *p) 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; const char *hname;
if (entry->start_dir) if (entry->start_dir)
hname = entry->u.file->name; hname = entry->u.file->name;
@ -1235,7 +1235,7 @@ file_hash_hash (const void *p)
static int static int
file_hash_eq (const void *p, const void *q) 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 *fname = (const char *) q;
const char *hname; const char *hname;
@ -1339,7 +1339,7 @@ struct report_missing_guard_data
static int static int
report_missing_guard (void **slot, void *d) 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 *data
= (struct report_missing_guard_data *) d; = (struct report_missing_guard_data *) d;