aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/util/rust-optional.h
diff options
context:
space:
mode:
authorOwen Avery <powerboat9.gamer@gmail.com>2023-06-05 15:54:08 -0400
committerCohenArthur <arthur.cohen@embecosm.com>2023-06-06 14:59:42 +0000
commit1b322540fa0fce561cf86e371dd7f304f1343511 (patch)
tree3837665deee4eae448e2ab205f48ee6f1117b148 /gcc/rust/util/rust-optional.h
parentd5fddb55d343362a7fe8e059e5d7d14e4b1f8923 (diff)
downloadgcc-1b322540fa0fce561cf86e371dd7f304f1343511.zip
gcc-1b322540fa0fce561cf86e371dd7f304f1343511.tar.gz
gcc-1b322540fa0fce561cf86e371dd7f304f1343511.tar.bz2
Prevent initialization related warnings/errors for Optional
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>
Diffstat (limited to 'gcc/rust/util/rust-optional.h')
-rw-r--r--gcc/rust/util/rust-optional.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/rust/util/rust-optional.h b/gcc/rust/util/rust-optional.h
index d3dfb7f..bdfbd28 100644
--- a/gcc/rust/util/rust-optional.h
+++ b/gcc/rust/util/rust-optional.h
@@ -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) {}