public inbox for gcc-rust@gcc.gnu.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
To: gcc-rust@gcc.gnu.org
Cc: Mark Wielaard <mark@klomp.org>
Subject: [PATCH] Suppress uninitialized candidate_type warning in process_traits_for_candidates
Date: Sun, 15 Aug 2021 18:05:04 +0200	[thread overview]
Message-ID: <20210815160504.12607-1-mark@klomp.org> (raw)

Without handling the default case in the switch statement gcc 10.2.1 will warn:

rust-hir-path-probe.h:75:40: warning: ‘candidate_type’ may be used uninitialized
  in this function [-Wmaybe-uninitialized]
---
 gcc/rust/typecheck/rust-hir-path-probe.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gcc/rust/typecheck/rust-hir-path-probe.h b/gcc/rust/typecheck/rust-hir-path-probe.h
index 87c96628118..22b10741094 100644
--- a/gcc/rust/typecheck/rust-hir-path-probe.h
+++ b/gcc/rust/typecheck/rust-hir-path-probe.h
@@ -260,6 +260,7 @@ private:
 	    break;
 
 	  case TraitItemReference::TraitItemType::ERROR:
+	  default:
 	    gcc_unreachable ();
 	    break;
 	  }
-- 
2.32.0


                 reply	other threads:[~2021-08-15 16:05 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20210815160504.12607-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).