From 1eb53a9d7a82e9ad408ad7253263859203065160 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Mon, 28 Jun 2021 23:12:05 +0200 Subject: Suppress warning in rust-ast-lower-type.h ASTLowerGenericParam.visit. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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(+) (limited to 'gcc') diff --git a/gcc/rust/hir/rust-ast-lower-type.h b/gcc/rust/hir/rust-ast-lower-type.h index 5e19850..568a806 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 (), -- cgit v1.1