From 5c7dacd845ffb4b9a101308bc14241e7e9b939f8 Mon Sep 17 00:00:00 2001 From: SimplyTheOther Date: Fri, 5 Feb 2021 21:49:35 +0800 Subject: Added some debug for cfg stripping and improved dump messages --- gcc/rust/expand/rust-macro-expand.cc | 7 ++++++- gcc/rust/rust-session-manager.cc | 11 +++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) (limited to 'gcc') diff --git a/gcc/rust/expand/rust-macro-expand.cc b/gcc/rust/expand/rust-macro-expand.cc index cfd587b..29fc58b 100644 --- a/gcc/rust/expand/rust-macro-expand.cc +++ b/gcc/rust/expand/rust-macro-expand.cc @@ -1504,7 +1504,7 @@ public: return; } - // TODO: strip sub-patterns of pattern + // strip sub-patterns of pattern auto &pattern = expr.get_pattern (); pattern->accept_vis (*this); if (pattern->is_marked_for_strip ()) @@ -3283,7 +3283,12 @@ MacroExpander::fails_cfg_with_expand (std::vector &attrs) const attr.parse_attr_to_meta_item (); if (!attr.check_cfg_predicate (session)) + { + // DEBUG + fprintf (stderr, "cfg predicate failed for attribute: \033[0;31m'%s'\033[0m\n", attr.as_string ()); + return true; + } } } return false; diff --git a/gcc/rust/rust-session-manager.cc b/gcc/rust/rust-session-manager.cc index 281049d..dcdbd49 100644 --- a/gcc/rust/rust-session-manager.cc +++ b/gcc/rust/rust-session-manager.cc @@ -363,7 +363,8 @@ Session::enable_dump (std::string arg) rust_error_at ( Location (), "dumping all is not supported as of now. choose %, %, " - "or %"); + "%, %, %, %," + " %, or %"); return false; } else if (arg == "lex") @@ -406,15 +407,17 @@ Session::enable_dump (std::string arg) else if (arg == "") { rust_error_at (Location (), "dump option was not given a name. choose " - "%, %, or %"); + "%, %, %, %, " + "%, %, %, or %"); return false; } else { rust_error_at ( Location (), - "dump option %qs was unrecognised. choose %, %, or " - "%", + "dump option %qs was unrecognised. choose %, %, " + "%, %, %, %," + " %, or %", arg.c_str ()); return false; } -- cgit v1.1