From: Owen Avery <[email protected]>
This should allow the use of gcc diagnostic format specifiers in debug
diagnostics, in exchange for stricter diagnostic quality checks.
gcc/rust/ChangeLog:
* rust-diagnostics.cc (rust_debug_fmt_at): New function
definition.
* rust-diagnostics.h (rust_debug_fmt): New function-like macro
definition.
(rust_debug_fmt_at): New function declaration.
Signed-off-by: Owen Avery <[email protected]>
---
This change was merged into the gccrs repository and is posted here for
upstream visibility and potential drive-by review, as requested by GCC
release managers.
Each commit email contains a link to its details on github from where you can
find the Pull-Request and associated discussions.
Commit on github: https://github.com/Rust-GCC/gccrs/commit/9482951a83c9e17f28f377aef98ce2843ea3c651
The commit has NOT been mentioned in any issue.
The commit has been mentioned in the following pull-request(s):
- https://github.com/Rust-GCC/gccrs/pull/4788
gcc/rust/rust-diagnostics.cc | 13 +++++++++++++
gcc/rust/rust-diagnostics.h | 6 ++++++
2 files changed, 19 insertions(+)
diff --git a/gcc/rust/rust-diagnostics.cc b/gcc/rust/rust-diagnostics.cc
index a87369c08..498805acc 100644
--- a/gcc/rust/rust-diagnostics.cc
+++ b/gcc/rust/rust-diagnostics.cc
@@ -420,6 +420,19 @@ rust_debug_loc (const location_t location, const char *fmt, ...)
rust_be_inform (location, rval);
}
+void
+rust_debug_fmt_at (const location_t location, const char *fmt, ...)
+{
+ if (!rust_be_debug_p ())
+ return;
+
+ va_list ap;
+
+ va_start (ap, fmt);
+ rust_be_inform (location, expand_message (fmt, ap));
+ va_end (ap);
+}
+
namespace Rust {
/**
diff --git a/gcc/rust/rust-diagnostics.h b/gcc/rust/rust-diagnostics.h
index 76d784f58..7fe2596e8 100644
--- a/gcc/rust/rust-diagnostics.h
+++ b/gcc/rust/rust-diagnostics.h
@@ -307,4 +307,10 @@ struct Error
void rust_debug_loc (const location_t location, const char *fmt,
...) ATTRIBUTE_PRINTF_2;
+// like rust_debug, but has gcc diagnostic formatting
+#define rust_debug_fmt(...) rust_debug_fmt_at (UNDEF_LOCATION, __VA_ARGS__)
+
+void rust_debug_fmt_at (location_t location, const char *fmt, ...)
+ RUST_ATTRIBUTE_GCC_DIAG (2, 3);
+
#endif // !defined(RUST_DIAGNOSTICS_H)
base-commit: fde042ef7c7241b40e12b3dabaea90d4298c6fa5
--
2.54.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.