From c66586ed71d9a1b48b5e754561b8801a671e1d49 Mon Sep 17 00:00:00 2001
From: dtc <dtc>
Date: Fri, 27 Oct 2000 19:25:56 +0000
Subject: [PATCH] Cleanup compiler warnings.

---
 lisp/arch.h       |  5 ++++-
 lisp/backtrace.c  |  6 ++----
 lisp/breakpoint.c |  9 ++++++---
 lisp/gencgc.c     | 11 ++++++-----
 lisp/gencgc.h     |  7 +++++--
 lisp/lisp.c       |  3 ++-
 lisp/monitor.c    |  5 ++++-
 lisp/purify.c     | 42 ++++++++++++++++++++++++------------------
 lisp/runprog.c    |  6 +++---
 lisp/save.c       |  5 +++--
 lisp/validate.c   |  4 ++--
 lisp/x86-arch.c   |  6 ++----
 12 files changed, 63 insertions(+), 46 deletions(-)

diff --git a/lisp/arch.h b/lisp/arch.h
index e613ec68d..975e4ace4 100644
--- a/lisp/arch.h
+++ b/lisp/arch.h
@@ -1,6 +1,6 @@
 /*
 
- $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/arch.h,v 1.4 1994/10/27 17:13:54 ram Exp $
+ $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/arch.h,v 1.5 2000/10/27 19:25:54 dtc Exp $
 
  This code was written as part of the CMU Common Lisp project at
  Carnegie Mellon University, and has been placed in the public domain.
@@ -30,4 +30,7 @@ extern lispobj funcall2(lispobj function, lispobj arg0, lispobj arg1);
 extern lispobj funcall3(lispobj function, lispobj arg0, lispobj arg1,
 			lispobj arg2);
 
+extern void fpu_save(void *);
+extern void fpu_restore(void *);
+
 #endif /* __ARCH_H__ */
diff --git a/lisp/backtrace.c b/lisp/backtrace.c
index 5eaf11c5c..eaa791b77 100644
--- a/lisp/backtrace.c
+++ b/lisp/backtrace.c
@@ -1,4 +1,4 @@
-/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/backtrace.c,v 1.4 1994/10/25 17:31:52 ram Exp $
+/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/backtrace.c,v 1.5 2000/10/27 19:25:54 dtc Exp $
  *
  * Simple backtrace facility.  More or less from Rob's lisp version.
  */
@@ -245,9 +245,7 @@ backtrace(int nframes)
 
 #else
 
-void
-backtrace(nframes)
-int nframes;
+void backtrace(int nframes)
 {
     printf("Can't backtrace on this hardware platform.\n");
 }
diff --git a/lisp/breakpoint.c b/lisp/breakpoint.c
index 48d6ed7bb..49c5eb101 100644
--- a/lisp/breakpoint.c
+++ b/lisp/breakpoint.c
@@ -1,6 +1,6 @@
 /*
 
- $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/breakpoint.c,v 1.11 2000/09/05 08:51:51 dtc Exp $
+ $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/breakpoint.c,v 1.12 2000/10/27 19:25:54 dtc Exp $
 
  This code was written as part of the CMU Common Lisp project at
  Carnegie Mellon University, and has been placed in the public domain.
@@ -19,6 +19,9 @@
 #include "globals.h"
 #include "alloc.h"
 #include "breakpoint.h"
+#if defined GENCGC
+#include "gencgc.h"
+#endif
 
 #define REAL_LRA_SLOT 0
 #ifndef i386
@@ -82,12 +85,12 @@ static lispobj find_code(struct sigcontext *scp)
 #ifdef i386
 static lispobj find_code(struct sigcontext *scp)
 {
-  lispobj codeptr = component_ptr_from_pc(SC_PC(scp));
+  lispobj *codeptr = component_ptr_from_pc(SC_PC(scp));
 
   if (codeptr == NULL)
     return NIL;
   else
-    return codeptr + type_OtherPointer;
+    return (lispobj) codeptr | type_OtherPointer;
 }
 #endif
 
diff --git a/lisp/gencgc.c b/lisp/gencgc.c
index 18b2d37c9..09bcc72cf 100644
--- a/lisp/gencgc.c
+++ b/lisp/gencgc.c
@@ -7,20 +7,21 @@
  *
  * Douglas Crosher, 1996, 1997, 1998, 1999.
  *
- * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/gencgc.c,v 1.23 2000/10/24 13:32:31 dtc Exp $
+ * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/gencgc.c,v 1.24 2000/10/27 19:25:55 dtc Exp $
  *
  */
 
 #include <stdio.h>
 #include <signal.h>
 #include "lisp.h"
+#include "arch.h"
 #include "internals.h"
 #include "os.h"
 #include "globals.h"
 #include "interrupt.h"
 #include "validate.h"
 #include "lispregs.h"
-
+#include "interr.h"
 #include "gencgc.h"
 
 #define gc_abort() lose("GC invariant lost!  File \"%s\", line %d\n", \
@@ -4194,7 +4195,7 @@ static lispobj* search_static_space(lispobj *pointer)
  * Faster version for searching the dynamic space. This will work even
  * if the object is in a current allocation region.
  */
-lispobj* search_dynamic_space(lispobj *pointer)
+lispobj *search_dynamic_space(lispobj *pointer)
 {
   int  page_index = find_page_index(pointer);
   lispobj *start;
@@ -5810,7 +5811,7 @@ static void	garbage_collect_generation(int generation, int raise)
 	   (lispobj *) SymbolValue(BINDING_STACK_POINTER) - binding_stack);
 
   /*
-   * Scavenge the scavenge_hooks in case this refers to a hooks added
+   * Scavenge the scavenge_hooks in case this refers to a hook added
    * in a prior generation GC. From here on the scavenger_hook will
    * only be updated with hooks already scavenged so this only needs
    * doing here.
@@ -5979,7 +5980,7 @@ void	collect_garbage(unsigned last_gen)
   if (gencgc_verbose > 1)
     print_generation_stats(0);
 
-  scavenger_hooks = (struct scavenger_hook *) NIL;
+  scavenger_hooks = NIL;
 
   do {
     /* Collect the generation */
diff --git a/lisp/gencgc.h b/lisp/gencgc.h
index de8db5dce..0e8e32796 100644
--- a/lisp/gencgc.h
+++ b/lisp/gencgc.h
@@ -7,7 +7,7 @@
  *
  * Douglas Crosher, 1996, 1997.
  *
- * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/gencgc.h,v 1.5 2000/10/24 13:32:32 dtc Exp $
+ * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/gencgc.h,v 1.6 2000/10/27 19:25:55 dtc Exp $
  *
  */
 
@@ -152,8 +152,11 @@ extern struct alloc_region  unboxed_region;
 void  gencgc_pickup_dynamic(void);
 
 void sniff_code_object(struct code *code, unsigned displacement);
-
+lispobj *search_dynamic_space(lispobj *pointer);
 void update_x86_dynamic_space_free_pointer(void);
+
+lispobj * component_ptr_from_pc(lispobj *pc);
+
 void gc_alloc_update_page_tables(int unboxed,
 				 struct alloc_region *alloc_region);
 #endif _GENCGC_H_
diff --git a/lisp/lisp.c b/lisp/lisp.c
index f581f2656..6efb0d40b 100644
--- a/lisp/lisp.c
+++ b/lisp/lisp.c
@@ -1,7 +1,7 @@
 /*
  * main() entry point for a stand alone lisp image.
  *
- * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/lisp.c,v 1.21 2000/10/24 17:45:57 dtc Exp $
+ * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/lisp.c,v 1.22 2000/10/27 19:25:55 dtc Exp $
  *
  */
 
@@ -25,6 +25,7 @@
 #include "gc.h"
 #include "monitor.h"
 #include "validate.h"
+#include "interr.h"
 #if defined GENCGC
 #include "gencgc.h"
 #endif
diff --git a/lisp/monitor.c b/lisp/monitor.c
index 479d1a47e..d41182caf 100644
--- a/lisp/monitor.c
+++ b/lisp/monitor.c
@@ -1,4 +1,4 @@
-/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/monitor.c,v 1.11 1999/02/22 11:41:10 dtc Exp $ */
+/* $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/monitor.c,v 1.12 2000/10/27 19:25:55 dtc Exp $ */
 
 #include <stdio.h>
 #include <sys/types.h>
@@ -22,6 +22,9 @@
 #include "gc.h"
 #include "search.h"
 #include "purify.h"
+#if defined GENCGC
+#include "gencgc.h"
+#endif
 
 extern boolean isatty(int fd);
 
diff --git a/lisp/purify.c b/lisp/purify.c
index a518e05c6..3c26c7595 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.19 2000/10/24 13:32:32 dtc Exp $ 
+   $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/purify.c,v 1.20 2000/10/27 19:25:55 dtc Exp $ 
 
    */
 #include <stdio.h>
@@ -18,6 +18,7 @@
 #include <stdlib.h>
 
 #include "lisp.h"
+#include "arch.h"
 #include "os.h"
 #include "internals.h"
 #include "globals.h"
@@ -414,28 +415,34 @@ lispobj *valid_stack_ra_locations[MAX_STACK_RETURN_ADDRESSES];
 lispobj *valid_stack_ra_code_objects[MAX_STACK_RETURN_ADDRESSES];
 unsigned int num_valid_stack_ra_locations;
 
-/* Identify valid stack slots. */
-static void
-setup_i386_stack_scav(lispobj *lowaddr, lispobj *base)
+/*
+ * Identify valid stack slots.
+ */
+
+static void  setup_i386_stack_scav(lispobj *lowaddr, lispobj *base)
 {
   lispobj *sp = lowaddr;
+
   num_valid_stack_locations = 0;  
   num_valid_stack_ra_locations = 0;  
+
   for (sp = lowaddr; sp < base; sp++) {
     lispobj thing = *sp;
     lispobj* start_addr;
     /* Find the object start address */
-    if ((start_addr = search_dynamic_space((void *)thing)) != NULL) {
-      /* Need to allow raw pointers into Code objects for return
-	 addresses. This will also pickup pointers to functions in code
-	 objects. */
+    if ((start_addr = search_dynamic_space((void *) thing)) != NULL) {
+      /*
+       * Need to allow raw pointers into Code objects for return
+       * addresses. This will also pickup pointers to functions in code
+       * objects.
+       */
       if (TypeOf(*start_addr) == type_CodeHeader) {
 	gc_assert(num_valid_stack_ra_locations < MAX_STACK_RETURN_ADDRESSES);
 	valid_stack_ra_locations[num_valid_stack_ra_locations] = sp;
 	valid_stack_ra_code_objects[num_valid_stack_ra_locations++] =
-	  (lispobj *)((int)start_addr + type_OtherPointer);
+	  (lispobj *) ((int) start_addr + type_OtherPointer);
       } else {
-	if (valid_dynamic_space_pointer((void *)thing, start_addr)) {
+	if (valid_dynamic_space_pointer((void *) thing, start_addr)) {
 	  gc_assert(num_valid_stack_locations < MAX_STACK_POINTERS);
 	  valid_stack_locations[num_valid_stack_locations++] = sp;
 	}
@@ -450,8 +457,7 @@ setup_i386_stack_scav(lispobj *lowaddr, lispobj *base)
   }
 }
 
-static void
-pscav_i386_stack(void)
+static void pscav_i386_stack(void)
 {
   int i;
 
@@ -462,14 +468,14 @@ pscav_i386_stack(void)
     lispobj code_obj = valid_stack_ra_code_objects[i];
     pscav(&code_obj, 1, FALSE);
     if (pointer_filter_verbose)
-      fprintf(stderr,"*C moved RA %x to %x; for code object %x to %x\n",
+      fprintf(stderr, "*C moved RA %x to %x; for code object %x to %x\n",
 	      *valid_stack_ra_locations[i],
-	      (int)(*valid_stack_ra_locations[i])
-	      - ((int)valid_stack_ra_code_objects[i] - (int)code_obj),
+	      (int) (*valid_stack_ra_locations[i])
+	      - ((int) valid_stack_ra_code_objects[i] - (int)code_obj),
 	      valid_stack_ra_code_objects[i], code_obj);
     *valid_stack_ra_locations[i] = 
-      (lispobj *)((int)(*valid_stack_ra_locations[i])
-		  - ((int)valid_stack_ra_code_objects[i] - (int)code_obj));
+      (lispobj *)((int) (*valid_stack_ra_locations[i])
+		  - ((int) valid_stack_ra_code_objects[i] - (int) code_obj));
   }
 }
 #endif
@@ -1137,7 +1143,7 @@ static struct scavenger_hook *scavenger_hooks=NIL;
 
 static int pscav_scavenger_hook(struct scavenger_hook *scav_hook)
 {
-  lispobj *old_value = scav_hook->value;
+  lispobj old_value = scav_hook->value;
 
   /* Scavenge the value */
   pscav((lispobj *)scav_hook+1, 1, FALSE);
diff --git a/lisp/runprog.c b/lisp/runprog.c
index dc7571393..274bf90e7 100644
--- a/lisp/runprog.c
+++ b/lisp/runprog.c
@@ -1,5 +1,5 @@
 /*
- * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/runprog.c,v 1.2 1994/10/25 00:12:10 ram Exp $
+ * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/runprog.c,v 1.3 2000/10/27 19:25:56 dtc Exp $
  *
  * Support for run-program.
  *
@@ -8,7 +8,7 @@
 #include <sys/file.h>
 #include <sys/fcntl.h>
 #include <sys/ioctl.h>
-#ifdef SVR4
+#if defined(SVR4) || defined(__linux__)
 #include <unistd.h>
 #endif
 
@@ -24,7 +24,7 @@ int spawn(char *program, char *argv[], char *envp[], char *pty_name,
     /* Put us in our own process group. */
 #if defined(hpux)
     setsid();
-#elif defined(SVR4)
+#elif defined(SVR4) || defined(__linux__)
     setpgrp();
 #else
     setpgrp(0, getpid());
diff --git a/lisp/save.c b/lisp/save.c
index b407d35d7..1bdf22a56 100644
--- a/lisp/save.c
+++ b/lisp/save.c
@@ -1,6 +1,6 @@
 /*
 
- $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/save.c,v 1.6 1997/11/25 17:59:14 dtc Exp $
+ $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/save.c,v 1.7 2000/10/27 19:25:56 dtc Exp $
 
  This code was written as part of the CMU Common Lisp project at
  Carnegie Mellon University, and has been placed in the public domain.
@@ -20,6 +20,7 @@
 #include "save.h"
 #include "lispregs.h"
 #include "validate.h"
+#include "dynbind.h"
 
 #ifdef GENCGC
 #include "gencgc.h"
@@ -72,7 +73,7 @@ static void output_space(FILE *file, int id, lispobj *addr, lispobj *end)
     data = write_bytes(file, (char *)addr, bytes);
 
     putw(data, file);
-    putw((os_vm_address_t)((long)addr / CORE_PAGESIZE), file);
+    putw((long) addr / CORE_PAGESIZE, file);
     putw((bytes + CORE_PAGESIZE - 1) / CORE_PAGESIZE, file);
 }
 
diff --git a/lisp/validate.c b/lisp/validate.c
index 582c3cee8..f2f09dd08 100644
--- a/lisp/validate.c
+++ b/lisp/validate.c
@@ -1,5 +1,5 @@
 /*
- * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/validate.c,v 1.7 2000/10/24 13:32:32 dtc Exp $
+ * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/validate.c,v 1.8 2000/10/27 19:25:56 dtc Exp $
  *
  * Memory Validation
  */
@@ -63,9 +63,9 @@ void validate(void)
 
 	current_dynamic_space = dynamic_0_space;
 
+#ifndef GENCGC
 	/* Dynamic-1 Space */
 	dynamic_1_space = (lispobj *) DYNAMIC_1_SPACE_START;
-#ifndef GENCGC
  	ensure_space(dynamic_1_space, dynamic_space_size);
 #endif
 
diff --git a/lisp/x86-arch.c b/lisp/x86-arch.c
index 97258867a..a8945413f 100644
--- a/lisp/x86-arch.c
+++ b/lisp/x86-arch.c
@@ -1,6 +1,6 @@
 /* x86-arch.c -*- Mode: C; comment-column: 40 -*-
  *
- * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/x86-arch.c,v 1.13 2000/10/21 12:42:46 dtc Exp $ 
+ * $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/lisp/x86-arch.c,v 1.14 2000/10/27 19:25:56 dtc Exp $ 
  *
  */
 
@@ -55,7 +55,7 @@ void arch_skip_instruction(struct sigcontext *context)
       vlen = *(char*) context->sc_pc++;
       /* Skip lisp error arg data bytes */
       while(vlen-- > 0) 
-	(char*) context->sc_pc++;
+	((char*) context->sc_pc)++;
       break;
 
     case trap_Breakpoint:
@@ -291,8 +291,6 @@ void  sigtrap_handler(HANDLER_ARGS)
 
 #define FIXNUM_VALUE(lispobj) (((int) lispobj) >> 2)
 
-extern void first_handler();
-
 void arch_install_interrupt_handlers()
 {
     interrupt_install_low_level_handler(SIGILL, sigtrap_handler);
-- 
GitLab