]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Add a new regression test over struct expr field
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Mon, 20 May 2024 15:57:52 +0000 (17:57 +0200)
committerP-E-P <32375388+P-E-P@users.noreply.github.com>
Wed, 12 Jun 2024 09:11:18 +0000 (09:11 +0000)
We want to prevent regressions on struct expr field attribute parsing.

gcc/testsuite/ChangeLog:

* rust/compile/struct_expr_field_attributes.rs: New test.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
gcc/testsuite/rust/compile/struct_expr_field_attributes.rs [new file with mode: 0644]

diff --git a/gcc/testsuite/rust/compile/struct_expr_field_attributes.rs b/gcc/testsuite/rust/compile/struct_expr_field_attributes.rs
new file mode 100644 (file)
index 0000000..b5d65dc
--- /dev/null
@@ -0,0 +1,22 @@
+pub struct Test {
+    #[cfg(not(any(
+        target_os = "solaris",
+        target_os = "illumos",
+        target_os = "fuchsia",
+        target_os = "redox",
+    )))]
+    value: bool,
+    // { dg-warning "field is never read" "" { target *-*-* } .-1 }
+}
+
+pub fn test() -> Test {
+    Test {
+        #[cfg(not(any(
+            target_os = "solaris",
+            target_os = "illumos",
+            target_os = "fuchsia",
+            target_os = "redox",
+        )))]
+        value: false,
+    }
+}