From 44e0351e4bd10dc0cf4f837c67b89f683e11a931 Mon Sep 17 00:00:00 2001
From: agoncharov <agoncharov>
Date: Sat, 15 Mar 2008 15:00:13 +0000
Subject: [PATCH] Getting rid of some compiler warnings:

  * Eliminate `printf' format string and the following arguments
    conflicts.

  * A variable may be used uninitialized.

  * A variable may be defined but not used.
---
 lisp/gencgc.c    | 43 ++++++++++++++++++++++++++-----------------
 lisp/interr.c    |  8 ++++----
 lisp/interrupt.c |  4 +++-
 lisp/purify.c    |  6 +++---
 4 files changed, 36 insertions(+), 25 deletions(-)

diff --git a/lisp/gencgc.c b/lisp/gencgc.c
index 2c88596e2..6d96e9471 100644
--- a/lisp/gencgc.c
+++ b/lisp/gencgc.c
@@ -7,7 +7,7 @@
  *
  * Douglas Crosher, 1996, 1997, 1998, 1999.
  *
- * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/gencgc.c,v 1.89 2007/07/30 16:19:25 rtoy Exp $
+ * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/gencgc.c,v 1.90 2008/03/15 15:00:02 agoncharov Exp $
  *
  */
 
@@ -1919,7 +1919,8 @@ copy_large_object(lispobj object, int nwords)
     gc_assert((nwords & 0x01) == 0);
 
     if (gencgc_verbose && nwords > 1024 * 1024)
-	fprintf(stderr, "** copy_large_object: %lu\n", nwords * sizeof(lispobj));
+	fprintf(stderr, "** copy_large_object: %lu\n",
+                (unsigned long) (nwords * sizeof(lispobj)));
 
     /* Check if it's a large object. */
     first_page = find_page_index((void *) object);
@@ -2105,7 +2106,7 @@ copy_large_unboxed_object(lispobj object, int nwords)
 
     if (gencgc_verbose && nwords > 1024 * 1024)
 	fprintf(stderr, "** copy_large_unboxed_object: %lu\n",
-		nwords * sizeof(lispobj));
+		(unsigned long) (nwords * sizeof(lispobj)));
 
     /* Check if it's a large object. */
     first_page = find_page_index((void *) object);
@@ -3668,10 +3669,12 @@ u32_vector(lispobj obj, unsigned *length)
 static inline void
 free_hash_entry(struct hash_table *hash_table, int hash_index, int kv_index)
 {
-    unsigned length;
+    unsigned length = UINT_MAX;
     unsigned *index_vector = u32_vector(hash_table->index_vector, &length);
     unsigned *next_vector = u32_vector(hash_table->next_vector, 0);
     int free_p = 1;
+    
+    gc_assert(length != UINT_MAX);
 
     if (index_vector[hash_index] == kv_index)
 	/* The entry is the first in the collinion chain.
@@ -3859,10 +3862,10 @@ scav_hash_entries(struct hash_table *hash_table, lispobj weak, int removep)
 {
     unsigned kv_length;
     lispobj *kv_vector;
-    unsigned *index_vector, *next_vector, *hash_vector;
-    unsigned length;
     lispobj empty_symbol;
-    unsigned next_vector_length;
+    unsigned *index_vector, *next_vector, *hash_vector;
+    unsigned length = UINT_MAX;;
+    unsigned next_vector_length = UINT_MAX;;
     unsigned i;
 
     kv_vector = (lispobj *) PTR(hash_table->table);
@@ -3875,6 +3878,9 @@ scav_hash_entries(struct hash_table *hash_table, lispobj weak, int removep)
     next_vector = u32_vector(hash_table->next_vector, &next_vector_length);
     hash_vector = u32_vector(hash_table->hash_vector, 0);
 
+    gc_assert(length != UINT_MAX);
+    gc_assert(next_vector_length != UINT_MAX);
+    
     gc_assert(index_vector && next_vector);
     gc_assert(next_vector_length * 2 == kv_length);
 
@@ -3941,8 +3947,8 @@ scav_weak_entries(struct hash_table *hash_table)
 {
     lispobj *kv_vector;
     unsigned *index_vector, *hash_vector;
-    unsigned length;
-    unsigned next_vector_length;
+    unsigned length = UINT_MAX;
+    unsigned next_vector_length = UINT_MAX;
     unsigned i, scavenged = 0;
 
     kv_vector = (lispobj *) PTR(hash_table->table) + 2;
@@ -3951,6 +3957,9 @@ scav_weak_entries(struct hash_table *hash_table)
     u32_vector(hash_table->next_vector, &next_vector_length);
     hash_vector = u32_vector(hash_table->hash_vector, 0);
 
+    gc_assert(length != UINT_MAX);
+    gc_assert(next_vector_length != UINT_MAX);
+    
     for (i = 1; i < next_vector_length; i++) {
 	lispobj old_key = kv_vector[2 * i];
         lispobj value = kv_vector[2 * i + 1];
@@ -7727,14 +7736,14 @@ get_bytes_allocated_lower(void)
     if (counters_verbose)
 	fprintf(stderr, ">%10d%10d%10lu%10lu%10lu (max%lu @0x%lX)\n", size,
 		previous != -1 ? size - previous : -1,
-		(size_t) current_region_free_pointer -
-		(size_t) boxed_region.start_addr,
-		(size_t) boxed_region.free_pointer -
-		(size_t) boxed_region.start_addr,
-		(size_t) unboxed_region.free_pointer -
-		(size_t) unboxed_region.start_addr,
-		(size_t) boxed_region.end_addr -
-		(size_t) boxed_region.start_addr,
+		(unsigned long) ((size_t) current_region_free_pointer -
+                                 (size_t) boxed_region.start_addr),
+		(unsigned long) ((size_t) boxed_region.free_pointer -
+                                 (size_t) boxed_region.start_addr),
+		(unsigned long) ((size_t) unboxed_region.free_pointer -
+                                 (size_t) unboxed_region.start_addr),
+		(unsigned long) ((size_t) boxed_region.end_addr -
+                                 (size_t) boxed_region.start_addr),
 		(unsigned long) boxed_region.start_addr);
 
     previous = size;
diff --git a/lisp/interr.c b/lisp/interr.c
index 79acc32a7..87f6d5431 100644
--- a/lisp/interr.c
+++ b/lisp/interr.c
@@ -1,5 +1,5 @@
 /*
- * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/interr.c,v 1.8 2005/09/15 18:26:51 rtoy Exp $
+ * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/interr.c,v 1.9 2008/03/15 15:00:06 agoncharov Exp $
  *
  * Stuff to handle internal errors.
  *
@@ -121,13 +121,13 @@ internal_error(os_context_t * context)
 #ifdef sc_WordPointerReg
 	  case sc_WordPointerReg:
 #endif
-	      printf("\t0x%08x\n", SC_REG(context, offset));
+	      printf("\t0x%08lx\n", SC_REG(context, offset));
 	      break;
 	  case sc_SignedReg:
-	      printf("\t%d\n", SC_REG(context, offset));
+	      printf("\t%ld\n", SC_REG(context, offset));
 	      break;
 	  case sc_UnsignedReg:
-	      printf("\t%u\n", SC_REG(context, offset));
+	      printf("\t%lu\n", SC_REG(context, offset));
 	      break;
 #if 0				/* broken */
 #ifdef sc_SingleReg
diff --git a/lisp/interrupt.c b/lisp/interrupt.c
index 1eadae1a5..095f03087 100644
--- a/lisp/interrupt.c
+++ b/lisp/interrupt.c
@@ -1,4 +1,4 @@
-/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/interrupt.c,v 1.53 2007/12/14 12:19:59 cshapiro Exp $ */
+/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/interrupt.c,v 1.54 2008/03/15 15:00:09 agoncharov Exp $ */
 
 /* Interrupt handling magic. */
 
@@ -171,7 +171,9 @@ interrupt_internal_error(HANDLER_ARGS, boolean continuable)
 void
 interrupt_handle_pending(os_context_t * context)
 {
+#ifndef i386
     boolean were_in_lisp = !foreign_function_call_active;
+#endif
 
     SetSymbolValue(INTERRUPT_PENDING, NIL);
 
diff --git a/lisp/purify.c b/lisp/purify.c
index bbf059252..996dcba92 100644
--- a/lisp/purify.c
+++ b/lisp/purify.c
@@ -10,7 +10,7 @@
    and x86/GENCGC stack scavenging, by Douglas Crosher, 1996, 1997,
    1998.
 
-   $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/purify.c,v 1.40 2007/07/06 08:04:39 cshapiro Exp $ 
+   $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/purify.c,v 1.41 2008/03/15 15:00:13 agoncharov Exp $ 
 
    */
 #include <stdio.h>
@@ -1673,8 +1673,8 @@ purify(lispobj static_roots, lispobj read_only_roots)
 	    (lispobj *) SymbolValue(READ_ONLY_SPACE_FREE_POINTER) -
 
 	    read_only_space;
-	fprintf(stderr, "Scavenge read only space: %ld bytes\n",
-		read_only_space_size * sizeof(lispobj));
+	fprintf(stderr, "Scavenge read only space: %lu bytes\n",
+		(unsigned long) (read_only_space_size * sizeof(lispobj)));
 	pscav(read_only_space, read_only_space_size, FALSE);
     }
 #endif
-- 
GitLab