From 08b8a139c9e8adcb4ec12a8a17e5836b8b5acb63 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sun, 18 Oct 2020 11:38:10 -0600 Subject: Rewrite registry.h This rewrites registry.h, removing all the macros and replacing it with relatively ordinary template classes. The result is less code than the previous setup. It replaces large macros with a relatively straightforward C++ class, and now manages its own cleanup. The existing type-safe "key" class is replaced with the equivalent template class. This approach ended up requiring relatively few changes to the users of the registry code in gdb -- code using the key system just required a small change to the key's declaration. All existing users of the old C-like API are now converted to use the type-safe API. This mostly involved changing explicit deletion functions to be an operator() in a deleter class. The old "save/free" two-phase process is removed, and replaced with a single "free" phase. No existing code used both phases. The old "free" callbacks took a parameter for the enclosing container object. However, this wasn't truly needed and is removed here as well. --- gdb/objc-lang.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gdb/objc-lang.c') diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c index 37008da..4429d4a 100644 --- a/gdb/objc-lang.c +++ b/gdb/objc-lang.c @@ -76,7 +76,7 @@ struct objc_method { CORE_ADDR imp; }; -static const struct objfile_key objc_objfile_data; +static const registry::key objc_objfile_data; /* Lookup a structure type named "struct NAME", visible in lexical block BLOCK. If NOERR is nonzero, return zero if NAME is not -- cgit v1.1