From fc6a4e9f8127bc7f6577be36ae011ec7591bbd1f Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Wed, 13 Apr 2016 11:33:28 -0400 Subject: [PATCH 79/91] FIXME: move base_dir into rtx_reader --- gcc/read-md.c | 13 +++++-------- gcc/read-md.h | 4 ++++ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/gcc/read-md.c b/gcc/read-md.c index ad2d762..29dba87 100644 --- a/gcc/read-md.c +++ b/gcc/read-md.c @@ -53,9 +53,6 @@ static htab_t joined_conditions; /* An obstack for allocating joined_conditions entries. */ static struct obstack joined_conditions_obstack; -/* The directory part of IN_FNAME. NULL if IN_FNAME is a bare filename. */ -static char *base_dir; - /* 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 *); @@ -1114,8 +1111,8 @@ rtx_reader::handle_include (file_location loc) filename with BASE_DIR. */ if (input_file == NULL) { - if (base_dir) - pathname = concat (base_dir, filename, NULL); + if (m_base_dir) + pathname = concat (m_base_dir, filename, NULL); else pathname = xstrdup (filename); input_file = fopen (pathname, "r"); @@ -1190,7 +1187,7 @@ rtx_reader::handle_file () } /* Like handle_file, but for top-level files. Set up m_toplevel_fname - and base_dir accordingly. */ + and m_base_dir accordingly. */ void rtx_reader::handle_toplevel_file () @@ -1200,9 +1197,9 @@ rtx_reader::handle_toplevel_file () m_toplevel_fname = m_read_md_filename; base = lbasename (m_toplevel_fname); if (base == m_toplevel_fname) - base_dir = NULL; + m_base_dir = NULL; else - base_dir = xstrndup (m_toplevel_fname, base - m_toplevel_fname); + m_base_dir = xstrndup (m_toplevel_fname, base - m_toplevel_fname); m_current_linemap = linemap_check_ordinary (linemap_add (m_line_table, LC_ENTER, 0, diff --git a/gcc/read-md.h b/gcc/read-md.h index 68590d5..7968c7d 100644 --- a/gcc/read-md.h +++ b/gcc/read-md.h @@ -159,6 +159,10 @@ class rtx_reader const char *m_toplevel_fname; + /* The directory part of m_toplevel_fname + NULL if m_toplevel_fname is a bare filename. */ + char *m_base_dir; + /* The file we are reading. */ FILE *m_read_md_file; -- 1.8.5.3