Skip to content

Commit

Permalink
Eliminate C++ warnings about deprecated register keyword (GC source)
Browse files Browse the repository at this point in the history
Issue #206 (bdwgc).

* blacklst.c (GC_number_stack_black_listed, total_stack_black_listed):
Remove register keyword for local variables.
* dyn_load.c [IRIX5 || USE_PROC_FOR_LIBRARIES && !LINUX]
(GC_register_dynamic_libraries): Likewise.
* extra/pcr_interface.c [PCR] (GC_enumerate_block): Likewise.
* finalize.c (GC_grow_table): Likewise.
* headers.c (alloc_hdr, GC_init_headers, GC_remove_counts,
GC_prev_block): Likewise.
* include/private/gc_pmark.h (PUSH_OBJ): Likewise.
* mach_dep.c [!HAVE_PUSH_REGS && !HAVE_BUILTIN_UNWIND_INIT]
(GC_with_callee_saves_pushed): Likewise.
* mark.c (clear_marks_for_block): Likewise.
* mark_rts.c [MSWIN32 || MSWINCE || CYGWIN32] (GC_add_roots_inner):
Likewise.
* mark_rts.c [!NO_DEBUGGING] (GC_is_tmp_root): Likewise.
* os_dep.c [GWW_VDB || MPROTECT_VDB || PROC_VDB || MANUAL_VDB]
(GC_page_was_dirty): Likewise.
* os_dep.c [CHECKSUMS && GWW_VDB || PROC_VDB] (GC_or_pages,
GC_page_was_ever_dirty): Likewise.
* os_dep.c (GC_write_fault_handler): Likewise.
* os_dep.c [PROC_VDB] (GC_read_dirty): Likewise.
* os_dep.c [MPROTECT_VDB && DARWIN] (catch_exception_raise): Likewise.
* os_dep.c [SAVE_CALL_CHAIN && NARGS>0] (GC_save_callers): Likewise.
* pthread_stop_world.c [!NACL] (GC_start_world): Likewise.
* pthread_support.c (GC_delete_thread, GC_delete_gc_thread): Likewise.
* typd_mlc.c (GC_push_complex_descriptor): Likewise.
* win32_threads.c (GC_delete_gc_thread_no_free, GC_delete_thread):
Likewise.
  • Loading branch information
jaykrell authored and ivmai committed Feb 22, 2018
1 parent 4b76d15 commit f32ccf2
Show file tree
Hide file tree
Showing 14 changed files with 48 additions and 47 deletions.
4 changes: 2 additions & 2 deletions blacklst.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ struct hblk * GC_is_black_listed(struct hblk *h, word len)
STATIC word GC_number_stack_black_listed(struct hblk *start,
struct hblk *endp1)
{
register struct hblk * h;
struct hblk * h;
word result = 0;

for (h = start; (word)h < (word)endp1; h++) {
Expand All @@ -277,7 +277,7 @@ STATIC word GC_number_stack_black_listed(struct hblk *start,
/* Return the total number of (stack) black-listed bytes. */
static word total_stack_black_listed(void)
{
register unsigned i;
unsigned i;
word total = 0;

for (i = 0; i < GC_n_heap_sects; i++) {
Expand Down
2 changes: 1 addition & 1 deletion dyn_load.c
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,7 @@ GC_INNER void GC_register_dynamic_libraries(void)
/* Known irrelevant map entries */
static int n_irr = 0;
struct stat buf;
register int j;
int j;

for (j = 0; j < n_irr; j++) {
if (map_irr[j] == start) goto irrelevant;
Expand Down
4 changes: 2 additions & 2 deletions extra/pcr_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ typedef struct {

void GC_enumerate_block(struct hblk *h, enumerate_data * ed)
{
register hdr * hhdr;
register size_t sz;
hdr * hhdr;
size_t sz;
ptr_t p;
ptr_t lim;
word descr;
Expand Down
4 changes: 2 additions & 2 deletions finalize.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ GC_API void GC_CALL GC_push_finalizer_structures(void)
STATIC void GC_grow_table(struct hash_chain_entry ***table,
signed_word *log_size_ptr)
{
register word i;
register struct hash_chain_entry *p;
word i;
struct hash_chain_entry *p;
signed_word log_old_size = *log_size_ptr;
signed_word log_new_size = log_old_size + 1;
word old_size = log_old_size == -1 ? 0 : (word)1 << log_old_size;
Expand Down
15 changes: 8 additions & 7 deletions headers.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,9 @@ static hdr * hdr_free_list = 0;
/* Return an uninitialized header */
static hdr * alloc_hdr(void)
{
register hdr * result;
hdr * result;

if (hdr_free_list == 0) {
if (NULL == hdr_free_list) {
result = (hdr *)GC_scratch_alloc(sizeof(hdr));
} else {
result = hdr_free_list;
Expand All @@ -192,7 +192,7 @@ GC_INLINE void free_hdr(hdr * hhdr)

GC_INNER void GC_init_headers(void)
{
register unsigned i;
unsigned i;

GC_all_nils = (bottom_index *)GC_scratch_alloc(sizeof(bottom_index));
if (GC_all_nils == NULL) {
Expand Down Expand Up @@ -302,7 +302,8 @@ GC_INNER void GC_remove_header(struct hblk *h)
/* Remove forwarding counts for h */
GC_INNER void GC_remove_counts(struct hblk *h, size_t sz/* bytes */)
{
register struct hblk * hbp;
struct hblk * hbp;

for (hbp = h+1; (word)hbp < (word)h + sz; hbp += 1) {
SET_HDR(hbp, 0);
}
Expand Down Expand Up @@ -376,12 +377,12 @@ GC_INNER struct hblk * GC_next_used_block(struct hblk *h)
/* Unlike the above, this may return a free block. */
GC_INNER struct hblk * GC_prev_block(struct hblk *h)
{
register bottom_index * bi;
register signed_word j = ((word)h >> LOG_HBLKSIZE) & (BOTTOM_SZ-1);
bottom_index * bi;
signed_word j = ((word)h >> LOG_HBLKSIZE) & (BOTTOM_SZ-1);

GET_BI(h, bi);
if (bi == GC_all_nils) {
register word hi = (word)h >> (LOG_BOTTOM_SZ + LOG_HBLKSIZE);
word hi = (word)h >> (LOG_BOTTOM_SZ + LOG_HBLKSIZE);
bi = GC_all_bottom_indices_end;
while (bi != 0 && bi -> key > hi) bi = bi -> desc_link;
j = BOTTOM_SZ - 1;
Expand Down
2 changes: 1 addition & 1 deletion include/private/gc_pmark.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ GC_INNER mse * GC_signal_mark_stack_overflow(mse *msp);
/* the mark stack. */
#define PUSH_OBJ(obj, hhdr, mark_stack_top, mark_stack_limit) \
do { \
register word _descr = (hhdr) -> hb_descr; \
word _descr = (hhdr) -> hb_descr; \
GC_ASSERT(!HBLK_IS_FREE(hhdr)); \
if (_descr != 0) { \
mark_stack_top++; \
Expand Down
4 changes: 2 additions & 2 deletions mach_dep.c
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,8 @@ GC_INNER void GC_with_callee_saves_pushed(void (*fn)(ptr_t, void *),
/* We're not sure whether he would like */
/* to be acknowledged for it or not. */
jmp_buf regs;
register word * i = (word *) &regs;
register ptr_t lim = (ptr_t)(&regs) + (sizeof regs);
word * i = (word *)&regs;
ptr_t lim = (ptr_t)(&regs) + sizeof(regs);

/* Setjmp doesn't always clear all of the buffer. */
/* That tends to preserve garbage. Clear it. */
Expand Down
2 changes: 1 addition & 1 deletion mark.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ GC_INNER void GC_set_hdr_marks(hdr *hhdr)
*/
static void clear_marks_for_block(struct hblk *h, word dummy GC_ATTR_UNUSED)
{
register hdr * hhdr = HDR(h);
hdr * hhdr = HDR(h);

if (IS_UNCOLLECTABLE(hhdr -> hb_obj_kind)) return;
/* Mark bit for these is cleared only once the object is */
Expand Down
4 changes: 2 additions & 2 deletions mark_rts.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ void GC_add_roots_inner(ptr_t b, ptr_t e, GC_bool tmp)
/* virtually guaranteed to be dominated by the time it */
/* takes to scan the roots. */
{
register int i;
int i;
struct roots * old = NULL; /* initialized to prevent warning. */

for (i = 0; i < n_root_sets; i++) {
Expand Down Expand Up @@ -371,7 +371,7 @@ STATIC void GC_remove_tmp_roots(void)
GC_API int GC_CALL GC_is_tmp_root(void *p)
{
static int last_root_set = MAX_ROOT_SETS;
register int i;
int i;

if (last_root_set < n_root_sets
&& (word)p >= (word)GC_static_roots[last_root_set].r_start
Expand Down
18 changes: 9 additions & 9 deletions os_dep.c
Original file line number Diff line number Diff line change
Expand Up @@ -2817,7 +2817,7 @@ GC_API GC_push_other_roots_proc GC_CALL GC_get_push_other_roots(void)
/* side of labeling pages as dirty (and this implementation does). */
GC_INNER GC_bool GC_page_was_dirty(struct hblk * h)
{
register word index;
word index;

if (HDR(h) == 0)
return TRUE;
Expand All @@ -2830,7 +2830,7 @@ GC_API GC_push_other_roots_proc GC_CALL GC_get_push_other_roots(void)
/* Add all pages in pht2 to pht1. */
STATIC void GC_or_pages(page_hash_table pht1, page_hash_table pht2)
{
register unsigned i;
unsigned i;
for (i = 0; i < PHT_SIZE; i++) pht1[i] |= pht2[i];
}

Expand All @@ -2841,7 +2841,8 @@ GC_API GC_push_other_roots_proc GC_CALL GC_get_push_other_roots(void)
GC_INNER GC_bool GC_page_was_ever_dirty(struct hblk * h)
# endif
{
register word index;
word index;

if (HDR(h) == 0)
return TRUE;
index = PHT_HASH(h);
Expand Down Expand Up @@ -3293,8 +3294,7 @@ GC_API GC_push_other_roots_proc GC_CALL GC_get_push_other_roots(void)
# endif

if (SIG_OK && CODE_OK) {
register struct hblk * h =
(struct hblk *)((word)addr & ~(GC_page_size-1));
struct hblk * h = (struct hblk *)((word)addr & ~(GC_page_size-1));
GC_bool in_allocd_block;
size_t i;

Expand Down Expand Up @@ -3807,14 +3807,14 @@ GC_INNER void GC_read_dirty(GC_bool output_unneeded)
limit = vaddr + pagesize * npages;
for (; (word)vaddr < (word)limit; vaddr += pagesize) {
if ((*bufp++) & PG_MODIFIED) {
register struct hblk * h;
struct hblk * h;
ptr_t next_vaddr = vaddr + pagesize;
# ifdef DEBUG_DIRTY_BITS
GC_log_printf("dirty page at: %p\n", (void *)vaddr);
# endif
for (h = (struct hblk *)vaddr;
(word)h < (word)next_vaddr; h++) {
register word index = PHT_HASH(h);
word index = PHT_HASH(h);
set_pht_entry_from_index(GC_grungy_pages, index);
}
}
Expand Down Expand Up @@ -4479,7 +4479,7 @@ catch_exception_raise(mach_port_t exception_port GC_ATTR_UNUSED,

UNPROTECT(h, GC_page_size);
for (i = 0; i < divHBLKSZ(GC_page_size); i++) {
register int index = PHT_HASH(h+i);
int index = PHT_HASH(h+i);
async_set_pht_entry_from_index(GC_dirty_pages, index);
}
} else if (GC_mprotect_state == GC_MP_DISCARDING) {
Expand Down Expand Up @@ -4680,7 +4680,7 @@ GC_INNER void GC_save_callers(struct callinfo info[NFRAMES])
&& nframes < NFRAMES;
fp = (struct frame *)((long) fp -> FR_SAVFP + BIAS), nframes++) {
# if NARGS > 0
register int i;
int i;
# endif

info[nframes].ci_pc = fp->FR_SAVPC;
Expand Down
8 changes: 4 additions & 4 deletions pthread_stop_world.c
Original file line number Diff line number Diff line change
Expand Up @@ -1034,11 +1034,11 @@ GC_INNER void GC_start_world(void)
{
# ifndef NACL
pthread_t self = pthread_self();
register int i;
register GC_thread p;
int i;
GC_thread p;
# ifndef GC_OPENBSD_UTHREADS
register int n_live_threads = 0;
register int result;
int n_live_threads = 0;
int result;
# endif

# ifdef DEBUG_THREADS
Expand Down
8 changes: 4 additions & 4 deletions pthread_support.c
Original file line number Diff line number Diff line change
Expand Up @@ -577,8 +577,8 @@ STATIC GC_thread GC_new_thread(pthread_t id)
STATIC void GC_delete_thread(pthread_t id)
{
int hv = THREAD_TABLE_INDEX(id);
register GC_thread p = GC_threads[hv];
register GC_thread prev = 0;
GC_thread p = GC_threads[hv];
GC_thread prev = NULL;

# ifdef DEBUG_THREADS
GC_log_printf("Deleting thread %p, n_threads = %d\n",
Expand Down Expand Up @@ -616,8 +616,8 @@ STATIC void GC_delete_gc_thread(GC_thread t)
{
pthread_t id = t -> id;
int hv = THREAD_TABLE_INDEX(id);
register GC_thread p = GC_threads[hv];
register GC_thread prev = 0;
GC_thread p = GC_threads[hv];
GC_thread prev = NULL;

GC_ASSERT(I_HOLD_LOCK());
while (p != t) {
Expand Down
12 changes: 6 additions & 6 deletions typd_mlc.c
Original file line number Diff line number Diff line change
Expand Up @@ -427,15 +427,15 @@ STATIC word GC_descr_obj_size(complex_descriptor *d)
STATIC mse * GC_push_complex_descriptor(word *addr, complex_descriptor *d,
mse *msp, mse *msl)
{
register ptr_t current = (ptr_t) addr;
register word nelements;
register word sz;
register word i;
ptr_t current = (ptr_t)addr;
word nelements;
word sz;
word i;

switch(d -> TAG) {
case LEAF_TAG:
{
register GC_descr descr = d -> ld.ld_descriptor;
GC_descr descr = d -> ld.ld_descriptor;

nelements = d -> ld.ld_nelements;
if (msl - msp <= (ptrdiff_t)nelements) return(0);
Expand All @@ -450,7 +450,7 @@ STATIC mse * GC_push_complex_descriptor(word *addr, complex_descriptor *d,
}
case ARRAY_TAG:
{
register complex_descriptor *descr = d -> ad.ad_element_descr;
complex_descriptor *descr = d -> ad.ad_element_descr;

nelements = d -> ad.ad_nelements;
sz = GC_descr_obj_size(descr);
Expand Down
8 changes: 4 additions & 4 deletions win32_threads.c
Original file line number Diff line number Diff line change
Expand Up @@ -670,8 +670,8 @@ STATIC void GC_delete_gc_thread_no_free(GC_vthread t)
DWORD id = ((GC_thread)t) -> id;
/* Cast away volatile qualifier, since we have lock. */
int hv = THREAD_TABLE_INDEX(id);
register GC_thread p = GC_threads[hv];
register GC_thread prev = 0;
GC_thread p = GC_threads[hv];
GC_thread prev = NULL;

GC_ASSERT(I_HOLD_LOCK());
while (p != (GC_thread)t) {
Expand Down Expand Up @@ -704,8 +704,8 @@ STATIC void GC_delete_thread(DWORD id)
}
} else {
int hv = THREAD_TABLE_INDEX(id);
register GC_thread p = GC_threads[hv];
register GC_thread prev = 0;
GC_thread p = GC_threads[hv];
GC_thread prev = NULL;

GC_ASSERT(I_HOLD_LOCK());
while (p -> id != id) {
Expand Down

0 comments on commit f32ccf2

Please sign in to comment.