From 7a79c7338b8c8fb6d84a275d7c0e51ce93150059 Mon Sep 17 00:00:00 2001 From: Nikodemus Siivola Date: Tue, 19 Feb 2008 10:18:06 +0000 Subject: [PATCH] 1.0.14.38: build runtime with -Wsign-compare, and clean warnings on x86/Linux * 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. --- src/runtime/GNUmakefile | 2 +- src/runtime/backtrace.c | 2 +- src/runtime/breakpoint.c | 2 +- src/runtime/core.h | 2 +- src/runtime/coreparse.c | 9 +++++---- src/runtime/gc-common.c | 6 +++--- src/runtime/gencgc-internal.h | 2 +- src/runtime/gencgc.c | 6 +++--- src/runtime/print.c | 9 ++++++--- src/runtime/thread.c | 2 +- src/runtime/wrap.c | 2 +- src/runtime/x86-arch.h | 2 +- version.lisp-expr | 2 +- 13 files changed, 26 insertions(+), 22 deletions(-) diff --git a/src/runtime/GNUmakefile b/src/runtime/GNUmakefile index 2e6be50..cfaac20 100644 --- a/src/runtime/GNUmakefile +++ b/src/runtime/GNUmakefile @@ -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. diff --git a/src/runtime/backtrace.c b/src/runtime/backtrace.c index 98189b9..52d3ce2 100644 --- a/src/runtime/backtrace.c +++ b/src/runtime/backtrace.c @@ -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); diff --git a/src/runtime/breakpoint.c b/src/runtime/breakpoint.c index 846fa77..f7f9e90 100644 --- a/src/runtime/breakpoint.c +++ b/src/runtime/breakpoint.c @@ -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 diff --git a/src/runtime/core.h b/src/runtime/core.h index ce2ec8f..57df1cb 100644 --- a/src/runtime/core.h +++ b/src/runtime/core.h @@ -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 diff --git a/src/runtime/coreparse.c b/src/runtime/coreparse.c index d657bac..ec5a100 100644 --- a/src/runtime/coreparse.c +++ b/src/runtime/coreparse.c @@ -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)); diff --git a/src/runtime/gc-common.c b/src/runtime/gc-common.c index f39495f..b76dc55 100644 --- a/src/runtime/gc-common.c +++ b/src/runtime/gc-common.c @@ -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 diff --git a/src/runtime/gencgc-internal.h b/src/runtime/gencgc-internal.h index ba56529..bded273 100644 --- a/src/runtime/gencgc-internal.h +++ b/src/runtime/gencgc-internal.h @@ -93,7 +93,7 @@ struct page { /* values for the page.allocated field */ -extern unsigned page_table_pages; +extern page_index_t page_table_pages; extern struct page *page_table; diff --git a/src/runtime/gencgc.c b/src/runtime/gencgc.c index a43d374..3afc1a2 100644 --- a/src/runtime/gencgc.c +++ b/src/runtime/gencgc.c @@ -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; /* @@ -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. */ diff --git a/src/runtime/print.c b/src/runtime/print.c index f448e51..73ec03b 100644 --- a/src/runtime/print.c +++ b/src/runtime/print.c @@ -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++) { diff --git a/src/runtime/thread.c b/src/runtime/thread.c index d38fd72..6489d7d 100644 --- a/src/runtime/thread.c +++ b/src/runtime/thread.c @@ -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 diff --git a/src/runtime/wrap.c b/src/runtime/wrap.c index 2bda7f9..5f18738 100644 --- a/src/runtime/wrap.c +++ b/src/runtime/wrap.c @@ -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 { diff --git a/src/runtime/x86-arch.h b/src/runtime/x86-arch.h index bf5d158..30363db 100644 --- a/src/runtime/x86-arch.h +++ b/src/runtime/x86-arch.h @@ -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; diff --git a/version.lisp-expr b/version.lisp-expr index 470135b..f95cae8 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -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" -- 1.7.10.4