Fix copy-pasto, allocate objfile_per_bfd_storage with obstack_new
I realized after pushing that I made a copy-pasto, I had: # define HAVE_IS_TRIVIALLY_COPYABLE 1 instead of # define HAVE_IS_TRIVIALLY_CONSTRUCTIBLE 1 with the consequence that IsMallocable was always std::true_type (and was therefore not enforcing anything). Fixing that mistake triggered a build failure: /home/simark/src/binutils-gdb/gdb/objfiles.c:150:12: required from here /home/simark/src/binutils-gdb/gdb/common/poison.h:228:3: error: static assertion failed: Trying to use XOBNEW with a non-POD data type. I am not sure why I did not see this when I originally wrote the patch (but I saw and fixed other failures). In any case, I swapped XOBNEW with obstack_new to get rid of it. Regtested on the buildbot. gdb/ChangeLog: * 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.
This commit is contained in:
parent
e39db4db7c
commit
184cde7552
3 changed files with 15 additions and 6 deletions
|
@ -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>
|
2018-05-20 Simon Marchi <simon.marchi@ericsson.com>
|
||||||
|
|
||||||
* ada-lang.c (cache_symbol): Use XOBNEW and/or XOBNEWVEC and/or
|
* ada-lang.c (cache_symbol): Use XOBNEW and/or XOBNEWVEC and/or
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
in GCC 5. */
|
in GCC 5. */
|
||||||
#if (__has_feature(is_trivially_constructible) \
|
#if (__has_feature(is_trivially_constructible) \
|
||||||
|| (defined __GNUC__ && __GNUC__ >= 5))
|
|| (defined __GNUC__ && __GNUC__ >= 5))
|
||||||
# define HAVE_IS_TRIVIALLY_COPYABLE 1
|
# define HAVE_IS_TRIVIALLY_CONSTRUCTIBLE 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace gdb {
|
namespace gdb {
|
||||||
|
|
|
@ -144,14 +144,14 @@ get_objfile_bfd_data (struct objfile *objfile, struct bfd *abfd)
|
||||||
storage
|
storage
|
||||||
= ((struct objfile_per_bfd_storage *)
|
= ((struct objfile_per_bfd_storage *)
|
||||||
bfd_alloc (abfd, sizeof (struct objfile_per_bfd_storage)));
|
bfd_alloc (abfd, sizeof (struct 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
|
/* objfile_per_bfd_storage is not trivially constructible, must
|
||||||
call the ctor manually. */
|
call the ctor manually. */
|
||||||
storage = new (storage) objfile_per_bfd_storage ();
|
storage = new (storage) objfile_per_bfd_storage ();
|
||||||
|
set_bfd_data (abfd, objfiles_bfd_data, storage);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
storage
|
||||||
|
= obstack_new<objfile_per_bfd_storage> (&objfile->objfile_obstack);
|
||||||
|
|
||||||
/* Look up the gdbarch associated with the BFD. */
|
/* Look up the gdbarch associated with the BFD. */
|
||||||
if (abfd != NULL)
|
if (abfd != NULL)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue