public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Convert stabsread.c to type-safe registry API
@ 2019-05-08 22:09 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2019-05-08 22:09 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d772d2abcc163142fc38655896c4704b06dae0b6

commit d772d2abcc163142fc38655896c4704b06dae0b6
Author: Tom Tromey <tom@tromey.com>
Date:   Wed May 1 15:50:33 2019 -0600

    Convert stabsread.c to type-safe registry API
    
    This changes stabsread.c to use the type-safe registry API.
    
    gdb/ChangeLog
    2019-05-08  Tom Tromey  <tom@tromey.com>
    
    	* stabsread.c (rs6000_builtin_type_data): Change type.
    	(rs6000_builtin_type, _initialize_stabsread): Update.

Diff:
---
 gdb/ChangeLog   |  5 +++++
 gdb/stabsread.c | 11 +++++------
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index ba67e17..0d4b3ae 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
 2019-05-08  Tom Tromey  <tom@tromey.com>
 
+	* stabsread.c (rs6000_builtin_type_data): Change type.
+	(rs6000_builtin_type, _initialize_stabsread): Update.
+
+2019-05-08  Tom Tromey  <tom@tromey.com>
+
 	* mips-tdep.c (mips_pdr_data): Remove.
 	(_initialize_mips_tdep): Update.
 
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index 3f340db..27414a9 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -2075,13 +2075,14 @@ again:
 /* RS/6000 xlc/dbx combination uses a set of builtin types, starting from -1.
    Return the proper type node for a given builtin type number.  */
 
-static const struct objfile_data *rs6000_builtin_type_data;
+static const struct objfile_key<struct type *,
+				gdb::noop_deleter<struct type *>>
+  rs6000_builtin_type_data;
 
 static struct type *
 rs6000_builtin_type (int typenum, struct objfile *objfile)
 {
-  struct type **negative_types
-    = (struct type **) objfile_data (objfile, rs6000_builtin_type_data);
+  struct type **negative_types = rs6000_builtin_type_data.get (objfile);
 
   /* We recognize types numbered from -NUMBER_RECOGNIZED to -1.  */
 #define NUMBER_RECOGNIZED 34
@@ -2098,7 +2099,7 @@ rs6000_builtin_type (int typenum, struct objfile *objfile)
       /* This includes an empty slot for type number -0.  */
       negative_types = OBSTACK_CALLOC (&objfile->objfile_obstack,
 				       NUMBER_RECOGNIZED + 1, struct type *);
-      set_objfile_data (objfile, rs6000_builtin_type_data, negative_types);
+      rs6000_builtin_type_data.set (objfile, negative_types);
     }
 
   if (negative_types[-typenum] != NULL)
@@ -4800,8 +4801,6 @@ hashname (const char *name)
 void
 _initialize_stabsread (void)
 {
-  rs6000_builtin_type_data = register_objfile_data ();
-
   undef_types_allocated = 20;
   undef_types_length = 0;
   undef_types = XNEWVEC (struct type *, undef_types_allocated);


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

only message in thread, other threads:[~2019-05-08 22:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-08 22:09 [binutils-gdb] Convert stabsread.c to type-safe registry API 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).