From e6593d77913a8af61638deaba5bd226406589e23 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Wed, 13 Apr 2016 11:21:35 -0400 Subject: [PATCH 78/91] FIXME: move first_dir_md_include and last_dir_md_include_ptr into rtx_reader; eliminate max_include_len --- gcc/read-md.c | 36 ++++++++++-------------------------- gcc/read-md.h | 14 ++++++++++++++ 2 files changed, 24 insertions(+), 26 deletions(-) diff --git a/gcc/read-md.c b/gcc/read-md.c index 1087074..ad2d762 100644 --- a/gcc/read-md.c +++ b/gcc/read-md.c @@ -34,12 +34,6 @@ struct ptr_loc { int lineno; }; -/* A singly-linked list of filenames. */ -struct file_name_list { - struct file_name_list *next; - const char *fname; -}; - /* Obstack used for allocating MD strings. */ struct obstack string_obstack; @@ -62,20 +56,10 @@ static struct obstack joined_conditions_obstack; /* The directory part of IN_FNAME. NULL if IN_FNAME is a bare filename. */ static char *base_dir; -/* The first directory to search. */ -static struct file_name_list *first_dir_md_include; - -/* A pointer to the null terminator of the md include chain. */ -static struct file_name_list **last_dir_md_include_ptr = &first_dir_md_include; - /* This callback will be invoked whenever an md include directive is processed. To be used for creation of the dependency file. */ void (*include_callback) (const char *); -/* The current maximum length of directory names in the search path - for include files. (Altered as we get more of them.) */ -static size_t max_include_len; - /* FIXME. */ rtx_reader *rtx_reader_ptr; @@ -1072,7 +1056,9 @@ rtx_reader::rtx_reader (line_maps *line_table) m_toplevel_fname (NULL), m_read_md_filename (NULL), m_read_md_lineno (0), - m_read_md_colno (0) + m_read_md_colno (0), + m_first_dir_md_include (NULL), + m_last_dir_md_include_ptr (&m_first_dir_md_include) { rtx_reader_line_table = m_line_table; rtx_reader_ptr = this; @@ -1112,7 +1098,7 @@ rtx_reader::handle_include (file_location loc) struct file_name_list *stackp; /* Search the directory path, trying to open the file. */ - for (stackp = first_dir_md_include; stackp; stackp = stackp->next) + for (stackp = m_first_dir_md_include; stackp; stackp = stackp->next) { static const char sep[2] = { DIR_SEPARATOR, '\0' }; @@ -1250,18 +1236,16 @@ rtx_reader::update_location (bool advancing) /* Parse a -I option with argument ARG. */ -static void -parse_include (const char *arg) +void +rtx_reader::add_include_path (const char *arg) { struct file_name_list *dirtmp; dirtmp = XNEW (struct file_name_list); dirtmp->next = 0; dirtmp->fname = arg; - *last_dir_md_include_ptr = dirtmp; - last_dir_md_include_ptr = &dirtmp->next; - if (strlen (dirtmp->fname) > max_include_len) - max_include_len = strlen (dirtmp->fname); + *m_last_dir_md_include_ptr = dirtmp; + m_last_dir_md_include_ptr = &dirtmp->next; } /* The main routine for reading .md files. Try to process all the .md @@ -1313,9 +1297,9 @@ rtx_reader::read_md_files (int argc, const char **argv, if (argv[i][1] == 'I') { if (argv[i][2] != '\0') - parse_include (argv[i] + 2); + add_include_path (argv[i] + 2); else if (++i < argc) - parse_include (argv[i]); + add_include_path (argv[i]); else fatal ("directory name missing after -I option"); continue; diff --git a/gcc/read-md.h b/gcc/read-md.h index 995b050..68590d5 100644 --- a/gcc/read-md.h +++ b/gcc/read-md.h @@ -141,9 +141,17 @@ class rtx_reader int get_lineno () const { return m_read_md_lineno; } private: + /* A singly-linked list of filenames. */ + struct file_name_list { + struct file_name_list *next; + const char *fname; + }; + + private: void handle_file (); void handle_toplevel_file (); void handle_include (file_location loc); + void add_include_path (const char *arg); private: line_maps *m_line_table; @@ -157,6 +165,12 @@ class rtx_reader const char *m_read_md_filename; int m_read_md_lineno; int m_read_md_colno; + + /* The first directory to search. */ + file_name_list *m_first_dir_md_include; + + /* A pointer to the null terminator of the md include chain. */ + file_name_list **m_last_dir_md_include_ptr; }; /* Global singleton. */ -- 1.8.5.3