1.0.14.38: build runtime with -Wsign-compare, and clean warnings on x86/Linux
authorNikodemus Siivola <nikodemus@random-state.net>
Tue, 19 Feb 2008 10:18:06 +0000 (10:18 +0000)
committerNikodemus Siivola <nikodemus@random-state.net>
Tue, 19 Feb 2008 10:18:06 +0000 (10:18 +0000)
 * Nothing serious seemed to be going on, though, but since C has nasty
   signed vs unsigned comparison semantics, it is better to be clear
   about what is going on.

13 files changed:
src/runtime/GNUmakefile
src/runtime/backtrace.c
src/runtime/breakpoint.c
src/runtime/core.h
src/runtime/coreparse.c
src/runtime/gc-common.c
src/runtime/gencgc-internal.h
src/runtime/gencgc.c
src/runtime/print.c
src/runtime/thread.c
src/runtime/wrap.c
src/runtime/x86-arch.h
version.lisp-expr

index 2e6be50..cfaac20 100644 (file)
@@ -23,7 +23,7 @@ NM = nm -gp
 DEPEND_FLAGS = -MM
 GREP = grep
 
-CFLAGS = -g -Wall -O3
+CFLAGS = -g -Wall -Wsign-compare -O3
 ASFLAGS = $(CFLAGS)
 CPPFLAGS = -I.
 
index 98189b9..52d3ce2 100644 (file)
@@ -408,7 +408,7 @@ debug_function_from_pc (struct code* code, void *pc)
     if (i == len)
       return ((struct compiled_debug_fun *) native_pointer(v->data[i - 1]));
 
-    if (offset >= fixnum_value(df->elsewhere_pc)) {
+    if (offset >= (unsigned long)fixnum_value(df->elsewhere_pc)) {
       struct compiled_debug_fun *p
         = ((struct compiled_debug_fun *) native_pointer(v->data[i + 1]));
       next_pc = fixnum_value(p->elsewhere_pc);
index 846fa77..f7f9e90 100644 (file)
@@ -115,7 +115,7 @@ static long compute_offset(os_context_t *context, lispobj code)
         if (pc < code_start)
             return 0;
         else {
-            long offset = pc - code_start;
+            unsigned long offset = pc - code_start;
             if (offset >= codeptr->code_size)
                 return 0;
             else
index ce2ec8f..57df1cb 100644 (file)
@@ -39,6 +39,6 @@ extern os_vm_offset_t search_for_embedded_core(char *file);
  * against a .core built without :SB-SHOW (or against various grosser
  * mismatches, e.g. a .core built with an old version of the code
  * against a runtime with patches which add new C code) */
-extern char build_id[];
+extern unsigned char build_id[];
 
 #endif
index d657bac..ec5a100 100644 (file)
@@ -42,7 +42,7 @@
 #endif
 
 
-char build_id[] =
+unsigned char build_id[] =
 #include "../../output/build-id.tmp"
 ;
 
@@ -121,7 +121,7 @@ process_directory(int fd, lispobj *ptr, int count, os_vm_offset_t file_offset)
         os_vm_address_t addr =
             (os_vm_address_t) (os_vm_page_size * entry->address);
         lispobj *free_pointer = (lispobj *) addr + entry->nwords;
-        long len = os_vm_page_size * entry->page_count;
+        unsigned long len = os_vm_page_size * entry->page_count;
 
         if (len != 0) {
             os_vm_address_t real_addr;
@@ -199,7 +199,8 @@ lispobj
 load_core_file(char *file, os_vm_offset_t file_offset)
 {
     lispobj *header, val, len, *ptr, remaining_len;
-    int fd = open_binary(file, O_RDONLY), count;
+    int fd = open_binary(file, O_RDONLY);
+    unsigned int count;
 
     lispobj initial_function = NIL;
     FSHOW((stderr, "/entering load_core_file(%s)\n", file));
@@ -253,7 +254,7 @@ load_core_file(char *file, os_vm_offset_t file_offset)
         case BUILD_ID_CORE_ENTRY_TYPE_CODE:
             SHOW("BUILD_ID_CORE_ENTRY_TYPE_CODE case");
             {
-                int i;
+                unsigned int i;
 
                 FSHOW((stderr, "build_id[]=\"%s\"\n", build_id));
                 FSHOW((stderr, "remaining_len = %d\n", remaining_len));
index f39495f..b76dc55 100644 (file)
@@ -1638,7 +1638,7 @@ scav_hash_table_entries (struct hash_table *hash_table)
     unsigned long hash_vector_length;
     lispobj empty_symbol;
     lispobj weakness = hash_table->weakness;
-    long i;
+    unsigned long i;
 
     kv_vector = get_array_data(hash_table->table,
                                SIMPLE_VECTOR_WIDETAG, &kv_length);
@@ -1827,7 +1827,7 @@ scan_weak_hash_table (struct hash_table *hash_table)
     lispobj *hash_vector;
     lispobj empty_symbol;
     lispobj weakness = hash_table->weakness;
-    long i;
+    unsigned long i;
 
     kv_vector = get_array_data(hash_table->table,
                                SIMPLE_VECTOR_WIDETAG, NULL);
@@ -1903,7 +1903,7 @@ size_lose(lispobj *where)
 void
 gc_init_tables(void)
 {
-    long i;
+    unsigned long i;
 
     /* Set default value in all slots of scavenge table.  FIXME
      * replace this gnarly sizeof with something based on
index ba56529..bded273 100644 (file)
@@ -93,7 +93,7 @@ struct page {
 /* values for the page.allocated field */
 
 \f
-extern unsigned page_table_pages;
+extern page_index_t page_table_pages;
 extern struct page *page_table;
 
 \f
index a43d374..3afc1a2 100644 (file)
@@ -80,7 +80,7 @@ enum {
 boolean enable_page_protection = 1;
 
 /* the minimum size (in bytes) for a large object*/
-unsigned long large_object_size = 4 * PAGE_BYTES;
+long large_object_size = 4 * PAGE_BYTES;
 
 \f
 /*
@@ -163,7 +163,7 @@ static boolean conservative_stack = 1;
 /* An array of page structures is allocated on gc initialization.
  * This helps quickly map between an address its page structure.
  * page_table_pages is set from the size of the dynamic space. */
-unsigned page_table_pages;
+page_index_t page_table_pages;
 struct page *page_table;
 
 /* To map addresses to page structures the address of the first page
@@ -1188,7 +1188,7 @@ gc_alloc_with_region(long nbytes,int unboxed_p, struct alloc_region *my_region,
 {
     void *new_free_pointer;
 
-    if(nbytes>=large_object_size)
+    if (nbytes>=large_object_size)
         return gc_alloc_large(nbytes,unboxed_p,my_region);
 
     /* Check whether there is room in the current alloc region. */
index f448e51..73ec03b 100644 (file)
@@ -237,7 +237,8 @@ static void print_fixnum(lispobj obj)
 
 static void brief_otherimm(lispobj obj)
 {
-    int type, c, idx;
+    int type, c;
+    unsigned int idx;
     char buffer[10];
 
     type = widetag_of(obj);
@@ -288,7 +289,9 @@ static void brief_otherimm(lispobj obj)
 
 static void print_otherimm(lispobj obj)
 {
-    int type, idx;
+    int type;
+
+    unsigned int idx;
 
     type = widetag_of(obj);
     idx = type >> 2;
@@ -379,7 +382,7 @@ static void brief_struct(lispobj obj)
 static void print_struct(lispobj obj)
 {
     struct instance *instance = (struct instance *)native_pointer(obj);
-    int i;
+    unsigned int i;
     char buffer[16];
     print_obj("type: ", ((struct instance *)native_pointer(obj))->slots[0]);
     for (i = 1; i < HeaderValue(instance->header); i++) {
index d38fd72..6489d7d 100644 (file)
@@ -364,7 +364,7 @@ create_thread_struct(lispobj initial_function) {
     void *spaces=0;
     void *aligned_spaces=0;
 #ifdef LISP_FEATURE_SB_THREAD
-    int i;
+    unsigned int i;
 #endif
 
     /* May as well allocate all the spaces at once: it saves us from
index 2bda7f9..5f18738 100644 (file)
@@ -359,7 +359,7 @@ uid_homedir(uid_t uid)
         } else {
             char *result = malloc(len + 2);
             if (result) {
-                int nchars = sprintf(result,"%s/",p->pw_dir);
+                unsigned int nchars = sprintf(result,"%s/",p->pw_dir);
                 if (nchars == len + 1) {
                     return result;
                 } else {
index bf5d158..30363db 100644 (file)
@@ -21,7 +21,7 @@
 #include "interr.h"
 
 static inline void
-get_spinlock(volatile lispobj *word,long value)
+get_spinlock(volatile lispobj *word, unsigned long value)
 {
 #ifdef LISP_FEATURE_SB_THREAD
     u32 eax=0;
index 470135b..f95cae8 100644 (file)
@@ -17,4 +17,4 @@
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"1.0.14.37"
+"1.0.14.38"