Skip to content

Commit

Permalink
Change backtrace-specific code to comply with C++11 standard
Browse files Browse the repository at this point in the history
Issue #206 (bdwgc).

* dbg_mlc.c (GC_get_back_ptr_info): Cast GC_REVEAL_POINTER() result
to ptr_t (when assigned to bp local variable).
* dbg_mlc.c (GC_generate_random_valid_address): Cast result of
GC_generate_random_heap_address() to ptr_t.
* dbg_mlc.c (GC_print_backtrace): Cast GC_print_heap_obj() argument
to ptr_t.
  • Loading branch information
ivmai committed Mar 2, 2018
1 parent 8d18e5d commit 5a52a21
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions dbg_mlc.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
if (!hdr) ABORT("Invalid GC_get_back_ptr_info argument");
# endif
if (!GC_HAS_DEBUG_INFO((ptr_t) hdr)) return GC_NO_SPACE;
bp = GC_REVEAL_POINTER(hdr -> oh_back_ptr);
bp = (ptr_t)GC_REVEAL_POINTER(hdr -> oh_back_ptr);
if (MARKED_FOR_FINALIZATION == bp) return GC_FINALIZER_REFD;
if (MARKED_FROM_REGISTER == bp) return GC_REFD_FROM_REG;
if (NOT_MARKED == bp) return GC_UNREFERENCED;
Expand Down Expand Up @@ -190,7 +190,7 @@
ptr_t result;
ptr_t base;
do {
result = GC_generate_random_heap_address();
result = (ptr_t)GC_generate_random_heap_address();
base = (ptr_t)GC_base(result);
} while (NULL == base || !GC_is_marked(base));
return result;
Expand All @@ -205,7 +205,7 @@
size_t offset;
void *base;

GC_print_heap_obj(GC_base(current));
GC_print_heap_obj((ptr_t)GC_base(current));

for (i = 0; ; ++i) {
source = GC_get_back_ptr_info(current, &base, &offset);
Expand All @@ -231,7 +231,7 @@
case GC_REFD_FROM_HEAP:
GC_err_printf("offset %ld in object:\n", (long)offset);
/* Take GC_base(base) to get real base, i.e. header. */
GC_print_heap_obj(GC_base(base));
GC_print_heap_obj((ptr_t)GC_base(base));
break;
default:
GC_err_printf("INTERNAL ERROR: UNEXPECTED SOURCE!!!!\n");
Expand Down

0 comments on commit 5a52a21

Please sign in to comment.