gdb: Fix build failure with GCC 7
[deliverable/binutils-gdb.git] / gdb / objfiles.c
index 6e66a8e51fe97176f57fd0f9a8f68837cc332e9a..d261c87a14808673e4216da71f20f14c2aec5bb0 100644 (file)
@@ -1,6 +1,6 @@
 /* GDB routines for manipulating objfiles.
 
-   Copyright (C) 1992-2016 Free Software Foundation, Inc.
+   Copyright (C) 1992-2017 Free Software Foundation, Inc.
 
    Contributed by Cygnus Support, using pieces from other GDB modules.
 
@@ -142,12 +142,19 @@ get_objfile_bfd_data (struct objfile *objfile, struct bfd *abfd)
        {
          storage
            = ((struct objfile_per_bfd_storage *)
-              bfd_zalloc (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 = OBSTACK_ZALLOC (&objfile->objfile_obstack,
-                                 struct objfile_per_bfd_storage);
+       {
+         storage = (objfile_per_bfd_storage *)
+           obstack_alloc (&objfile->objfile_obstack,
+                          sizeof (objfile_per_bfd_storage));
+       }
+
+      /* objfile_per_bfd_storage is not trivially constructible, must
+        call the ctor manually.  */
+      storage = new (storage) objfile_per_bfd_storage ();
 
       /* Look up the gdbarch associated with the BFD.  */
       if (abfd != NULL)
@@ -171,7 +178,7 @@ free_objfile_per_bfd_storage (struct objfile_per_bfd_storage *storage)
   bcache_xfree (storage->macro_cache);
   if (storage->demangled_names_hash)
     htab_delete (storage->demangled_names_hash);
-  obstack_free (&storage->storage_obstack, 0);
+  storage->~objfile_per_bfd_storage ();
 }
 
 /* A wrapper for free_objfile_per_bfd_storage that can be passed as a
@@ -366,7 +373,7 @@ build_objfile_section_table (struct objfile *objfile)
    simply copied through to the new objfile flags member.  */
 
 struct objfile *
-allocate_objfile (bfd *abfd, const char *name, int flags)
+allocate_objfile (bfd *abfd, const char *name, objfile_flags flags)
 {
   struct objfile *objfile;
   char *expanded_name;
@@ -1469,7 +1476,7 @@ find_pc_section (CORE_ADDR pc)
 /* Return non-zero if PC is in a section called NAME.  */
 
 int
-pc_in_section (CORE_ADDR pc, char *name)
+pc_in_section (CORE_ADDR pc, const char *name)
 {
   struct obj_section *s;
   int retval = 0;
This page took 0.02449 seconds and 4 git commands to generate.