public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [pushed] Remove extraneous blocks from dwarf2/read.c:new_symbol
@ 2023-11-17 18:07 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2023-11-17 18:07 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

dwarf2/read.c:new_symbol has some extra braces in a couple of 'case's.
These read weirdly to me, and since they aren't necessary, this patch
removes the braces and reindents the bodies.  Tested by rebuilding.
---
 gdb/dwarf2/read.c | 84 +++++++++++++++++++++++------------------------
 1 file changed, 41 insertions(+), 43 deletions(-)

diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 7a3b9c68279..e8ff4d8f29a 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -19212,39 +19212,38 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
 	      sym->set_aclass_index (LOC_TYPEDEF);
 	      sym->set_domain (STRUCT_DOMAIN);
 	    }
-	  {
-	    /* NOTE: carlton/2003-11-10: C++ class symbols shouldn't
-	       really ever be static objects: otherwise, if you try
-	       to, say, break of a class's method and you're in a file
-	       which doesn't mention that class, it won't work unless
-	       the check for all static symbols in lookup_symbol_aux
-	       saves you.  See the OtherFileClass tests in
-	       gdb.c++/namespace.exp.  */
-
-	    if (!suppress_add)
-	      {
-		buildsym_compunit *builder = cu->get_builder ();
-		list_to_add
-		  = (cu->list_in_scope == builder->get_file_symbols ()
-		     && cu->lang () == language_cplus
-		     ? builder->get_global_symbols ()
-		     : cu->list_in_scope);
-
-		/* The semantics of C++ state that "struct foo {
-		   ... }" also defines a typedef for "foo".  */
-		if (cu->lang () == language_cplus
-		    || cu->lang () == language_ada
-		    || cu->lang () == language_d
-		    || cu->lang () == language_rust)
-		  {
-		    /* The symbol's name is already allocated along
-		       with this objfile, so we don't need to
-		       duplicate it for the type.  */
-		    if (sym->type ()->name () == 0)
-		      sym->type ()->set_name (sym->search_name ());
-		  }
-	      }
-	  }
+
+	  /* NOTE: carlton/2003-11-10: C++ class symbols shouldn't
+	     really ever be static objects: otherwise, if you try
+	     to, say, break of a class's method and you're in a file
+	     which doesn't mention that class, it won't work unless
+	     the check for all static symbols in lookup_symbol_aux
+	     saves you.  See the OtherFileClass tests in
+	     gdb.c++/namespace.exp.  */
+
+	  if (!suppress_add)
+	    {
+	      buildsym_compunit *builder = cu->get_builder ();
+	      list_to_add
+		= (cu->list_in_scope == builder->get_file_symbols ()
+		   && cu->lang () == language_cplus
+		   ? builder->get_global_symbols ()
+		   : cu->list_in_scope);
+
+	      /* The semantics of C++ state that "struct foo {
+		 ... }" also defines a typedef for "foo".  */
+	      if (cu->lang () == language_cplus
+		  || cu->lang () == language_ada
+		  || cu->lang () == language_d
+		  || cu->lang () == language_rust)
+		{
+		  /* The symbol's name is already allocated along
+		     with this objfile, so we don't need to
+		     duplicate it for the type.  */
+		  if (sym->type ()->name () == 0)
+		    sym->type ()->set_name (sym->search_name ());
+		}
+	    }
 	  break;
 	case DW_TAG_unspecified_type:
 	  if (cu->lang () == language_ada)
@@ -19265,16 +19264,15 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
 	    {
 	      dwarf2_const_value (attr, sym, cu);
 	    }
-	  {
-	    /* NOTE: carlton/2003-11-10: See comment above in the
-	       DW_TAG_class_type, etc. block.  */
-
-	    list_to_add
-	      = (cu->list_in_scope == cu->get_builder ()->get_file_symbols ()
-		 && cu->lang () == language_cplus
-		 ? cu->get_builder ()->get_global_symbols ()
-		 : cu->list_in_scope);
-	  }
+
+	  /* NOTE: carlton/2003-11-10: See comment above in the
+	     DW_TAG_class_type, etc. block.  */
+
+	  list_to_add
+	    = (cu->list_in_scope == cu->get_builder ()->get_file_symbols ()
+	       && cu->lang () == language_cplus
+	       ? cu->get_builder ()->get_global_symbols ()
+	       : cu->list_in_scope);
 	  break;
 	case DW_TAG_imported_declaration:
 	case DW_TAG_namespace:
-- 
2.41.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-11-17 18:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-17 18:07 [pushed] Remove extraneous blocks from dwarf2/read.c:new_symbol 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).