]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Prevent initialization related warnings/errors for Optional
authorOwen Avery <powerboat9.gamer@gmail.com>
Mon, 5 Jun 2023 19:54:08 +0000 (15:54 -0400)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 17:46:24 +0000 (18:46 +0100)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80635#c53

gcc/rust/ChangeLog:

* util/rust-optional.h
(class Optional): Add volatile field to union.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
gcc/rust/util/rust-optional.h

index 30880cd41db0dd8722ad0b71c64d81f8f8d40e24..e545c1596cee2b22bb71ec021485bcf64b70b51e 100644 (file)
@@ -86,6 +86,10 @@ private:
   union
   {
     T value;
+    // prevents initialization warnings
+    // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80635#c53
+    // FIXME: remove
+    volatile char unused;
   };
 
   Optional (tag_some, const T &value) : field_is_some (true), value (value) {}