diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-09-24 08:06:51 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-24 08:06:51 +0000 |
commit | f3da612f98df143bca28258f084bc8b3f804c871 (patch) | |
tree | c7c251a2fe0343fe49f4e8119834c8ed4de4693a | |
parent | 4abf34c2b61b51ed34df9a63950927747a378cad (diff) | |
parent | 4c386aaaa7acf97139dd1a4816f5247595c73fa7 (diff) | |
download | gcc-f3da612f98df143bca28258f084bc8b3f804c871.zip gcc-f3da612f98df143bca28258f084bc8b3f804c871.tar.gz gcc-f3da612f98df143bca28258f084bc8b3f804c871.tar.bz2 |
Merge #690
690: A bit of 'RichLocation' C++ tuning [#247], [#97, #374] r=philberty a=tschwinge
... in preparation for a merge from GCC upstream, where we otherwise run into
several different build errors.
Follow-up to commit ed651fcdec170456f7460703edbd0ca5901f0026
"Add basic wrapper over gcc rich_location".
Co-authored-by: Thomas Schwinge <thomas@codesourcery.com>
-rw-r--r-- | gcc/rust/rust-diagnostics.cc | 2 | ||||
-rw-r--r-- | gcc/rust/rust-diagnostics.h | 4 | ||||
-rw-r--r-- | gcc/rust/rust-gcc-diagnostics.cc | 5 | ||||
-rw-r--r-- | gcc/rust/rust-location.h | 2 |
4 files changed, 7 insertions, 6 deletions
diff --git a/gcc/rust/rust-diagnostics.cc b/gcc/rust/rust-diagnostics.cc index 0725b08..4464357 100644 --- a/gcc/rust/rust-diagnostics.cc +++ b/gcc/rust/rust-diagnostics.cc @@ -188,7 +188,7 @@ rust_inform (const Location location, const char *fmt, ...) // Rich Locations void -rust_error_at (const RichLocation location, const char *fmt, ...) +rust_error_at (const RichLocation &location, const char *fmt, ...) { va_list ap; diff --git a/gcc/rust/rust-diagnostics.h b/gcc/rust/rust-diagnostics.h index 024593d..2e34f3b 100644 --- a/gcc/rust/rust-diagnostics.h +++ b/gcc/rust/rust-diagnostics.h @@ -64,7 +64,7 @@ rust_inform (const Location, const char *fmt, ...) // rich locations extern void -rust_error_at (const RichLocation, const char *fmt, ...) +rust_error_at (const RichLocation &, const char *fmt, ...) RUST_ATTRIBUTE_GCC_DIAG (2, 3); // These interfaces provide a way for the front end to ask for @@ -84,7 +84,7 @@ rust_close_quote (); extern void rust_be_error_at (const Location, const std::string &errmsg); extern void -rust_be_error_at (const RichLocation, const std::string &errmsg); +rust_be_error_at (const RichLocation &, const std::string &errmsg); extern void rust_be_warning_at (const Location, int opt, const std::string &warningmsg); extern void diff --git a/gcc/rust/rust-gcc-diagnostics.cc b/gcc/rust/rust-gcc-diagnostics.cc index de8acc8..0394e9e 100644 --- a/gcc/rust/rust-gcc-diagnostics.cc +++ b/gcc/rust/rust-gcc-diagnostics.cc @@ -53,9 +53,10 @@ rust_be_inform (const Location location, const std::string &infomsg) } void -rust_be_error_at (const RichLocation location, const std::string &errmsg) +rust_be_error_at (const RichLocation &location, const std::string &errmsg) { - rich_location gcc_loc = location.get (); + /* TODO: 'error_at' would like a non-'const' 'rich_location *'. */ + rich_location &gcc_loc = const_cast<rich_location &> (location.get ()); error_at (&gcc_loc, "%s", errmsg.c_str ()); } diff --git a/gcc/rust/rust-location.h b/gcc/rust/rust-location.h index 4fd61cc..b69d7da 100644 --- a/gcc/rust/rust-location.h +++ b/gcc/rust/rust-location.h @@ -96,7 +96,7 @@ public: void add_fixit_insert_after (Location where, const std::string &new_parent); - rich_location get () const { return gcc_rich_loc; } + const rich_location &get () const { return gcc_rich_loc; } private: rich_location gcc_rich_loc; |