From 3f95fbd10829f902e3f375fdb55afe4951fe2296 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Thu, 7 Apr 2016 09:54:00 -0400 Subject: [PATCH 32/91] FIXME: move read_md_file into rtx_reader --- gcc/read-md.c | 23 ++++++++++------------- gcc/read-md.h | 5 ++++- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/gcc/read-md.c b/gcc/read-md.c index d7aeaab..459ea37 100644 --- a/gcc/read-md.c +++ b/gcc/read-md.c @@ -59,9 +59,6 @@ static htab_t joined_conditions; /* An obstack for allocating joined_conditions entries. */ static struct obstack joined_conditions_obstack; -/* The file we are reading. */ -FILE *read_md_file; - /* The filename of READ_MD_FILE. */ const char *read_md_filename; @@ -429,7 +426,7 @@ rtx_reader::read_char (void) { int ch; - ch = getc (read_md_file); + ch = getc (m_read_md_file); if (ch == '\n') { m_read_md_lineno++; @@ -454,7 +451,7 @@ rtx_reader::unread_char (int ch) else m_read_md_colno--; update_location (false); - ungetc (ch, read_md_file); + ungetc (ch, m_read_md_file); } /* Read an rtx code name into NAME. It is terminated by any of the @@ -1087,7 +1084,7 @@ rtx_reader::handle_include (file_location loc) /* Save the old cursor. Note that the LINENO argument to this function is the beginning of the include statement, while read_md_lineno has already been advanced. */ - old_file = read_md_file; + old_file = m_read_md_file; old_filename = read_md_filename; old_lineno = m_read_md_lineno; old_colno = m_read_md_colno; @@ -1095,13 +1092,13 @@ rtx_reader::handle_include (file_location loc) if (include_callback) include_callback (pathname); - read_md_file = input_file; + m_read_md_file = input_file; read_md_filename = pathname; /* FIXME: update line_maps */ handle_file (); /* Restore the old cursor. */ - read_md_file = old_file; + m_read_md_file = old_file; read_md_filename = old_filename; m_read_md_lineno = old_lineno; m_read_md_colno = old_colno; @@ -1144,7 +1141,7 @@ rtx_reader::handle_file () if (c != ')') fatal_expected_char (')', c); } - fclose (read_md_file); + fclose (m_read_md_file); } /* Like handle_file, but for top-level files. Set up in_fname and @@ -1287,7 +1284,7 @@ rtx_reader::read_md_files (int argc, const char **argv, if (already_read_stdin) fatal ("cannot read standard input twice"); - read_md_file = stdin; + m_read_md_file = stdin; read_md_filename = ""; handle_toplevel_file (); already_read_stdin = true; @@ -1306,8 +1303,8 @@ rtx_reader::read_md_files (int argc, const char **argv, /* If we get here we are looking at a non-option argument, i.e. a file to be processed. */ read_md_filename = argv[i]; - read_md_file = fopen (read_md_filename, "r"); - if (read_md_file == 0) + m_read_md_file = fopen (read_md_filename, "r"); + if (m_read_md_file == 0) { perror (read_md_filename); return false; @@ -1320,7 +1317,7 @@ rtx_reader::read_md_files (int argc, const char **argv, read the standard input now. */ if (num_files == 0 && !already_read_stdin) { - read_md_file = stdin; + m_read_md_file = stdin; read_md_filename = ""; handle_toplevel_file (); } diff --git a/gcc/read-md.h b/gcc/read-md.h index 876de10..eb9e9b2 100644 --- a/gcc/read-md.h +++ b/gcc/read-md.h @@ -116,6 +116,10 @@ class rtx_reader private: line_maps *m_line_table; const line_map_ordinary *m_current_linemap; + + /* The file we are reading. */ + FILE *m_read_md_file; + int m_read_md_lineno; int m_read_md_colno; }; @@ -133,7 +137,6 @@ class noop_reader : public rtx_reader }; extern const char *in_fname; -extern FILE *read_md_file; extern const char *read_md_filename; extern struct obstack string_obstack; extern void (*include_callback) (const char *); -- 1.8.5.3