Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [RFA 3/3] Fix "obvious" fall-through warnings
Date: Tue, 27 Sep 2016 18:52:00 -0000	[thread overview]
Message-ID: <1475000192-8789-4-git-send-email-tom@tromey.com> (raw)
In-Reply-To: <1475000192-8789-1-git-send-email-tom@tromey.com>

This patch fixes the subset of -Wimplicit-fallthrough warnings that I
considered obvious.  In most cases it was obvious from context that
falling through was desired; here I added the appropriate comment.  In
a couple of cases it seemed clear that a "break" was missing.

2016-09-27  Tom Tromey  <tom@tromey.com>

	* utils.c (can_dump_core) <LIMIT_CUR>: Add fall-through comment.
	* mi/mi-main.c (mi_cmd_trace_frame_collected) <REGISTERS_FORMAT>:
	Add missing "break".
	* mi/mi-cmd-stack.c (mi_cmd_stack_list_locals) <NO_FRAME_FILTERS>:
	Add missing "break".
	* eval.c (fetch_subexp_value) <MEMORY_ERROR>: Add fall-through
	comment.
	* d-valprint.c (d_val_print) <TYPE_CODE_STRUCT>: Add fall-through
	comment.
	* coffread.c (coff_symtab_read) <C_LABEL>: Add fall-through
	comment.
---
 gdb/ChangeLog         | 14 ++++++++++++++
 gdb/coffread.c        |  1 +
 gdb/d-valprint.c      |  1 +
 gdb/eval.c            |  1 +
 gdb/mi/mi-cmd-stack.c |  1 +
 gdb/mi/mi-main.c      |  1 +
 gdb/utils.c           |  1 +
 7 files changed, 20 insertions(+)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 83b051f..511dedc 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,19 @@
 2016-09-27  Tom Tromey  <tom@tromey.com>
 
+	* utils.c (can_dump_core) <LIMIT_CUR>: Add fall-through comment.
+	* mi/mi-main.c (mi_cmd_trace_frame_collected) <REGISTERS_FORMAT>:
+	Add missing "break".
+	* mi/mi-cmd-stack.c (mi_cmd_stack_list_locals) <NO_FRAME_FILTERS>:
+	Add missing "break".
+	* eval.c (fetch_subexp_value) <MEMORY_ERROR>: Add fall-through
+	comment.
+	* d-valprint.c (d_val_print) <TYPE_CODE_STRUCT>: Add fall-through
+	comment.
+	* coffread.c (coff_symtab_read) <C_LABEL>: Add fall-through
+	comment.
+
+2016-09-27  Tom Tromey  <tom@tromey.com>
+
 	* dwarf2loc.c (unimplemented): Add ATTRIBUTE_NORETURN.
 	* completer.h (throw_max_completions_reached_error): Add
 	ATTRIBUTE_NORETURN.
diff --git a/gdb/coffread.c b/gdb/coffread.c
index 49d6803..d3ebe97 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -932,6 +932,7 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms,
 	     backtraces, so filter them out (from phdm@macqel.be).  */
 	  if (within_function)
 	    break;
+	  /* Fall through.  */
 	case C_STAT:
 	case C_THUMBLABEL:
 	case C_THUMBSTAT:
diff --git a/gdb/d-valprint.c b/gdb/d-valprint.c
index 620688b..4166a59 100644
--- a/gdb/d-valprint.c
+++ b/gdb/d-valprint.c
@@ -88,6 +88,7 @@ d_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
 				  stream, recurse, val, options);
 	if (ret == 0)
 	  break;
+	/* Fall through.  */
       default:
 	c_val_print (type, valaddr, embedded_offset, address, stream,
 		     recurse, val, options);
diff --git a/gdb/eval.c b/gdb/eval.c
index 00a107c..1f2fb00 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -237,6 +237,7 @@ fetch_subexp_value (struct expression *exp, int *pc, struct value **valp,
 	case MEMORY_ERROR:
 	  if (!preserve_errors)
 	    break;
+	  /* Fall through.  */
 	default:
 	  throw_exception (ex);
 	  break;
diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c
index 390fc7e..b51650d 100644
--- a/gdb/mi/mi-cmd-stack.c
+++ b/gdb/mi/mi-cmd-stack.c
@@ -246,6 +246,7 @@ mi_cmd_stack_list_locals (char *command, char **argv, int argc)
 	    {
 	    case NO_FRAME_FILTERS:
 	      raw_arg = oind;
+	      break;
 	    case SKIP_UNAVAILABLE:
 	      skip_unavailable = 1;
 	      break;
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index 1913157..3b604e5 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -2815,6 +2815,7 @@ mi_cmd_trace_frame_collected (char *command, char **argv, int argc)
 	  break;
 	case REGISTERS_FORMAT:
 	  registers_format = oarg[0];
+	  break;
 	case MEMORY_CONTENTS:
 	  memory_contents = 1;
 	  break;
diff --git a/gdb/utils.c b/gdb/utils.c
index 9a83053..9d11780 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -562,6 +562,7 @@ can_dump_core (enum resource_limit_kind limit_kind)
     case LIMIT_CUR:
       if (rlim.rlim_cur == 0)
 	return 0;
+      /* Fall through.  */
 
     case LIMIT_MAX:
       if (rlim.rlim_max == 0)
-- 
2.7.4


      parent reply	other threads:[~2016-09-27 18:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-27 18:16 [RFA 0/3] Fix some -Wimplicit-fallthrough warnings Tom Tromey
2016-09-27 18:16 ` [RFA 2/3] Add missing ATTRIBUTE_NORETURNs Tom Tromey
2016-09-28  7:28   ` Yao Qi
2016-09-28 17:40     ` Tom Tromey
2016-09-28 17:41       ` Yao Qi
2016-09-27 18:16 ` [RFA 1/3] Fix "fall through" comments Tom Tromey
2016-09-27 21:48   ` Yao Qi
2016-09-27 21:53     ` Tom Tromey
2016-09-28 21:51       ` Yao Qi
2016-09-28 21:58         ` Tom Tromey
2016-09-30 21:09           ` Yao Qi
2016-09-27 18:52 ` Tom Tromey [this message]

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=1475000192-8789-4-git-send-email-tom@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.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