diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-06-04 10:50:08 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-04 10:50:08 +0000 |
commit | f408033d52dcb3069ccc1b4ce5d467505abe9090 (patch) | |
tree | 80cab08459e22566c1e75bf23a4e33e3f988de8f /gcc/rust | |
parent | ff4715d79e2c17d270db8b94315aa6b574f48994 (diff) | |
parent | 4e43d678e2d9e8a0a155b33aeebb87d847527ac9 (diff) | |
download | gcc-f408033d52dcb3069ccc1b4ce5d467505abe9090.zip gcc-f408033d52dcb3069ccc1b4ce5d467505abe9090.tar.gz gcc-f408033d52dcb3069ccc1b4ce5d467505abe9090.tar.bz2 |
Merge #480
480: Use '-frust-debug' to control dumping of various Rust front end internals r=philberty a=tschwinge
... as discussed in #479, and elsewhere.
Co-authored-by: Thomas Schwinge <thomas@codesourcery.com>
Diffstat (limited to 'gcc/rust')
-rw-r--r-- | gcc/rust/lang.opt | 4 | ||||
-rw-r--r-- | gcc/rust/rust-diagnostics.cc | 3 | ||||
-rw-r--r-- | gcc/rust/rust-diagnostics.h | 2 | ||||
-rw-r--r-- | gcc/rust/rust-gcc-diagnostics.cc | 8 |
4 files changed, 17 insertions, 0 deletions
diff --git a/gcc/rust/lang.opt b/gcc/rust/lang.opt index 4757dfb..707feeb 100644 --- a/gcc/rust/lang.opt +++ b/gcc/rust/lang.opt @@ -35,6 +35,10 @@ L Rust Joined Separate ; Not documented +frust-debug +Rust Var(flag_rust_debug) +Dump various Rust front end internals. + frust-dump- Rust Joined RejectNegative -frust-dump-<type> Dump Rust frontend internal information. diff --git a/gcc/rust/rust-diagnostics.cc b/gcc/rust/rust-diagnostics.cc index 27ce54e..6f405c9 100644 --- a/gcc/rust/rust-diagnostics.cc +++ b/gcc/rust/rust-diagnostics.cc @@ -200,6 +200,9 @@ rust_error_at (const RichLocation location, const char *fmt, ...) void rust_debug (const Location location, const char *fmt, ...) { + if (!rust_be_debug_p ()) + return; + va_list ap; va_start (ap, fmt); diff --git a/gcc/rust/rust-diagnostics.h b/gcc/rust/rust-diagnostics.h index cd9b13e..6c179f9 100644 --- a/gcc/rust/rust-diagnostics.h +++ b/gcc/rust/rust-diagnostics.h @@ -93,6 +93,8 @@ extern void rust_be_inform (const Location, const std::string &infomsg); extern void rust_be_get_quotechars (const char **open_quote, const char **close_quote); +extern bool +rust_be_debug_p (void); namespace Rust { /* A structure used to represent an error. Useful for enabling diff --git a/gcc/rust/rust-gcc-diagnostics.cc b/gcc/rust/rust-gcc-diagnostics.cc index 11da6a3..de8acc8 100644 --- a/gcc/rust/rust-gcc-diagnostics.cc +++ b/gcc/rust/rust-gcc-diagnostics.cc @@ -21,6 +21,8 @@ #include "rust-system.h" #include "rust-diagnostics.h" +#include "options.h" + void rust_be_error_at (const Location location, const std::string &errmsg) { @@ -63,3 +65,9 @@ rust_be_get_quotechars (const char **open_qu, const char **close_qu) *open_qu = open_quote; *close_qu = close_quote; } + +bool +rust_be_debug_p (void) +{ + return !!flag_rust_debug; +} |