aboutsummaryrefslogtreecommitdiff
path: root/gcc/read-md.h
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2016-10-04 17:10:41 +0000
committerDavid Malcolm <dmalcolm@gcc.gnu.org>2016-10-04 17:10:41 +0000
commit3814e88007d6d9abfbdfd53dbcdc92fe1aed23de (patch)
tree674c22b9fe8aab5e932b8be9edc880125ec3af7d /gcc/read-md.h
parentf72da967576271070086b2252a8463bb69f93abd (diff)
downloadgcc-3814e88007d6d9abfbdfd53dbcdc92fe1aed23de.zip
gcc-3814e88007d6d9abfbdfd53dbcdc92fe1aed23de.tar.gz
gcc-3814e88007d6d9abfbdfd53dbcdc92fe1aed23de.tar.bz2
read-md.c: track column numbers
gcc/ChangeLog: * genattrtab.c (make_internal_attr): Supply dummy column number to file_location ctor. (main): Likewise. * genoutput.c (init_insn_for_nothing): Likewise. * gensupport.c (add_define_attr): Likewise. * read-md.c (message_at_1): Print column number. (fatal_with_file_and_line): Likewise. (rtx_reader::read_char): Track column numbers. (rtx_reader::unread_char): Likewise. (rtx_reader::rtx_reader): Initialize m_read_md_colno. (rtx_reader::handle_include): Stash and restore m_read_md_colno. (rtx_reader::handle_file): Initialize m_read_md_colno. (rtx_reader::get_current_location): Supply column number to file_location ctor. * read-md.h (struct file_location): Add field "colno". (file_location::file_location): Likewise. (rtx_reader::get_colno): New accessor. (rtx_reader::m_read_md_colno): New field. (rtx_reader::m_last_line_colno): New field. From-SVN: r240752
Diffstat (limited to 'gcc/read-md.h')
-rw-r--r--gcc/read-md.h16
1 files changed, 13 insertions, 3 deletions
diff --git a/gcc/read-md.h b/gcc/read-md.h
index 82a628b..a74cc72 100644
--- a/gcc/read-md.h
+++ b/gcc/read-md.h
@@ -25,14 +25,15 @@ along with GCC; see the file COPYING3. If not see
/* Records a position in the file. */
struct file_location {
file_location () {}
- file_location (const char *, int);
+ file_location (const char *, int, int);
const char *filename;
int lineno;
+ int colno;
};
-inline file_location::file_location (const char *filename_in, int lineno_in)
- : filename (filename_in), lineno (lineno_in) {}
+inline file_location::file_location (const char *filename_in, int lineno_in, int colno_in)
+: filename (filename_in), lineno (lineno_in), colno (colno_in) {}
/* Holds one symbol or number in the .md file. */
struct md_name {
@@ -112,6 +113,7 @@ class rtx_reader
const char *get_top_level_filename () const { return m_toplevel_fname; }
const char *get_filename () const { return m_read_md_filename; }
int get_lineno () const { return m_read_md_lineno; }
+ int get_colno () const { return m_read_md_colno; }
private:
/* A singly-linked list of filenames. */
@@ -144,6 +146,14 @@ class rtx_reader
/* The current line number in m_read_md_file. */
int m_read_md_lineno;
+ /* The current column number in m_read_md_file. */
+ int m_read_md_colno;
+
+ /* The column number before the last newline, so that
+ we can handle unread_char ('\n') at least once whilst
+ retaining column information. */
+ int m_last_line_colno;
+
/* The first directory to search. */
file_name_list *m_first_dir_md_include;