From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gnu.wildebeest.org (wildebeest.demon.nl [212.238.236.112]) by sourceware.org (Postfix) with ESMTPS id C4C293858005 for ; Mon, 28 Jun 2021 21:41:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C4C293858005 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=klomp.org Received: from reform (deer0x0c.wildebeest.org [172.31.17.142]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id B0C0F30012C7; Mon, 28 Jun 2021 23:41:52 +0200 (CEST) Received: by reform (Postfix, from userid 1000) id 286D22E80D21; Mon, 28 Jun 2021 23:41:52 +0200 (CEST) From: Mark Wielaard To: gcc-rust@gcc.gnu.org Cc: Mark Wielaard Subject: [PATCH] Suppress warning in rust-ast-lower-type.h ASTLowerGenericParam.visit. Date: Mon, 28 Jun 2021 23:41:47 +0200 Message-Id: <20210628214147.256049-1-mark@klomp.org> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-rust@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: gcc-rust mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jun 2021 21:41:56 -0000 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