From: Marek Polacek <polacek@redhat.com>
To: GCC Patches <gcc-patches@gcc.gnu.org>,
Eric Botcazou <ebotcazou@adacore.com>,
Martin Jambor <mjambor@suse.cz>
Subject: [PATCH] Fix a few fall through cases
Date: Tue, 09 Aug 2016 15:21:00 -0000 [thread overview]
Message-ID: <20160809152126.GQ7007@redhat.com> (raw)
Testing with -Wimplicit-fallthrough turned up a few spots where
fall through is either a bug, or just too confusing. This patch
should be desirable even though the warning is still not in.
Eric, can you look at the c-ada-spec.c part?
Martin, does the hsa-gen.c part look correct?
What about the rest?
Bootstrapped/regtested on x86_64-linux and ppc64le-redhat-linux.
2016-08-09 Marek Polacek <polacek@redhat.com>
PR c/7652
gcc/c-family/
* c-ada-spec.c (dump_generic_ada_node): Add return.
gcc/
* cselib.c (cselib_expand_value_rtx_1): Add return.
* gengtype.c (dbgprint_count_type_at): Likewise.
* hsa-gen.c (gen_hsa_insn_for_internal_fn_call): Likewise.
* reg-stack.c (get_true_reg): Restructure to avoid fallthrough warning.
diff --git gcc/gcc/c-family/c-ada-spec.c gcc/gcc/c-family/c-ada-spec.c
index e33fdff..17b8610 100644
--- gcc/gcc/c-family/c-ada-spec.c
+++ gcc/gcc/c-family/c-ada-spec.c
@@ -1862,6 +1862,7 @@ dump_generic_ada_node (pretty_printer *buffer, tree node, tree type, int spc,
case TREE_BINFO:
dump_generic_ada_node
(buffer, BINFO_TYPE (node), type, spc, limited_access, name_only);
+ return 0;
case TREE_VEC:
pp_string (buffer, "--- unexpected node: TREE_VEC");
diff --git gcc/gcc/cselib.c gcc/gcc/cselib.c
index 0c5183c..1277842 100644
--- gcc/gcc/cselib.c
+++ gcc/gcc/cselib.c
@@ -1618,6 +1618,7 @@ cselib_expand_value_rtx_1 (rtx orig, struct expand_value_data *evd,
else
return orig;
}
+ return orig;
}
CASE_CONST_ANY:
diff --git gcc/gcc/gengtype.c gcc/gcc/gengtype.c
index 5479b8f..0518355 100644
--- gcc/gcc/gengtype.c
+++ gcc/gcc/gengtype.c
@@ -175,6 +175,7 @@ dbgprint_count_type_at (const char *fil, int lin, const char *msg, type_p t)
{
case TYPE_UNDEFINED:
nb_undefined++;
+ break;
case TYPE_SCALAR:
nb_scalar++;
break;
diff --git gcc/gcc/hsa-gen.c gcc/gcc/hsa-gen.c
index 6cf1538..fa4ef12 100644
--- gcc/gcc/hsa-gen.c
+++ gcc/gcc/hsa-gen.c
@@ -5039,6 +5039,7 @@ gen_hsa_insn_for_internal_fn_call (gcall *stmt, hsa_bb *hbb)
case IFN_FMIN:
case IFN_FMAX:
gen_hsa_insns_for_call_of_internal_fn (stmt, hbb);
+ break;
default:
HSA_SORRY_ATV (gimple_location (stmt),
diff --git gcc/gcc/reg-stack.c gcc/gcc/reg-stack.c
index c931349..907f28d 100644
--- gcc/gcc/reg-stack.c
+++ gcc/gcc/reg-stack.c
@@ -423,23 +423,25 @@ get_true_reg (rtx *pat)
GET_MODE (subreg));
return pat;
}
+ pat = &XEXP (*pat, 0);
+ break;
}
case FLOAT:
case FIX:
case FLOAT_EXTEND:
- pat = & XEXP (*pat, 0);
+ pat = &XEXP (*pat, 0);
break;
case UNSPEC:
if (XINT (*pat, 1) == UNSPEC_TRUNC_NOOP
|| XINT (*pat, 1) == UNSPEC_FILD_ATOMIC)
- pat = & XVECEXP (*pat, 0, 0);
+ pat = &XVECEXP (*pat, 0, 0);
return pat;
case FLOAT_TRUNCATE:
if (!flag_unsafe_math_optimizations)
return pat;
- pat = & XEXP (*pat, 0);
+ pat = &XEXP (*pat, 0);
break;
default:
Marek
next reply other threads:[~2016-08-09 15:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-09 15:21 Marek Polacek [this message]
2016-08-09 15:42 ` Jakub Jelinek
2016-08-09 15:51 ` Martin Jambor
2016-08-09 16:18 ` Eric Botcazou
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=20160809152126.GQ7007@redhat.com \
--to=polacek@redhat.com \
--cc=ebotcazou@adacore.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=mjambor@suse.cz \
/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).