public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 5/9] minor cleanup, removing a goto
@ 2012-09-07 18:49 Tom Tromey
  2012-09-18 14:40 ` Joel Brobecker
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Tromey @ 2012-09-07 18:49 UTC (permalink / raw)
  To: gdb-patches

This is just a minor cleanup to avoid a goto.  This makes a subsequent
change easier.

Built and regtested on x86-64 F16.

	* c-typeprint.c (c_type_print_base) <TYPE_CODE_STRUCT,
	TYPE_CODE_UNION>: Unify, removing a goto.
---
 gdb/c-typeprint.c |   12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c
index 22207bc..661ce09 100644
--- a/gdb/c-typeprint.c
+++ b/gdb/c-typeprint.c
@@ -774,18 +774,14 @@ c_type_print_base (struct type *type, struct ui_file *stream,
       break;
 
     case TYPE_CODE_STRUCT:
+    case TYPE_CODE_UNION:
       c_type_print_modifier (type, stream, 0, 1);
-      if (TYPE_DECLARED_CLASS (type))
+      if (TYPE_CODE (type) == TYPE_CODE_UNION)
+	fprintf_filtered (stream, "union ");
+      else if (TYPE_DECLARED_CLASS (type))
 	fprintf_filtered (stream, "class ");
       else
 	fprintf_filtered (stream, "struct ");
-      goto struct_union;
-
-    case TYPE_CODE_UNION:
-      c_type_print_modifier (type, stream, 0, 1);
-      fprintf_filtered (stream, "union ");
-
-    struct_union:
 
       /* Print the tag if it exists.  The HP aCC compiler emits a
          spurious "{unnamed struct}"/"{unnamed union}"/"{unnamed
-- 
1.7.7.6

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 5/9] minor cleanup, removing a goto
  2012-09-07 18:49 [PATCH 5/9] minor cleanup, removing a goto Tom Tromey
@ 2012-09-18 14:40 ` Joel Brobecker
  2012-09-20 21:00   ` Tom Tromey
  0 siblings, 1 reply; 3+ messages in thread
From: Joel Brobecker @ 2012-09-18 14:40 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

> Built and regtested on x86-64 F16.
> 
> 	* c-typeprint.c (c_type_print_base) <TYPE_CODE_STRUCT,
> 	TYPE_CODE_UNION>: Unify, removing a goto.

This change could probably go in now, independently of the rest, no?
Seems like a pretty nice cleanup, much easier to understand the code...

-- 
Joel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 5/9] minor cleanup, removing a goto
  2012-09-18 14:40 ` Joel Brobecker
@ 2012-09-20 21:00   ` Tom Tromey
  0 siblings, 0 replies; 3+ messages in thread
From: Tom Tromey @ 2012-09-20 21:00 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

>>>>> "Joel" == Joel Brobecker <brobecker@adacore.com> writes:

Joel> This change could probably go in now, independently of the rest, no?
Joel> Seems like a pretty nice cleanup, much easier to understand the code...

Yeah, I will put it in tomorrow.

Tom

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-09-20 21:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-07 18:49 [PATCH 5/9] minor cleanup, removing a goto Tom Tromey
2012-09-18 14:40 ` Joel Brobecker
2012-09-20 21:00   ` Tom Tromey

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