Silence obstack.c -Wc++compat warning
authorAlan Modra <amodra@gmail.com>
Mon, 9 Nov 2015 04:45:51 +0000 (15:15 +1030)
committerAlan Modra <amodra@gmail.com>
Mon, 9 Nov 2015 04:48:47 +0000 (15:18 +1030)
Fixes
warning: request for implicit conversion from ‘void *’ to ‘struct _obstack_chunk *’ not permitted in C++ [-Wc++-compat]

I moved the assignment to h->chunk to fix an overlong line, then
decided it would be better after the alloc failure check just to do
things the same way as in _obstack_newchunk.

* obstack.c (_obstack_newchunk): Silence -Wc++compat warning.
(_obstack_begin_worker): Likewise.  Move assignment to h->chunk
after alloc failure check.

libiberty/ChangeLog
libiberty/obstack.c

index 05b60d876f90db67ca9463ee09227c0266559421..6d3b2950fc21f3052a5f66ad455db239d0a7f307 100644 (file)
@@ -1,3 +1,9 @@
+2015-11-09  Alan Modra  <amodra@gmail.com>
+
+       * obstack.c (_obstack_newchunk): Silence -Wc++compat warning.
+       (_obstack_begin_worker): Likewise.  Move assignment to h->chunk
+       after alloc failure check.
+
 2015-11-09  Alan Modra  <amodra@gmail.com>
 
        PR gdb/17133
index 9f34da1164bd4a6a3331c01eb66b9c9522b48226..6d8d67261ddc470733ad6ccdccd925dd8afe9e8d 100644 (file)
@@ -138,9 +138,10 @@ _obstack_begin_worker (struct obstack *h,
   h->chunk_size = size;
   h->alignment_mask = alignment - 1;
 
-  chunk = h->chunk = call_chunkfun (h, h->chunk_size);
+  chunk = (struct _obstack_chunk *) call_chunkfun (h, h->chunk_size);
   if (!chunk)
     (*obstack_alloc_failed_handler) ();
+  h->chunk = chunk;
   h->next_free = h->object_base = __PTR_ALIGN ((char *) chunk, chunk->contents,
                                                alignment - 1);
   h->chunk_limit = chunk->limit = (char *) chunk + h->chunk_size;
@@ -202,7 +203,7 @@ _obstack_newchunk (struct obstack *h, _OBSTACK_SIZE_T length)
 
   /* Allocate and initialize the new chunk.  */
   if (obj_size <= sum1 && sum1 <= sum2)
-    new_chunk = call_chunkfun (h, new_size);
+    new_chunk = (struct _obstack_chunk *) call_chunkfun (h, new_size);
   if (!new_chunk)
     (*obstack_alloc_failed_handler)();
   h->chunk = new_chunk;
This page took 0.02843 seconds and 4 git commands to generate.