From 1a3f878dc3b9898e4937ebfca87fae5cdb31b90d Mon Sep 17 00:00:00 2001 From: Philip Herron Date: Thu, 17 Jun 2021 15:03:18 +0100 Subject: Mark function as override to squash warning --- gcc/rust/hir/tree/rust-hir-pattern.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/rust/hir/tree/rust-hir-pattern.h b/gcc/rust/hir/tree/rust-hir-pattern.h index 13177f2..27cba7d 100644 --- a/gcc/rust/hir/tree/rust-hir-pattern.h +++ b/gcc/rust/hir/tree/rust-hir-pattern.h @@ -77,7 +77,7 @@ public: Location locus; - std::string as_string () const; + std::string as_string () const override; // Returns whether the IdentifierPattern has a pattern to bind. bool has_pattern_to_bind () const { return to_bind != nullptr; } -- cgit v1.1 From 59a560263724aaa6b0549866e7a09c95eea7a9ce Mon Sep 17 00:00:00 2001 From: Philip Herron Date: Thu, 17 Jun 2021 15:31:15 +0100 Subject: Ensure rust_debug has printf specifier checks This adds a macro wrapper over rust_debug_loc to inject a default location so calls can maintain printf specifier checks. --- gcc/rust/rust-diagnostics.cc | 2 +- gcc/rust/rust-diagnostics.h | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) (limited to 'gcc') diff --git a/gcc/rust/rust-diagnostics.cc b/gcc/rust/rust-diagnostics.cc index 6f405c9..0725b08 100644 --- a/gcc/rust/rust-diagnostics.cc +++ b/gcc/rust/rust-diagnostics.cc @@ -198,7 +198,7 @@ rust_error_at (const RichLocation location, const char *fmt, ...) } void -rust_debug (const Location location, const char *fmt, ...) +rust_debug_loc (const Location location, const char *fmt, ...) { if (!rust_be_debug_p ()) return; diff --git a/gcc/rust/rust-diagnostics.h b/gcc/rust/rust-diagnostics.h index 6c179f9..024593d 100644 --- a/gcc/rust/rust-diagnostics.h +++ b/gcc/rust/rust-diagnostics.h @@ -127,14 +127,10 @@ struct Error } // namespace Rust // rust_debug uses normal printf formatting, not GCC diagnostic formatting. -void -rust_debug (const Location location, const char *fmt, ...) ATTRIBUTE_PRINTF_2; +#define rust_debug(...) rust_debug_loc (Location (), __VA_ARGS__) -template -inline void -rust_debug (const char *fmt, Args... args) -{ - rust_debug (Location (), fmt, args...); -} +void +rust_debug_loc (const Location location, const char *fmt, + ...) ATTRIBUTE_PRINTF_2; #endif // !defined(RUST_DIAGNOSTICS_H) -- cgit v1.1