aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog9
-rw-r--r--gdb/common/traits.h2
-rw-r--r--gdb/objfiles.c10
3 files changed, 15 insertions, 6 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 5eb5eea..45e6ff7 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,12 @@
+2018-05-20 Simon Marchi <simon.marchi@polymtl.ca>
+
+ * common/traits.h (HAVE_IS_TRIVIALLY_COPYABLE): Rename the wrong
+ instance to...
+ (HAVE_IS_TRIVIALLY_CONSTRUCTIBLE): ... this.
+ * objfiles.c (get_objfile_bfd_data): Allocate
+ objfile_per_bfd_storage with obstack_new when allocating on
+ obstack.
+
2018-05-20 Simon Marchi <simon.marchi@ericsson.com>
* ada-lang.c (cache_symbol): Use XOBNEW and/or XOBNEWVEC and/or
diff --git a/gdb/common/traits.h b/gdb/common/traits.h
index 070ef15..e1066e0 100644
--- a/gdb/common/traits.h
+++ b/gdb/common/traits.h
@@ -38,7 +38,7 @@
in GCC 5. */
#if (__has_feature(is_trivially_constructible) \
|| (defined __GNUC__ && __GNUC__ >= 5))
-# define HAVE_IS_TRIVIALLY_COPYABLE 1
+# define HAVE_IS_TRIVIALLY_CONSTRUCTIBLE 1
#endif
namespace gdb {
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index 2ec358a..f57f4f5 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -144,14 +144,14 @@ get_objfile_bfd_data (struct objfile *objfile, struct bfd *abfd)
storage
= ((struct objfile_per_bfd_storage *)
bfd_alloc (abfd, sizeof (struct objfile_per_bfd_storage)));
+ /* objfile_per_bfd_storage is not trivially constructible, must
+ call the ctor manually. */
+ storage = new (storage) objfile_per_bfd_storage ();
set_bfd_data (abfd, objfiles_bfd_data, storage);
}
else
- storage = XOBNEW (&objfile->objfile_obstack, objfile_per_bfd_storage);
-
- /* objfile_per_bfd_storage is not trivially constructible, must
- call the ctor manually. */
- storage = new (storage) objfile_per_bfd_storage ();
+ storage
+ = obstack_new<objfile_per_bfd_storage> (&objfile->objfile_obstack);
/* Look up the gdbarch associated with the BFD. */
if (abfd != NULL)