From patchwork Thu Dec 5 21:32:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Terekhov, Mikhail via Gdb-patches" X-Patchwork-Id: 36547 Received: (qmail 85433 invoked by alias); 5 Dec 2019 21:32:40 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 85425 invoked by uid 89); 5 Dec 2019 21:32:39 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=stash X-HELO: mail-qt1-f202.google.com Received: from mail-qt1-f202.google.com (HELO mail-qt1-f202.google.com) (209.85.160.202) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 05 Dec 2019 21:32:38 +0000 Received: by mail-qt1-f202.google.com with SMTP id 42so2404080qtc.19 for ; Thu, 05 Dec 2019 13:32:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=EtoTgtfGO2daTMBcazt//x2klm5BVWZm2IAJe3JNj3E=; b=N3rn6OJHe18CYsj21xtmlKNuYsxR5ixdT7R4vIHvzBwDq3iRbw+MyhJLiuc4EKTq+C jPqKR4gCvk2U+eqx7lfeugYkGu7+6veM4m6I7t2HhqNzEdbl77EYF0AZ+gux5gypeScc RIER8oQTAly68jLJ/Y26IZ2+/AUw03qjBgb0aK/LMBlvnZHucL00xd8FGAd6edGb29eg Ko0l4N1wr+uSfxDjOMOZ7bXupML8ppVPuNFR8JDmc3pxM+CYthIIobZgRpI4TnTcj0cD b+FKhCe9vLrYGa81Ou0MlD76Efn2E78GDDi4WTI4JU6YlF3TXLfCxNP8m3l/gkW9xnLr 4PUg== Date: Thu, 5 Dec 2019 15:32:28 -0600 In-Reply-To: <20191202211550.231100-1-cbiesinger@google.com> Message-Id: <20191205213228.197521-1-cbiesinger@google.com> Mime-Version: 1.0 References: <20191202211550.231100-1-cbiesinger@google.com> Subject: [PATCH v2] Put bcache inside "namespace gdb" X-Patchwork-Original-From: "Christian Biesinger via gdb-patches" From: "Terekhov, Mikhail via Gdb-patches" Reply-To: Christian Biesinger To: gdb-patches@sourceware.org Cc: Christian Biesinger X-IsSubscribed: yes [Updated for https://sourceware.org/ml/gdb-patches/2019-12/msg00073.html, which has been pushed] This avoids a conflict with a system "struct bcache" on Solaris (see e.g. https://www.isi.edu/nsnam/archive/ns-users/webarch/2001/msg05393.html) Note that the Solaris conflict for now only surfaces with --enable-targets=all (which the build bot doesn't use). gdb/ChangeLog: 2019-12-02 Christian Biesinger * bcache.c: Put in namespace gdb. * bcache.h: Likewise. * gdbtypes.c (check_types_worklist): Update. (types_deeply_equal): Update. * macrotab.c (struct macro_table) : Update. (new_macro_table): Update. * macrotab.h (struct bcache): Put this forward declaration inside namespace gdb. (new_macro_table): Update. * objfiles.h (struct objfile_per_bfd_storage) : Update. : Update. * psymtab.h: (psymtab_storage) : Update. Change-Id: I843d5e91f7ccb3db6d1099a8214c15a74510256f --- gdb/bcache.c | 4 ++++ gdb/bcache.h | 4 ++++ gdb/gdbtypes.c | 4 ++-- gdb/macrotab.c | 4 ++-- gdb/macrotab.h | 7 +++++-- gdb/objfiles.h | 4 ++-- gdb/psymtab.h | 2 +- 7 files changed, 20 insertions(+), 9 deletions(-) diff --git a/gdb/bcache.c b/gdb/bcache.c index 497efe96cb..348ad152f6 100644 --- a/gdb/bcache.c +++ b/gdb/bcache.c @@ -25,6 +25,8 @@ #include +namespace gdb { + /* The type used to hold a single bcache string. The user data is stored in d.data. Since it can be any type, it needs to have the same alignment as the most strict alignment of any type on the host @@ -378,3 +380,5 @@ bcache::memory_used () return 0; return obstack_memory_used (&m_cache); } + +} /* namespace gdb */ diff --git a/gdb/bcache.h b/gdb/bcache.h index f26f79dca3..4b2b42e2de 100644 --- a/gdb/bcache.h +++ b/gdb/bcache.h @@ -136,6 +136,8 @@ */ +namespace gdb { + struct bstring; struct bcache @@ -222,4 +224,6 @@ private: void expand_hash_table (); }; +} /* namespace gdb */ + #endif /* BCACHE_H */ diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 775e8c18f9..37fe63599a 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -3813,7 +3813,7 @@ check_types_equal (struct type *type1, struct type *type2, static bool check_types_worklist (std::vector *worklist, - struct bcache *cache) + gdb::bcache *cache) { while (!worklist->empty ()) { @@ -3849,7 +3849,7 @@ types_deeply_equal (struct type *type1, struct type *type2) if (type1 == type2) return true; - struct bcache cache (nullptr, nullptr); + gdb::bcache cache (nullptr, nullptr); worklist.emplace_back (type1, type2); return check_types_worklist (&worklist, &cache); } diff --git a/gdb/macrotab.c b/gdb/macrotab.c index 90f29439c0..e500cf5cbe 100644 --- a/gdb/macrotab.c +++ b/gdb/macrotab.c @@ -40,7 +40,7 @@ struct macro_table /* The bcache we should use to hold macro names, argument names, and definitions, or zero if we should use xmalloc. */ - struct bcache *bcache; + gdb::bcache *bcache; /* The main source file for this compilation unit --- the one whose name was given to the compiler. This is the root of the @@ -1025,7 +1025,7 @@ macro_for_each_in_scope (struct macro_source_file *file, int line, struct macro_table * -new_macro_table (struct obstack *obstack, struct bcache *b, +new_macro_table (struct obstack *obstack, gdb::bcache *b, struct compunit_symtab *cust) { struct macro_table *t; diff --git a/gdb/macrotab.h b/gdb/macrotab.h index 045d1625a1..83a7dfad23 100644 --- a/gdb/macrotab.h +++ b/gdb/macrotab.h @@ -23,9 +23,12 @@ #include "gdbsupport/function-view.h" struct obstack; -struct bcache; struct compunit_symtab; +namespace gdb { +struct bcache; +} + /* How do we represent a source location? I mean, how should we represent them within GDB; the user wants to use all sorts of ambiguous abbreviations, like "break 32" and "break foo.c:32" @@ -170,7 +173,7 @@ struct macro_source_file the same source location (although 'gcc -DFOO -UFOO -DFOO=2' does do that in GCC 4.1.2.). */ struct macro_table *new_macro_table (struct obstack *obstack, - struct bcache *bcache, + gdb::bcache *bcache, struct compunit_symtab *cust); diff --git a/gdb/objfiles.h b/gdb/objfiles.h index 0c044582e4..1601cfe591 100644 --- a/gdb/objfiles.h +++ b/gdb/objfiles.h @@ -244,11 +244,11 @@ struct objfile_per_bfd_storage /* Byte cache for file names. */ - struct bcache filename_cache; + gdb::bcache filename_cache; /* Byte cache for macros. */ - struct bcache macro_cache; + gdb::bcache macro_cache; /* The gdbarch associated with the BFD. Note that this gdbarch is determined solely from BFD information, without looking at target diff --git a/gdb/psymtab.h b/gdb/psymtab.h index a4ac35a791..a4281c80bf 100644 --- a/gdb/psymtab.h +++ b/gdb/psymtab.h @@ -120,7 +120,7 @@ public: /* A byte cache where we can stash arbitrary "chunks" of bytes that will not change. */ - struct bcache psymbol_cache; + gdb::bcache psymbol_cache; /* Vectors of all partial symbols read in from file. The actual data is stored in the objfile_obstack. */