Cast result of obstack_next_free
authorAlan Modra <amodra@gmail.com>
Tue, 4 Nov 2014 22:48:27 +0000 (09:18 +1030)
committerAlan Modra <amodra@gmail.com>
Wed, 5 Nov 2014 06:08:10 +0000 (16:38 +1030)
obstack_next_free is supposed to return a void*, rather than a char*
as it does currently.  Avoid warning on void* arithmetic when
obstack_next_free gets it proper return type.

* cp-valprint.c (cp_print_value_fields): Cast obstack_next_free
to char* before doing pointer arithmetic.

gdb/ChangeLog
gdb/cp-valprint.c

index f347b89c00b49d72aaf2879458dad18615bbb377..185d5e899a0c55d734dd938cac17a213c4123360 100644 (file)
@@ -3,6 +3,8 @@
        * charset.c (convert_between_encodings): Shrink obstack using
        obstack_blank_fast.
        * minsyms.c (install_minimal_symbols): Likewise.
+       * cp-valprint.c (cp_print_value_fields): Cast obstack_next_free
+       to char* before doing pointer arithmetic.
 
 2014-11-04  Simon Marchi  <simon.marchi@ericsson.com>
 
index 42010c261d9a3f0ff6259544cd74010de684bd27..8f456bf468c4598a61cc506b8ac3f34c9b92163d 100644 (file)
@@ -370,7 +370,7 @@ cp_print_value_fields (struct type *type, struct type *real_type,
              /* In effect, a pop of the printed-statics stack.  */
 
              void *free_to_ptr =
-               obstack_next_free (&dont_print_statmem_obstack) -
+               (char *) obstack_next_free (&dont_print_statmem_obstack) -
                (obstack_final_size - statmem_obstack_initial_size);
 
              obstack_free (&dont_print_statmem_obstack,
@@ -385,7 +385,7 @@ cp_print_value_fields (struct type *type, struct type *real_type,
              if (obstack_final_size > stat_array_obstack_initial_size)
                {
                  void *free_to_ptr =
-                   obstack_next_free (&dont_print_stat_array_obstack)
+                   (char *) obstack_next_free (&dont_print_stat_array_obstack)
                    - (obstack_final_size
                       - stat_array_obstack_initial_size);