From 4430a129ff8e3cdb7815c7e7c73c7e2dc34aa942 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Fri, 6 Jul 2018 15:34:38 -0400 Subject: [PATCH 39/46] FIXME: make remark take a dump_location_t --- gcc/diagnostic-remark.h | 4 +++- gcc/diagnostic.c | 4 ++-- gcc/optinfo-emit-diagnostics.cc | 4 +--- gcc/optinfo.h | 3 +++ 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/gcc/diagnostic-remark.h b/gcc/diagnostic-remark.h index 178bfe3..6bf1214 100644 --- a/gcc/diagnostic-remark.h +++ b/gcc/diagnostic-remark.h @@ -21,7 +21,9 @@ along with GCC; see the file COPYING3. If not see #ifndef GCC_DIAGNOSTIC_REMARK_H #define GCC_DIAGNOSTIC_REMARK_H -extern bool remark (location_t, const char *, ...) +/* This is in own header file so that it can use dump_location_t. */ + +extern bool remark (const dump_location_t &, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3); #endif /* ! GCC_DIAGNOSTIC_REMARK_H */ diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c index bc7603e..dbe3004 100644 --- a/gcc/diagnostic.c +++ b/gcc/diagnostic.c @@ -1282,11 +1282,11 @@ warning_n (location_t location, int opt, unsigned HOST_WIDE_INT n, // FIXME: we don't yet have a more fine-grained way of inhibiting remarks bool -remark (location_t location, const char *gmsgid, ...) +remark (const dump_location_t &location, const char *gmsgid, ...) { va_list ap; va_start (ap, gmsgid); - rich_location richloc (line_table, location); + rich_location richloc (line_table, location.get_location_t ()); bool ret = diagnostic_impl (&richloc, -1, gmsgid, &ap, DK_REMARK); va_end (ap); return ret; diff --git a/gcc/optinfo-emit-diagnostics.cc b/gcc/optinfo-emit-diagnostics.cc index ebed539..4c3a9c3 100644 --- a/gcc/optinfo-emit-diagnostics.cc +++ b/gcc/optinfo-emit-diagnostics.cc @@ -212,9 +212,7 @@ emit_optinfo_as_diagnostic_remark (const optinfo *optinfo) print_optinfo_as_remark (&pp, optinfo); const char *msg = pp_formatted_text (&pp); - location_t loc = optinfo->get_location_t (); - - remark (loc, "%s", msg); + remark (optinfo->get_dump_location (), "%s", msg); } #if CHECKING_P diff --git a/gcc/optinfo.h b/gcc/optinfo.h index b3dbabd..6e7d43b 100644 --- a/gcc/optinfo.h +++ b/gcc/optinfo.h @@ -114,6 +114,9 @@ class optinfo {} ~optinfo (); + const dump_location_t & + get_dump_location () const { return m_loc; } + const dump_user_location_t & get_user_location () const { return m_loc.get_user_location (); } -- 1.8.5.3