From: Mark Wielaard <mark@klomp.org>
To: gcc-rust@gcc.gnu.org
Cc: Mark Wielaard <mark@klomp.org>
Subject: [PATCH] Suppress warning in rust-ast-lower-type.h ASTLowerGenericParam.visit.
Date: Mon, 28 Jun 2021 23:41:47 +0200 [thread overview]
Message-ID: <20210628214147.256049-1-mark@klomp.org> (raw)
Translating the AST LifetimeType to the HIR LifetimeType causes a warning:
warning: ‘ltt’ may be used uninitialized
Add a default clause to the switch statement calling gcc_unreachable.
This will suppress the warning and make sure that if the AST lifetime type
is invalid or a new unknown type we immediately know when lowering the AST.
---
gcc/rust/hir/rust-ast-lower-type.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/gcc/rust/hir/rust-ast-lower-type.h b/gcc/rust/hir/rust-ast-lower-type.h
index 5e19850e8dd..568a806f98d 100644
--- a/gcc/rust/hir/rust-ast-lower-type.h
+++ b/gcc/rust/hir/rust-ast-lower-type.h
@@ -281,6 +281,8 @@ public:
case AST::Lifetime::LifetimeType::WILDCARD:
ltt = HIR::Lifetime::LifetimeType::WILDCARD;
break;
+ default:
+ gcc_unreachable ();
}
HIR::Lifetime lt (mapping, ltt, param.get_lifetime ().get_lifetime_name (),
--
2.32.0
next reply other threads:[~2021-06-28 21:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-28 21:41 Mark Wielaard [this message]
2021-06-28 22:06 ` Marc
2021-06-28 22:47 ` Mark Wielaard
2021-06-28 23:41 ` Mark Wielaard
2021-06-29 6:28 ` Marc
2021-06-29 9:10 ` Mark Wielaard
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=20210628214147.256049-1-mark@klomp.org \
--to=mark@klomp.org \
--cc=gcc-rust@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).