Put bcache inside "namespace gdb"
authorChristian Biesinger <cbiesinger@google.com>
Mon, 2 Dec 2019 21:05:54 +0000 (15:05 -0600)
committerChristian Biesinger <cbiesinger@google.com>
Fri, 6 Dec 2019 19:19:02 +0000 (13:19 -0600)
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-06  Christian Biesinger  <cbiesinger@google.com>

* bcache.c: Put in namespace gdb.
* bcache.h: Likewise.
* gdbtypes.c (check_types_worklist): Update.
(types_deeply_equal): Update.
* macrotab.c (struct macro_table) <bcache>: 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) <filename_cache>:
Update.
<macro_cache>: Update.
* psymtab.h: (psymtab_storage) <psymbol_cache>: Update.

Change-Id: I843d5e91f7ccb3db6d1099a8214c15a74510256f

gdb/ChangeLog
gdb/bcache.c
gdb/bcache.h
gdb/gdbtypes.c
gdb/macrotab.c
gdb/macrotab.h
gdb/objfiles.h
gdb/psymtab.h

index 55ba8443cdfec1cad0515690b50851b5f78e72f9..f06ad13870afe0166a08152afd14a9d74917160b 100644 (file)
@@ -1,3 +1,19 @@
+2019-12-06  Christian Biesinger  <cbiesinger@google.com>
+
+       * bcache.c: Put in namespace gdb.
+       * bcache.h: Likewise.
+       * gdbtypes.c (check_types_worklist): Update.
+       (types_deeply_equal): Update.
+       * macrotab.c (struct macro_table) <bcache>: 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) <filename_cache>:
+       Update.
+       <macro_cache>: Update.
+       * psymtab.h: (psymtab_storage) <psymbol_cache>: Update.
+
 2019-12-06  Tom de Vries  <tdevries@suse.de>
 
        PR symtab/24971
index 497efe96cbffa8280772d871e4e0e0d472c635a5..348ad152f64f3ebb145c38f45e752030dd029bda 100644 (file)
@@ -25,6 +25,8 @@
 
 #include <algorithm>
 
+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 */
index f26f79dca39c1191e1c60f8fab304e08bb4622e5..4b2b42e2de230b67e3b4046bb1da29f9681e28dc 100644 (file)
   
 */
 
+namespace gdb {
+
 struct bstring;
 
 struct bcache
@@ -222,4 +224,6 @@ private:
   void expand_hash_table ();
 };
 
+} /* namespace gdb */
+
 #endif /* BCACHE_H */
index e226cb7f940ec9e86e730a4772d8fa3ad1571dc5..508628af1f73a99d66b0eec75788c042635432bb 100644 (file)
@@ -3813,7 +3813,7 @@ check_types_equal (struct type *type1, struct type *type2,
 
 static bool
 check_types_worklist (std::vector<type_equality_entry> *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);
 }
index 90f29439c098a0b187967db4678ca66d9a9057c9..e500cf5cbe67f3246ebff74a6a53783adf73e497 100644 (file)
@@ -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;
index 045d1625a19ad810bbc1ac0ab6238eb862e84d71..83a7dfad23a63e628e65577c42abaa0818895c09 100644 (file)
 #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);
 
 
index 0c044582e437f4e1b3ff89d05598c07b44719e2c..1601cfe591f0b4d7031555e9d67f0b2faac0dd7b 100644 (file)
@@ -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
index a4ac35a7916b12393ea612043cd1a017554af9d7..a4281c80bfcd5a1456609e28373e8e0d4d3ce3c7 100644 (file)
@@ -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.  */
This page took 0.036415 seconds and 4 git commands to generate.