aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2021-06-28 23:12:05 +0200
committerMark Wielaard <mark@klomp.org>2021-06-28 23:30:58 +0200
commit1eb53a9d7a82e9ad408ad7253263859203065160 (patch)
tree757e4cb0d6d92d3eb8deb07723e9beb0660560da /gcc
parentbab6f6bcb299ac42096783cda32b8f11da4288ca (diff)
downloadgcc-1eb53a9d7a82e9ad408ad7253263859203065160.zip
gcc-1eb53a9d7a82e9ad408ad7253263859203065160.tar.gz
gcc-1eb53a9d7a82e9ad408ad7253263859203065160.tar.bz2
Suppress warning in rust-ast-lower-type.h ASTLowerGenericParam.visit.
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.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/rust/hir/rust-ast-lower-type.h2
1 files changed, 2 insertions, 0 deletions
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 (),