public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Thomas Schwinge <tschwinge@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc/devel/rust/master] tests: add regression tests for more macro expansions
Date: Fri, 22 Jul 2022 13:34:31 +0000 (GMT)	[thread overview]
Message-ID: <20220722133431.277DE38356A7@sourceware.org> (raw)

https://gcc.gnu.org/g:3ce22036e48a4f8805440abcd291ecd35d2ca468

commit 3ce22036e48a4f8805440abcd291ecd35d2ca468
Author: liushuyu <liushuyu011@gmail.com>
Date:   Tue Jul 19 15:38:21 2022 -0600

    tests: add regression tests for more macro expansions

Diff:
---
 gcc/testsuite/rust/compile/{xfail => }/macro_return.rs |  2 +-
 gcc/testsuite/rust/compile/torture/macro_as_expr.rs    | 14 ++++++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/gcc/testsuite/rust/compile/xfail/macro_return.rs b/gcc/testsuite/rust/compile/macro_return.rs
similarity index 72%
rename from gcc/testsuite/rust/compile/xfail/macro_return.rs
rename to gcc/testsuite/rust/compile/macro_return.rs
index c335929cfeb..8b06f875cc0 100644
--- a/gcc/testsuite/rust/compile/xfail/macro_return.rs
+++ b/gcc/testsuite/rust/compile/macro_return.rs
@@ -1,4 +1,4 @@
-// { dg-excess-errors "...." { xfail *-*-*-* *-*-* } }
+// { dg-additional-options "-w" }
 
 macro_rules! add {
     ($a:expr) => { $a };
diff --git a/gcc/testsuite/rust/compile/torture/macro_as_expr.rs b/gcc/testsuite/rust/compile/torture/macro_as_expr.rs
new file mode 100644
index 00000000000..b0084e7b466
--- /dev/null
+++ b/gcc/testsuite/rust/compile/torture/macro_as_expr.rs
@@ -0,0 +1,14 @@
+// { dg-additional-options "-w" }
+
+macro_rules! add {
+    ($a:expr) => { $a };
+    ($a:expr, $($b:expr),+) => { $a + add!($($b),*) }
+}
+
+fn main() -> i32 {
+    if add!(add!(1, 2)) > add!(5) {
+        add!(1, add!(2, 3), add!(4))
+    } else {
+        add!(5, add!(6, 7), add!(8), 9) + 10
+    }
+}


                 reply	other threads:[~2022-07-22 13:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20220722133431.277DE38356A7@sourceware.org \
    --to=tschwinge@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /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).