From 6bf454cce7af375715e92850ea5be53a98c61088 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Wed, 6 Apr 2016 20:56:56 -0400 Subject: [PATCH 19/91] FIXME: use 'inform' within fatal_with_file_and_line --- gcc/read-md.c | 17 ++++++++++++++++- gcc/read-md.h | 6 ++---- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/gcc/read-md.c b/gcc/read-md.c index 5983b2b..ec6fe69 100644 --- a/gcc/read-md.c +++ b/gcc/read-md.c @@ -22,6 +22,9 @@ along with GCC; see the file COPYING3. If not see #include "coretypes.h" #include "errors.h" #include "read-md.h" +#ifndef GENERATOR_FILE +#include "diagnostic.h" +#endif /* Associates PTR (which can be a string, etc.) with the file location specified by FILENAME and LINENO. */ @@ -85,6 +88,10 @@ void (*include_callback) (const char *); for include files. (Altered as we get more of them.) */ static size_t max_include_len; +/* FIXME. */ + +static rtx_reader *rtx_reader_ptr; + /* A table of md_constant structures, hashed by name. Null if no constant expansion should occur. */ static htab_t md_constants; @@ -291,7 +298,7 @@ fatal_at (file_location loc, const char *msg, ...) va_end (ap); exit (1); } -#endif +#endif /* #ifdef GENERATOR_FILE */ /* A printf-like function for reporting an error against the current position in the MD file. */ @@ -329,6 +336,12 @@ fatal_with_file_and_line (const char *msg, ...) read_md_filename, read_md_lineno, context); va_end (ap); + +#ifndef GENERATOR_FILE + file_location loc = rtx_reader_ptr->get_currrent_location (); + inform (loc, "here"); +#endif + exit (1); } @@ -915,6 +928,7 @@ rtx_reader::rtx_reader (line_maps *line_table) m_current_linemap (NULL) { rtx_reader_line_table = m_line_table; + rtx_reader_ptr = this; } /* FIXME. */ @@ -924,6 +938,7 @@ rtx_reader::~rtx_reader () #if 0 rtx_reader_line_table = NULL; #endif + rtx_reader_ptr = NULL; } /* Process an "include" directive, starting with the optional space diff --git a/gcc/read-md.h b/gcc/read-md.h index b9a604d..0cc52f6 100644 --- a/gcc/read-md.h +++ b/gcc/read-md.h @@ -95,13 +95,13 @@ class rtx_reader unread character is the optional space after the directive name. */ virtual void handle_unknown_directive (file_location, const char *) = 0; + file_location get_currrent_location () const; + private: void handle_file (); void handle_toplevel_file (); void handle_include (file_location loc); - file_location get_currrent_location () const; - private: line_maps *m_line_table; const line_map_ordinary *m_current_linemap; @@ -154,10 +154,8 @@ extern void fprint_md_ptr_loc (FILE *, const void *); extern const char *join_c_conditions (const char *, const char *); extern void print_c_condition (const char *); extern void fprint_c_condition (FILE *, const char *); -#ifdef GENERATOR_FILE extern void message_at (file_location, const char *, ...) ATTRIBUTE_PRINTF_2; extern void error_at (file_location, const char *, ...) ATTRIBUTE_PRINTF_2; -#endif extern void fatal_at (file_location, const char *, ...) ATTRIBUTE_PRINTF_2; extern void fatal_with_file_and_line (const char *, ...) ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN; -- 1.8.5.3