* Fixed all compilation warnings in the base code.

git-svn-id: svn://svn.zoy.org/elk/trunk@41 55e467fa-43c5-0310-a8a2-de718669efc6
This commit is contained in:
sam 2003-08-25 15:01:22 +00:00
parent c0f08629cc
commit fd9e7337f5
8 changed files with 43 additions and 68 deletions

View File

@ -249,6 +249,9 @@ fi
# generational_gc is set to "no" in the site file. Set mprotect=mmap if # generational_gc is set to "no" in the site file. Set mprotect=mmap if
# mprotect is supported, but only for mmap()ed memory. # mprotect is supported, but only for mmap()ed memory.
AC_CHECK_FUNCS(mprotect) AC_CHECK_FUNCS(mprotect)
if false; then
AC_DEFINE(MPROTECT_SIG, 1, [FIXME HARD])
fi
if false; then if false; then
AC_DEFINE(MPROTECT_MMAP, 1, [FIXME HARD]) AC_DEFINE(MPROTECT_MMAP, 1, [FIXME HARD])
fi fi

View File

@ -10,10 +10,10 @@ typedef struct {
int tag; int tag;
} Object; } Object;
#define FIXBITS (8 * sizeof(int)) #define FIXBITS (8 * (int)sizeof(int))
#define SIGNBIT ((unsigned)1 << (FIXBITS-1)) #define SIGNBIT ((unsigned)1 << (FIXBITS-1))
#define CONSTBIT 1 #define CONSTBIT 1
#define TYPEBITS (8 * sizeof(int) - 1) #define TYPEBITS (8 * (int)sizeof(int) - 1)
#define MAX_TYPE ((1 << TYPEBITS) - 1) #define MAX_TYPE ((1 << TYPEBITS) - 1)
#define UFIXNUM_FITS(i) (((i) & SIGNBIT) == 0) #define UFIXNUM_FITS(i) (((i) & SIGNBIT) == 0)
@ -41,8 +41,8 @@ typedef struct {
#ifdef GENERATIONAL_GC #ifdef GENERATIONAL_GC
typedef int gcspace_t; /* type for space and type arrays */ typedef int gcspace_t; /* type for space and type arrays */
typedef unsigned long int gcptr_t; /* type for pointers */ typedef ptrdiff_t gcptr_t; /* type for pointers */
typedef unsigned long int pageno_t; /* type for page numbers */ typedef long int pageno_t; /* type for page numbers */
typedef ptrdiff_t addrarith_t; /* type for address arithmetic */ typedef ptrdiff_t addrarith_t; /* type for address arithmetic */
extern gcspace_t *space; extern gcspace_t *space;

View File

@ -77,19 +77,15 @@ void Init_Dump () {
return False;\ return False;\
} }
#ifdef ELF #if defined(ELF)
# include "dump-elf.c" # include "dump-elf.c"
#else #elif defined(ECOFF)
#ifdef ECOFF
# include "dump-ecoff.c" # include "dump-ecoff.c"
#else #elif defined(HP9K)
#ifdef HP9K
# include "dump-hp9k.c" # include "dump-hp9k.c"
#else #else
# include "dump-vanilla.c" # include "dump-vanilla.c"
#endif #endif
#endif
#endif
/*ARGSUSED1*/ /*ARGSUSED1*/
void Set_File_Executable (int fd, char *fn) { void Set_File_Executable (int fd, char *fn) {

View File

@ -12,13 +12,10 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/types.h> #include <sys/types.h>
#ifdef HAVE_MPROTECT #if defined(MPROTECT_SIG) || defined(MPROTECT_MMAP)
# include <sys/mman.h> # include <sys/mman.h>
#endif #endif
#ifdef HAVE_GETPAGESIZE #if defined(HAVE_GETPAGESIZE) || defined(SC_PAGESIZE_IN_UNISTD_H)
# define SC_PAGESIZE_IN_UNISTD_H
#endif
#ifdef SC_PAGESIZE_IN_UNISTD_H
# define link FOO # define link FOO
# include <unistd.h> # include <unistd.h>
# undef link # undef link
@ -135,8 +132,8 @@ static void TerminateGC ();
/* PAGEBYTES is defined in object.h */ /* PAGEBYTES is defined in object.h */
#define PAGEWORDS (PAGEBYTES / sizeof (Object)) #define PAGEWORDS ((addrarith_t)(PAGEBYTES / sizeof (Object)))
#define HEAPPAGEMASK ~(PAGEBYTES-1) #define HEAPPAGEMASK ~((gcptr_t)PAGEBYTES-1)
#ifdef ALIGN_8BYTE #ifdef ALIGN_8BYTE
# define MAX_OBJECTWORDS (PAGEWORDS - 1) # define MAX_OBJECTWORDS (PAGEWORDS - 1)
@ -191,7 +188,7 @@ static void TerminateGC ();
#define SET_PROTECT(addr) { PMAP (addr) = 1; protected_pages++; } #define SET_PROTECT(addr) { PMAP (addr) = 1; protected_pages++; }
#define SET_UNPROTECT(addr) { PMAP (addr) = 0; protected_pages--; } #define SET_UNPROTECT(addr) { PMAP (addr) = 0; protected_pages--; }
#ifdef HAVE_MPROTECT #if defined(MPROTECT_SIG) || defined(MPROTECT_MMAP)
# ifndef PROT_RW # ifndef PROT_RW
# define PROT_RW (PROT_READ | PROT_WRITE) # define PROT_RW (PROT_READ | PROT_WRITE)
# endif # endif
@ -463,7 +460,7 @@ void Make_Heap (int size) {
Object heap_obj; Object heap_obj;
pageno_t i; pageno_t i;
#ifdef HAVE_MPROTECT #if defined(MPROTECT_SIG) || defined(MPROTECT_MMAP)
InstallHandler (); InstallHandler ();
#endif #endif
@ -472,19 +469,15 @@ void Make_Heap (int size) {
* then calculate the resulting number of heap pages. * then calculate the resulting number of heap pages.
*/ */
#ifdef SC_PAGESIZE_IN_UNISTD_H #if defined(SC_PAGESIZE_IN_UNISTD_H)
if ((bytes_per_pp = sysconf (_SC_PAGESIZE)) == -1) if ((bytes_per_pp = sysconf (_SC_PAGESIZE)) == -1)
Fatal_Error ("sysconf(_SC_PAGESIZE) failed; can't get pagesize"); Fatal_Error ("sysconf(_SC_PAGESIZE) failed; can't get pagesize");
#else #elif defined(HAVE_GETPAGESIZE)
#ifdef HAVE_GETPAGESIZE
bytes_per_pp = getpagesize (); bytes_per_pp = getpagesize ();
#elif defined(MPROTECT_SIG) || defined(MPROTECT_MMAP)
# error "mprotect requires getpagesize or sysconf_pagesize"
#else #else
# ifdef HAVE_MPROTECT
# include "mprotect requires getpagesize or sysconf_pagesize"
# else
bytes_per_pp = 4096; bytes_per_pp = 4096;
# endif
#endif
#endif #endif
physical_pages = (heapsize+bytes_per_pp-1)/bytes_per_pp; physical_pages = (heapsize+bytes_per_pp-1)/bytes_per_pp;
hp_per_pp = bytes_per_pp / PAGEBYTES; hp_per_pp = bytes_per_pp / PAGEBYTES;
@ -1290,7 +1283,7 @@ static int Scanner (pageno_t npages) {
return (scanned); return (scanned);
} }
#ifdef HAVE_MPROTECT #if defined(MPROTECT_SIG) || defined(MPROTECT_MMAP)
/* the following function handles a page fault. If the fault was caused /* the following function handles a page fault. If the fault was caused
* by the mutator and incremental collection is enabled, this will result * by the mutator and incremental collection is enabled, this will result
* in scanning the physical page the fault occured on. * in scanning the physical page the fault occured on.
@ -1633,7 +1626,7 @@ void Generational_GC_Finalize () {
} }
void Generational_GC_Reinitialize () { void Generational_GC_Reinitialize () {
#ifdef HAVE_MPROTECT #if defined(MPROTECT_SIG) || defined(MPROTECT_MMAP)
InstallHandler (); InstallHandler ();
#endif #endif
} }
@ -1641,7 +1634,7 @@ void Generational_GC_Reinitialize () {
Object Internal_GC_Status (int strat, int flags) { Object Internal_GC_Status (int strat, int flags) {
Object list; Object list;
#ifdef HAVE_MPROTECT #if defined(MPROTECT_SIG) || defined(MPROTECT_MMAP)
Object cell; Object cell;
#endif #endif
GC_Node; GC_Node;
@ -1650,7 +1643,7 @@ Object Internal_GC_Status (int strat, int flags) {
GC_Link (list); GC_Link (list);
switch (strat) { switch (strat) {
default: /* query or stop-and-copy */ default: /* query or stop-and-copy */
#ifdef HAVE_MPROTECT #if defined(MPROTECT_SIG) || defined(MPROTECT_MMAP)
if (inc_collection) { if (inc_collection) {
cell = Cons (Sym_Incremental_GC, Null); cell = Cons (Sym_Incremental_GC, Null);
(void)P_Set_Cdr (list, cell); (void)P_Set_Cdr (list, cell);
@ -1659,7 +1652,7 @@ Object Internal_GC_Status (int strat, int flags) {
break; break;
case GC_STRAT_GEN: case GC_STRAT_GEN:
if (flags == GC_FLAGS_INCR) { if (flags == GC_FLAGS_INCR) {
#ifdef HAVE_MPROTECT #if defined(MPROTECT_SIG) || defined(MPROTECT_MMAP)
inc_collection = 1; inc_collection = 1;
cell = Cons (Sym_Incremental_GC, Null); cell = Cons (Sym_Incremental_GC, Null);
(void)P_Set_Cdr (list, cell); (void)P_Set_Cdr (list, cell);

View File

@ -17,21 +17,15 @@ void Load_Source (Object);
void Fork_Load(); void Fork_Load();
#endif #endif
#ifdef USE_LD #if defined(USE_LD)
# include "load-ld.c" # include "load-ld.c"
#else #elif defined(USE_RLD)
#ifdef USE_RLD
# include "load-rld.c" # include "load-rld.c"
#else #elif defined(USE_SHL)
#ifdef USE_SHL
# include "load-shl.c" # include "load-shl.c"
#else #elif defined(USE_DLOPEN)
#ifdef USE_DLOPEN
# include "load-dl.c" # include "load-dl.c"
#endif #endif
#endif
#endif
#endif
void Init_Load () { void Init_Load () {
Define_Variable (&V_Load_Path, "load-path", Define_Variable (&V_Load_Path, "load-path",

View File

@ -133,7 +133,7 @@ int Get_Integer (Object x) {
if (d != floor (d)) if (d != floor (d))
Wrong_Type (x, T_Fixnum); Wrong_Type (x, T_Fixnum);
(void)frexp (d, &expo); (void)frexp (d, &expo);
if (expo <= 8 * sizeof(int) - 1) if (expo <= 8 * (int)sizeof(int) - 1)
return d; return d;
Primitive_Error ("integer out of range: ~s", x); Primitive_Error ("integer out of range: ~s", x);
default: default:
@ -160,7 +160,7 @@ unsigned int Get_Unsigned (Object x) {
if (d != floor (d)) if (d != floor (d))
Wrong_Type (x, T_Fixnum); Wrong_Type (x, T_Fixnum);
(void)frexp (d, &expo); (void)frexp (d, &expo);
if (expo <= 8 * sizeof(int)) if (expo <= 8 * (int)sizeof(int))
return d; return d;
err: err:
Primitive_Error ("integer out of range: ~s", x); Primitive_Error ("integer out of range: ~s", x);
@ -184,7 +184,7 @@ long int Get_Long (Object x) {
if (d != floor (d)) if (d != floor (d))
Wrong_Type (x, T_Fixnum); Wrong_Type (x, T_Fixnum);
(void)frexp (d, &expo); (void)frexp (d, &expo);
if (expo <= 8 * sizeof(long) - 1) if (expo <= 8 * (int)sizeof(long) - 1)
return d; return d;
Primitive_Error ("integer out of range: ~s", x); Primitive_Error ("integer out of range: ~s", x);
default: default:
@ -211,7 +211,7 @@ unsigned long int Get_Unsigned_Long (Object x) {
if (d != floor (d)) if (d != floor (d))
Wrong_Type (x, T_Fixnum); Wrong_Type (x, T_Fixnum);
(void)frexp (d, &expo); (void)frexp (d, &expo);
if (expo <= 8 * sizeof(long)) if (expo <= 8 * (int)sizeof(long))
return d; return d;
err: err:
Primitive_Error ("integer out of range: ~s", x); Primitive_Error ("integer out of range: ~s", x);

View File

@ -490,7 +490,8 @@ void Pr_Symbol (Object port, Object sym, int raw) {
void Pr_String (Object port, Object str, int raw) { void Pr_String (Object port, Object str, int raw) {
register char *p = STRING(str)->data; register char *p = STRING(str)->data;
register int c, i, len = STRING(str)->size; register int c, i;
register size_t len = STRING(str)->size;
GC_Node2; GC_Node2;
if (raw) { if (raw) {

View File

@ -10,35 +10,23 @@ void Free_Symbols (SYMTAB *);
#if defined(CAN_LOAD_OBJ) || defined (INIT_OBJECTS) #if defined(CAN_LOAD_OBJ) || defined (INIT_OBJECTS)
#ifdef MACH_O #if defined(MACH_O)
# include "stab-macho.c" # include "stab-macho.c"
#else #elif defined(ELF)
#ifdef ELF
# include "stab-elf.c" # include "stab-elf.c"
#else #elif defined(COFF) || defined(XCOFF)
#if defined(COFF) || defined(XCOFF)
# include "stab-coff.c" # include "stab-coff.c"
#else #elif defined(ECOFF)
#ifdef ECOFF
# include "stab-ecoff.c" # include "stab-ecoff.c"
#else #elif defined(CONVEX_AOUT)
#ifdef CONVEX_AOUT
# include "stab-convex.c" # include "stab-convex.c"
#else #elif defined(hp9000s300) || defined(__hp9000s300) || defined(__hp9000s300__)
#if defined(hp9000s300) || defined(__hp9000s300) || defined(__hp9000s300__)
# include "stab-hp9k300.c" # include "stab-hp9k300.c"
#else #elif defined(hp9000s800) || defined(__hp9000s800) || defined(__hp9000s800__)
#if defined(hp9000s800) || defined(__hp9000s800) || defined(__hp9000s800__)
# include "stab-hp9k800.c" # include "stab-hp9k800.c"
#else #else
# include "stab-bsd.c" # include "stab-bsd.c"
#endif #endif
#endif
#endif
#endif
#endif
#endif
#endif
static SYMPREFIX Ignore_Prefixes[] = { static SYMPREFIX Ignore_Prefixes[] = {
/* Currently none */ /* Currently none */