Eliminate C++ warnings about deprecated register keyword (GC source)
authorJay Krell <jaykrell@microsoft.com>
Thu, 22 Feb 2018 20:23:48 +0000 (23:23 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Thu, 22 Feb 2018 20:23:48 +0000 (23:23 +0300)
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.

14 files changed:
blacklst.c
dyn_load.c
extra/pcr_interface.c
finalize.c
headers.c
include/private/gc_pmark.h
mach_dep.c
mark.c
mark_rts.c
os_dep.c
pthread_stop_world.c
pthread_support.c
typd_mlc.c
win32_threads.c

index 356f636..452a340 100644 (file)
@@ -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++) {
@@ -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++) {
index c3cd186..330cd86 100644 (file)
@@ -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;
index 8756cf1..ff46187 100644 (file)
@@ -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;
index b165334..640ee4e 100644 (file)
@@ -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;
index 0c258de..bdc8311 100644 (file)
--- a/headers.c
+++ b/headers.c
@@ -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;
@@ -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) {
@@ -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);
     }
@@ -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;
index 41d97b7..aad245c 100644 (file)
@@ -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++; \
index 2c62cc6..b65e6db 100644 (file)
@@ -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.                   */
diff --git a/mark.c b/mark.c
index 4c240b9..07a2360 100644 (file)
--- a/mark.c
+++ b/mark.c
@@ -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        */
index fe25931..3f0b6f1 100644 (file)
@@ -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++) {
@@ -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
index cba23c3..f591d70 100644 (file)
--- a/os_dep.c
+++ b/os_dep.c
@@ -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;
@@ -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];
     }
 
@@ -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);
@@ -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;
 
@@ -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);
                 }
             }
@@ -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) {
@@ -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;
index a6ca776..45435aa 100644 (file)
@@ -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
index e6a6a42..31066e7 100644 (file)
@@ -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",
@@ -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) {
index b5e2c61..a67671a 100644 (file)
@@ -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);
@@ -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);
index 71cafa3..03eb6b5 100644 (file)
@@ -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) {
@@ -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) {