From: Richard Biener <rguenther@suse.de>
To: gcc-patches@gcc.gnu.org
Cc: jakub@redhat.com
Subject: [PATCH] c++/97197 - support TARGET_MEM_REF in C/C++ error pretty-printing
Date: Fri, 25 Sep 2020 13:11:37 +0200 (CEST) [thread overview]
Message-ID: <nycvar.YFH.7.76.2009251311080.5031@elmra.sevgm.obk> (raw)
This adds rough support to avoid "'target_mem_ref' not supported by"
in diagnostics. There were recent patches by Martin to sanitize
dumping of MEM_REF so I'm not trying to interfere with this here.
Bootstrap & regtest pending.
OK?
2020-09-25 Richard Biener <rguenther@suse.de>
PR c++/97197
cp/
* error.c (dump_expr): Handle TARGET_MEM_REF as if it
were MEM_REF.
c-family/
* c-pretty-print.c (c_pretty_printer::postfix_expression):
Handle TARGET_MEM_REF as expression.
(c_pretty_printer::expression): Handle TARGET_MEM_REF as
unary_expression.
(c_pretty_printer::unary_expression): Handle TARGET_MEM_REF
as if it were MEM_REF.
---
gcc/c-family/c-pretty-print.c | 3 +++
gcc/cp/error.c | 1 +
2 files changed, 4 insertions(+)
diff --git a/gcc/c-family/c-pretty-print.c b/gcc/c-family/c-pretty-print.c
index acffd7b872c..1a0edb82312 100644
--- a/gcc/c-family/c-pretty-print.c
+++ b/gcc/c-family/c-pretty-print.c
@@ -1693,6 +1693,7 @@ c_pretty_printer::postfix_expression (tree e)
break;
case MEM_REF:
+ case TARGET_MEM_REF:
expression (e);
break;
@@ -1833,6 +1834,7 @@ c_pretty_printer::unary_expression (tree e)
break;
case MEM_REF:
+ case TARGET_MEM_REF:
if (TREE_CODE (TREE_OPERAND (e, 0)) == ADDR_EXPR
&& integer_zerop (TREE_OPERAND (e, 1)))
expression (TREE_OPERAND (TREE_OPERAND (e, 0), 0));
@@ -2295,6 +2297,7 @@ c_pretty_printer::expression (tree e)
case ADDR_EXPR:
case INDIRECT_REF:
case MEM_REF:
+ case TARGET_MEM_REF:
case NEGATE_EXPR:
case BIT_NOT_EXPR:
case TRUTH_NOT_EXPR:
diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index ecb41e82d8c..c9a0c1e0288 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -2372,6 +2372,7 @@ dump_expr (cxx_pretty_printer *pp, tree t, int flags)
break;
case MEM_REF:
+ case TARGET_MEM_REF:
if (TREE_CODE (TREE_OPERAND (t, 0)) == ADDR_EXPR
&& integer_zerop (TREE_OPERAND (t, 1)))
dump_expr (pp, TREE_OPERAND (TREE_OPERAND (t, 0), 0), flags);
--
2.26.2
next reply other threads:[~2020-09-25 11:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-25 11:11 Richard Biener [this message]
2020-09-25 11:20 ` Jakub Jelinek
2020-09-25 11:37 ` Richard Biener
2020-09-25 13:38 ` [PATCH v2] " Jakub Jelinek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=nycvar.YFH.7.76.2009251311080.5031@elmra.sevgm.obk \
--to=rguenther@suse.de \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).