[MLton-commit] r4449
Matthew Fluet
MLton@mlton.org
Thu, 4 May 2006 12:12:38 -0700
Enable more warnings and compile with gcc 3.2
----------------------------------------------------------------------
U mlton/branches/on-20050822-x86_64-branch/runtime/Makefile
U mlton/branches/on-20050822-x86_64-branch/runtime/Posix/ProcEnv/ProcEnv.c
U mlton/branches/on-20050822-x86_64-branch/runtime/Posix/ProcEnv/Times.c
U mlton/branches/on-20050822-x86_64-branch/runtime/Posix/ProcEnv/Uname.c
U mlton/branches/on-20050822-x86_64-branch/runtime/Posix/TTY.c
U mlton/branches/on-20050822-x86_64-branch/runtime/basis/MLton/Rlimit/rlimit.c
U mlton/branches/on-20050822-x86_64-branch/runtime/basis/MLton/Syslog/Syslog.c
U mlton/branches/on-20050822-x86_64-branch/runtime/basis/Real/IEEEReal.c
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/align.h
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/array.c
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/array.h
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/dfs-mark.c
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/done.c
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/foreach.c
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/frame.c
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/frame.h
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/generational.c
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/generational.h
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/heap.c
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/int-inf.c
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/invariant.c
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/invariant.h
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/new-object.c
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/object.c
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/profiling.c
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/stack.c
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/stack.h
U mlton/branches/on-20050822-x86_64-branch/runtime/gen/gen-types.c
U mlton/branches/on-20050822-x86_64-branch/runtime/platform/displayMem.linux.c
U mlton/branches/on-20050822-x86_64-branch/runtime/platform/getText.c
U mlton/branches/on-20050822-x86_64-branch/runtime/platform/linux.c
U mlton/branches/on-20050822-x86_64-branch/runtime/platform/sysconf.c
U mlton/branches/on-20050822-x86_64-branch/runtime/util/assert.c
U mlton/branches/on-20050822-x86_64-branch/runtime/util/assert.h
U mlton/branches/on-20050822-x86_64-branch/runtime/util/die.c
U mlton/branches/on-20050822-x86_64-branch/runtime/util/die.h
U mlton/branches/on-20050822-x86_64-branch/runtime/util/read_write.h
U mlton/branches/on-20050822-x86_64-branch/runtime/util/to-string.c
----------------------------------------------------------------------
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/Makefile
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/Makefile 2006-05-04 15:26:50 UTC (rev 4448)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/Makefile 2006-05-04 19:12:26 UTC (rev 4449)
@@ -26,8 +26,12 @@
endif
ifeq ($(TARGET_ARCH), amd64)
+ifeq ($(findstring $(GCC_VERSION), 4),4)
FLAGS += -m32 -mtune=opteron
+else
+FLAGS += -m32
endif
+endif
ifeq ($(TARGET_ARCH), sparc)
FLAGS += -m32 -mcpu=v8
@@ -51,31 +55,55 @@
endif
CC = gcc -std=gnu99
-CFLAGS = -Wall -I. -Iplatform $(FLAGS)
+CFLAGS = -I. -Iplatform $(FLAGS)
OPTCFLAGS = $(CFLAGS) -O2 $(OPTFLAGS)
+DEBUGCFLAGS = $(CFLAGS) -gstabs+ -g2 -O1 -DASSERT=1
+ifeq ($(findstring $(GCC_VERSION), 4),4)
GCOPTCFLAGS = --param inline-unit-growth=75 --param max-inline-insns-single=1000
-DEBUGCFLAGS = $(CFLAGS) -gstabs+ -g2 -O1 -DASSERT=1
-WARNFLAGS = \
- -pedantic -Wall -Wextra \
- -Wno-unused-parameter -Wno-unused-function \
- -Wformat-nonliteral \
- -Wuninitialized -Winit-self \
- -Wstrict-aliasing=2 \
- -Wfloat-equal \
- -Wpointer-arith \
- -Wbad-function-cast -Wcast-qual -Wcast-align \
- -Waggregate-return \
- -Wstrict-prototypes \
- -Wmissing-noreturn -Wmissing-format-attribute \
- -Wpacked \
- -Wredundant-decls \
- -Wnested-externs \
- -Wmissing-prototypes \
- -Wmissing-declarations
-# -Wconversion
-# -Wshadow
-OPTWARNFLAGS = $(WARNFLAGS) -Winline -Wdisabled-optimization
-DEBUGWARNFLAGS = $(WARNFLAGS) -Wunused
+else
+GCOPTCFLAGS =
+endif
+WARNCFLAGS =
+WARNCFLAGS += -pedantic -Wall
+ifeq ($(findstring $(GCC_VERSION), 4),4)
+WARNCFLAGS += -Wextra
+else
+WARNCFLAGS += -W
+endif
+WARNCFLAGS += -Wformat=2
+# WARNCFLAGS += -Wswitch-default -Wswitch-enum
+WARNCFLAGS += -Wuninitialized
+ifeq ($(findstring $(GCC_VERSION), 4),4)
+WARNCFLAGS += -Winit-self
+endif
+ifeq ($(findstring $(GCC_VERSION), 4),4)
+WARNCFLAGS += -Wstrict-aliasing=2
+endif
+WARNCFLAGS += -Wfloat-equal
+WARNCFLAGS += -Wundef
+WARNCFLAGS += -Wshadow
+WARNCFLAGS += -Wpointer-arith
+WARNCFLAGS += -Wbad-function-cast -Wcast-qual -Wcast-align
+WARNCFLAGS += -Wwrite-strings
+# WARNCFLAGS += -Wconversion
+WARNCFLAGS += -Waggregate-return
+WARNCFLAGS += -Wstrict-prototypes
+ifeq ($(findstring $(GCC_VERSION), 4),4)
+WARNCFLAGS += -Wold-style-definition
+endif
+WARNCFLAGS += -Wmissing-prototypes -Wmissing-declarations
+ifeq ($(findstring $(GCC_VERSION), 4),4)
+WARNCFLAGS += -Wmissing-field-initializers
+endif
+WARNCFLAGS += -Wmissing-noreturn
+WARNCFLAGS += -Wmissing-format-attribute
+# WARNCFLAGS += -Wpacked -Wpadded
+WARNCFLAGS += -Wredundant-decls
+WARNCFLAGS += -Wnested-externs
+WARNCFLAGS += -Wlong-long
+# WARNCFLAGS += -Wunreachable-code
+OPTWARNCFLAGS = $(WARNCFLAGS) -Winline -Wdisabled-optimization
+DEBUGWARNCFLAGS = $(WARNCFLAGS)
UTILCFILES = \
$(shell find util -type f | grep '\.c$$')
@@ -136,7 +164,7 @@
libgdtoa.a: gdtoa/arith.h
cd gdtoa && \
- $(CC) $(OPTCFLAGS) $(OPTWARNFLAGS) \
+ $(CC) $(OPTCFLAGS) $(OPTWARNCFLAGS) \
-Dstrtod=gdtoa_strtod \
-Dstrtof=gdtoa_strtof \
-w -O1 -c -DINFNAN_CHECK \
@@ -168,14 +196,14 @@
util/%-gdb.o: util/%.c util.h $(UTILHFILES)
- $(CC) $(DEBUGCFLAGS) $(DEBUGWARNFLAGS) -c -o $@ $<
+ $(CC) $(DEBUGCFLAGS) $(DEBUGWARNCFLAGS) -c -o $@ $<
util/%.o: util/%.c util.h $(UTILHFILES)
- $(CC) $(OPTCFLAGS) $(OPTWARNFLAGS) -c -o $@ $<
+ $(CC) $(OPTCFLAGS) $(WARNCFLAGS) -c -o $@ $<
c-types.h ml-types.h: gen/gen-types.c util.h $(UTILOFILES)
rm -f c-types.h ml-types.h
- $(CC) $(OPTCFLAGS) $(WARNFLAGS) -o gen/gen-types gen/gen-types.c $(UTILOFILES)
+ $(CC) $(OPTCFLAGS) $(WARNCFLAGS) -o gen/gen-types gen/gen-types.c $(UTILOFILES)
cd gen && ./gen-types
cp gen/c-types.h c-types.h
cp gen/c-types.sml ../basis-library.refactor/config/c/$(TARGET_ARCH)-$(TARGET_OS)/c-types.sml
@@ -191,10 +219,10 @@
rm -f gen/gen-basis-ffi gen/basis-ffi.h gen/basis-ffi.sml
gc-gdb.o: gc.c $(GCCFILES) $(HFILES)
- $(CC) $(DEBUGCFLAGS) $(DEBUGWARNFLAGS) -c -o $@ $<
+ $(CC) $(DEBUGCFLAGS) $(DEBUGWARNCFLAGS) -c -o $@ $<
gc.o: gc.c $(GCCFILES) $(HFILES)
- $(CC) $(OPTCFLAGS) $(GCOPTCFLAGS) $(OPTWARNFLAGS) -c -o $@ $<
+ $(CC) $(OPTCFLAGS) $(GCOPTCFLAGS) $(OPTWARNCFLAGS) -c -o $@ $<
# It looks like we don't follow the C spec w.r.t. aliasing. And gcc
# -O2 catches us on the code in Real/*.c where we treat a double as a
@@ -203,15 +231,15 @@
# with -fno-strict-aliasing to prevent gcc from taking advantage of
# this aspect of the C spec.
basis/Real/%-gdb.o: basis/Real/%.c gdtoa/arith.h $(HFILES)
- $(CC) $(DEBUGCFLAGS) $(DEBUGWARNFLAGS) -c -o $@ $<
+ $(CC) $(DEBUGCFLAGS) $(DEBUGWARNCFLAGS) -c -o $@ $<
basis/Real/%.o: basis/Real/%.c gdtoa/arith.h $(HFILES)
- $(CC) $(OPTCFLAGS) $(OPTWARNFLAGS) -O1 -fno-strict-aliasing -c -o $@ $<
+ $(CC) $(OPTCFLAGS) $(OPTWARNCFLAGS) -O1 -fno-strict-aliasing -c -o $@ $<
%-gdb.o: %.c $(HFILES)
- $(CC) $(DEBUGCFLAGS) $(DEBUGWARNFLAGS) -c -o $@ $<
+ $(CC) $(DEBUGCFLAGS) $(DEBUGWARNCFLAGS) -c -o $@ $<
%.o: %.c $(HFILES)
- $(CC) $(OPTCFLAGS) $(OPTWARNFLAGS) -c -o $@ $<
+ $(CC) $(OPTCFLAGS) $(OPTWARNCFLAGS) -c -o $@ $<
%-gdb.o: %.S
$(CC) $(DEBUGCFLAGS) -c -o $@ $<
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/Posix/ProcEnv/ProcEnv.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/Posix/ProcEnv/ProcEnv.c 2006-05-04 15:26:50 UTC (rev 4448)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/Posix/ProcEnv/ProcEnv.c 2006-05-04 19:12:26 UTC (rev 4449)
@@ -1,6 +1,6 @@
#include "platform.h"
-C_String_t Posix_ProcEnv_ctermid () {
+C_String_t Posix_ProcEnv_ctermid (void) {
char *res = ctermid (NULL);
return (C_String_t)res;
}
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/Posix/ProcEnv/Times.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/Posix/ProcEnv/Times.c 2006-05-04 15:26:50 UTC (rev 4448)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/Posix/ProcEnv/Times.c 2006-05-04 19:12:26 UTC (rev 4449)
@@ -2,19 +2,19 @@
static struct tms tms;
-C_Clock_t Posix_ProcEnv_Times_getUTime() {
+C_Clock_t Posix_ProcEnv_Times_getUTime(void) {
return tms.tms_utime;
}
-C_Clock_t Posix_ProcEnv_Times_getSTime() {
+C_Clock_t Posix_ProcEnv_Times_getSTime(void) {
return tms.tms_stime;
}
-C_Clock_t Posix_ProcEnv_Times_getCUTime() {
+C_Clock_t Posix_ProcEnv_Times_getCUTime(void) {
return tms.tms_cutime;
}
-C_Clock_t Posix_ProcEnv_Times_getCSTime() {
+C_Clock_t Posix_ProcEnv_Times_getCSTime(void) {
return tms.tms_cstime;
}
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/Posix/ProcEnv/Uname.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/Posix/ProcEnv/Uname.c 2006-05-04 15:26:50 UTC (rev 4448)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/Posix/ProcEnv/Uname.c 2006-05-04 19:12:26 UTC (rev 4449)
@@ -2,26 +2,26 @@
static struct utsname mlton_utsname;
-C_String_t Posix_ProcEnv_Uname_getSysName () {
+C_String_t Posix_ProcEnv_Uname_getSysName (void) {
return (C_String_t)mlton_utsname.sysname;
}
-C_String_t Posix_ProcEnv_Uname_getNodeName () {
+C_String_t Posix_ProcEnv_Uname_getNodeName (void) {
return (C_String_t)mlton_utsname.nodename;
}
-C_String_t Posix_ProcEnv_Uname_getRelease () {
+C_String_t Posix_ProcEnv_Uname_getRelease (void) {
return (C_String_t)mlton_utsname.release;
}
-C_String_t Posix_ProcEnv_Uname_getVersion () {
+C_String_t Posix_ProcEnv_Uname_getVersion (void) {
return (C_String_t)mlton_utsname.version;
}
-C_String_t Posix_ProcEnv_Uname_getMachine () {
+C_String_t Posix_ProcEnv_Uname_getMachine (void) {
return (C_String_t)mlton_utsname.machine;
}
-C_Errno_t(C_Int_t) Posix_ProcEnv_uname () {
+C_Errno_t(C_Int_t) Posix_ProcEnv_uname (void) {
return uname (&mlton_utsname);
}
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/Posix/TTY.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/Posix/TTY.c 2006-05-04 15:26:50 UTC (rev 4448)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/Posix/TTY.c 2006-05-04 19:12:26 UTC (rev 4449)
@@ -27,7 +27,7 @@
return cfgetospeed (&termios);
}
-C_Speed_t Posix_TTY_Termios_cfGetISpeed () {
+C_Speed_t Posix_TTY_Termios_cfGetISpeed (void) {
return cfgetispeed (&termios);
}
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/basis/MLton/Rlimit/rlimit.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/basis/MLton/Rlimit/rlimit.c 2006-05-04 15:26:50 UTC (rev 4448)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/basis/MLton/Rlimit/rlimit.c 2006-05-04 19:12:26 UTC (rev 4449)
@@ -6,11 +6,11 @@
return getrlimit (r, &rlimit);
}
-C_RLim_t MLton_Rlimit_getHard () {
+C_RLim_t MLton_Rlimit_getHard (void) {
return rlimit.rlim_max;
}
-C_RLim_t MLton_Rlimit_getSoft () {
+C_RLim_t MLton_Rlimit_getSoft (void) {
return rlimit.rlim_cur;
}
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/basis/MLton/Syslog/Syslog.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/basis/MLton/Syslog/Syslog.c 2006-05-04 15:26:50 UTC (rev 4448)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/basis/MLton/Syslog/Syslog.c 2006-05-04 19:12:26 UTC (rev 4449)
@@ -6,7 +6,7 @@
/* openlog relies on the string being around forever. */
void MLton_Syslog_openlog(NullString8_t s, C_Int_t o, C_Int_t f) {
- char *s_ = strdup ((const char*)s);
+ const char *s_ = strdup ((const char*)s);
if (s_ == NULL)
s_ = "";
openlog (s_, o, f);
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/basis/Real/IEEEReal.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/basis/Real/IEEEReal.c 2006-05-04 15:26:50 UTC (rev 4448)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/basis/Real/IEEEReal.c 2006-05-04 19:12:26 UTC (rev 4449)
@@ -35,7 +35,7 @@
#endif
-C_Int_t IEEEReal_getRoundingMode () {
+C_Int_t IEEEReal_getRoundingMode (void) {
return fegetround ();
}
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/align.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/align.h 2006-05-04 15:26:50 UTC (rev 4448)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/align.h 2006-05-04 19:12:26 UTC (rev 4449)
@@ -9,7 +9,9 @@
#if (defined (MLTON_GC_INTERNAL_FUNCS))
static inline size_t alignWithExtra (GC_state s, size_t bytes, size_t extra);
+#if ASSERT
static inline bool isFrontierAligned (GC_state s, pointer p);
+#endif
static inline pointer alignFrontier (GC_state s, pointer p);
#endif /* (defined (MLTON_GC_INTERNAL_FUNCS)) */
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/array.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/array.c 2006-05-04 15:26:50 UTC (rev 4448)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/array.c 2006-05-04 19:12:26 UTC (rev 4449)
@@ -47,9 +47,9 @@
return *(getArrayCounterp (a));
}
-pointer indexArrayAtPointerIndex (GC_state s, pointer a,
+pointer indexArrayAtObjptrIndex (GC_state s, pointer a,
GC_arrayCounter arrayIndex,
- uint32_t pointerIndex) {
+ uint32_t objptrIndex) {
GC_header header;
uint16_t bytesNonObjptrs;
uint16_t numObjptrs;
@@ -62,5 +62,5 @@
return a
+ (arrayIndex * (bytesNonObjptrs + (numObjptrs * OBJPTR_SIZE)))
+ bytesNonObjptrs
- + (pointerIndex * OBJPTR_SIZE);
+ + (objptrIndex * OBJPTR_SIZE);
}
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/array.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/array.h 2006-05-04 15:26:50 UTC (rev 4448)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/array.h 2006-05-04 19:12:26 UTC (rev 4449)
@@ -38,9 +38,9 @@
static inline GC_arrayLength getArrayLength (pointer a);
static inline GC_arrayCounter* getArrayCounterp (pointer a);
static inline GC_arrayCounter getArrayCounter (pointer a);
-static inline pointer indexArrayAtPointerIndex (GC_state s, pointer a,
- GC_arrayCounter arrayIndex,
- uint32_t pointerIndex);
+static inline pointer indexArrayAtObjptrIndex (GC_state s, pointer a,
+ GC_arrayCounter arrayIndex,
+ uint32_t objptrIndex);
#endif /* (defined (MLTON_GC_INTERNAL_FUNCS)) */
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/dfs-mark.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/dfs-mark.c 2006-05-04 15:26:50 UTC (rev 4448)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/dfs-mark.c 2006-05-04 19:12:26 UTC (rev 4449)
@@ -49,7 +49,7 @@
uint16_t bytesNonObjptrs;
uint16_t numObjptrs;
GC_objectTypeTag tag;
- uint32_t index; /* The i'th pointer in the object (element) being marked. */
+ uint32_t objptrIndex; /* The i'th pointer in the object (element) being marked. */
GC_header nextHeader;
GC_header* nextHeaderp;
GC_arrayCounter arrayIndex;
@@ -128,18 +128,18 @@
goto ret;
}
todo = cur + bytesNonObjptrs;
- index = 0;
+ objptrIndex = 0;
markInNormal:
if (DEBUG_DFS_MARK)
- fprintf (stderr, "markInNormal index = %"PRIu32"\n", index);
- assert (index < numObjptrs);
+ fprintf (stderr, "markInNormal objptrIndex = %"PRIu32"\n", objptrIndex);
+ assert (objptrIndex < numObjptrs);
// next = *(pointer*)todo;
next = fetchObjptrToPointer (todo, s->heap.start);
if (not isPointer (next)) {
markNextInNormal:
- assert (index < numObjptrs);
- index++;
- if (index == numObjptrs) {
+ assert (objptrIndex < numObjptrs);
+ objptrIndex++;
+ if (objptrIndex == numObjptrs) {
/* Done. Clear out the counters and return. */
*headerp = header & ~COUNTER_MASK;
goto normalDone;
@@ -154,7 +154,7 @@
shareObjptr (s, (objptr*)todo);
goto markNextInNormal;
}
- *headerp = (header & ~COUNTER_MASK) | (index << COUNTER_SHIFT);
+ *headerp = (header & ~COUNTER_MASK) | (objptrIndex << COUNTER_SHIFT);
goto markNext;
} else if (WEAK_TAG == tag) {
/* Store the marked header and don't follow any pointers. */
@@ -163,7 +163,7 @@
/* When marking arrays:
* arrayIndex is the index of the element to mark.
* cur is the pointer to the array.
- * index is the index of the pointer within the element
+ * objptrIndex is the index of the pointer within the element
* (i.e. the i'th pointer is at index i).
* todo is the start of the element.
*/
@@ -182,26 +182,26 @@
todo = cur;
markArrayElt:
assert (arrayIndex < getArrayLength (cur));
- index = 0;
+ objptrIndex = 0;
/* Skip to the first pointer. */
todo += bytesNonObjptrs;
markInArray:
if (DEBUG_DFS_MARK)
- fprintf (stderr, "markInArray arrayIndex = %"PRIu32" index = %"PRIu32"\n",
- arrayIndex, index);
+ fprintf (stderr, "markInArray arrayIndex = %"PRIu32" objptrIndex = %"PRIu32"\n",
+ arrayIndex, objptrIndex);
assert (arrayIndex < getArrayLength (cur));
- assert (index < numObjptrs);
- assert (todo == indexArrayAtPointerIndex (s, cur, arrayIndex, index));
+ assert (objptrIndex < numObjptrs);
+ assert (todo == indexArrayAtObjptrIndex (s, cur, arrayIndex, objptrIndex));
// next = *(pointer*)todo;
next = fetchObjptrToPointer (todo, s->heap.start);
if (not (isPointer(next))) {
markNextInArray:
assert (arrayIndex < getArrayLength (cur));
- assert (index < numObjptrs);
- assert (todo == indexArrayAtPointerIndex (s, cur, arrayIndex, index));
+ assert (objptrIndex < numObjptrs);
+ assert (todo == indexArrayAtObjptrIndex (s, cur, arrayIndex, objptrIndex));
todo += OBJPTR_SIZE;
- index++;
- if (index < numObjptrs)
+ objptrIndex++;
+ if (objptrIndex < numObjptrs)
goto markInArray;
arrayIndex++;
if (arrayIndex < getArrayLength (cur))
@@ -220,7 +220,7 @@
}
/* Recur and mark next. */
*getArrayCounterp (cur) = arrayIndex;
- *headerp = (header & ~COUNTER_MASK) | (index << COUNTER_SHIFT);
+ *headerp = (header & ~COUNTER_MASK) | (objptrIndex << COUNTER_SHIFT);
goto markNext;
} else {
assert (STACK_TAG == tag);
@@ -239,37 +239,37 @@
(size_t)(top - getStackBottom (s, (GC_stack)cur)));
if (top == getStackBottom (s, (GC_stack)(cur)))
goto ret;
- index = 0;
+ objptrIndex = 0;
returnAddress = *(GC_returnAddress*) (top - GC_RETURNADDRESS_SIZE);
frameLayout = getFrameLayoutFromReturnAddress (s, returnAddress);
frameOffsets = frameLayout->offsets;
((GC_stack)cur)->markTop = top;
markInFrame:
- if (index == frameOffsets [0]) {
+ if (objptrIndex == frameOffsets [0]) {
top -= frameLayout->size;
goto markInStack;
}
- todo = top - frameLayout->size + frameOffsets [index + 1];
+ todo = top - frameLayout->size + frameOffsets [objptrIndex + 1];
// next = *(pointer*)todo;
next = fetchObjptrToPointer (todo, s->heap.start);
if (DEBUG_DFS_MARK)
fprintf (stderr,
" offset %u todo "FMTPTR" next = "FMTPTR"\n",
- frameOffsets [index + 1],
+ frameOffsets [objptrIndex + 1],
(uintptr_t)todo, (uintptr_t)next);
if (not isPointer (next)) {
- index++;
+ objptrIndex++;
goto markInFrame;
}
nextHeaderp = getHeaderp (next);
nextHeader = *nextHeaderp;
if (mark == (nextHeader & MARK_MASK)) {
- index++;
+ objptrIndex++;
if (shouldHashCons)
shareObjptr (s, (objptr*)todo);
goto markInFrame;
}
- ((GC_stack)cur)->markIndex = index;
+ ((GC_stack)cur)->markIndex = objptrIndex;
goto markNext;
}
assert (FALSE);
@@ -295,8 +295,8 @@
assert (WEAK_TAG != tag);
if (NORMAL_TAG == tag) {
todo = cur + bytesNonObjptrs;
- index = (header & COUNTER_MASK) >> COUNTER_SHIFT;
- todo += index * OBJPTR_SIZE;
+ objptrIndex = (header & COUNTER_MASK) >> COUNTER_SHIFT;
+ todo += objptrIndex * OBJPTR_SIZE;
// prev = *(pointer*)todo;
prev = fetchObjptrToPointer (todo, s->heap.start);
// *(pointer*)todo = next;
@@ -307,8 +307,8 @@
} else if (ARRAY_TAG == tag) {
arrayIndex = getArrayCounter (cur);
todo = cur + arrayIndex * (bytesNonObjptrs + (numObjptrs * OBJPTR_SIZE));
- index = (header & COUNTER_MASK) >> COUNTER_SHIFT;
- todo += bytesNonObjptrs + index * OBJPTR_SIZE;
+ objptrIndex = (header & COUNTER_MASK) >> COUNTER_SHIFT;
+ todo += bytesNonObjptrs + objptrIndex * OBJPTR_SIZE;
// prev = *(pointer*)todo;
prev = fetchObjptrToPointer (todo, s->heap.start);
// *(pointer*)todo = next;
@@ -318,20 +318,20 @@
goto markNextInArray;
} else {
assert (STACK_TAG == tag);
- index = ((GC_stack)cur)->markIndex;
+ objptrIndex = ((GC_stack)cur)->markIndex;
top = ((GC_stack)cur)->markTop;
/* Invariant: top points just past a "return address". */
returnAddress = *(GC_returnAddress*) (top - GC_RETURNADDRESS_SIZE);
frameLayout = getFrameLayoutFromReturnAddress (s, returnAddress);
frameOffsets = frameLayout->offsets;
- todo = top - frameLayout->size + frameOffsets [index + 1];
+ todo = top - frameLayout->size + frameOffsets [objptrIndex + 1];
// prev = *(pointer*)todo;
prev = fetchObjptrToPointer (todo, s->heap.start);
// *(pointer*)todo = next;
storeObjptrFromPointer (todo, next, s->heap.start);
if (shouldHashCons)
markIntergenerationalPointer (s, (pointer*)todo);
- index++;
+ objptrIndex++;
goto markInFrame;
}
assert (FALSE);
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/done.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/done.c 2006-05-04 15:26:50 UTC (rev 4448)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/done.c 2006-05-04 19:12:26 UTC (rev 4449)
@@ -6,7 +6,7 @@
* See the file MLton-LICENSE for details.
*/
-static void displayCol (FILE *out, int width, char *s) {
+static void displayCol (FILE *out, int width, const char *s) {
int extra;
int i;
int len;
@@ -20,7 +20,7 @@
fprintf (out, "%s\t", s);
}
-static void displayCollectionStats (FILE *out, char *name, struct rusage *ru,
+static void displayCollectionStats (FILE *out, const char *name, struct rusage *ru,
uintmax_t num, uintmax_t bytes) {
uintmax_t ms;
@@ -43,7 +43,7 @@
minorGC (s);
out = stderr;
if (s->controls.summary) {
- uintmax_t time;
+ uintmax_t totalTime;
uintmax_t gcTime;
gcTime = rusageTime (&s->cumulativeStatistics.ru_gc);
@@ -64,12 +64,12 @@
&s->cumulativeStatistics.ru_gcMinor,
s->cumulativeStatistics.numMinorGCs,
s->cumulativeStatistics.bytesCopiedMinor);
- time = getCurrentTime () - s->startTime;
+ totalTime = getCurrentTime () - s->startTime;
fprintf (out, "total GC time: %s ms (%.1f%%)\n",
uintmaxToCommaString (gcTime),
- (0 == time)
+ (0 == totalTime)
? 0.0
- : 100.0 * ((double) gcTime) / (double)time);
+ : 100.0 * ((double) gcTime) / (double)totalTime);
fprintf (out, "max pause: %s ms\n",
uintmaxToCommaString (s->cumulativeStatistics.maxPause));
fprintf (out, "total allocated: %s bytes\n",
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/foreach.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/foreach.c 2006-05-04 15:26:50 UTC (rev 4448)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/foreach.c 2006-05-04 19:12:26 UTC (rev 4449)
@@ -198,7 +198,7 @@
/* Apply f to the frame index of each frame in the current thread's stack. */
void foreachStackFrame (GC_state s, GC_foreachStackFrameFun f) {
pointer bottom;
- GC_frameIndex index;
+ GC_frameIndex findex;
GC_frameLayout layout;
GC_returnAddress returnAddress;
pointer top;
@@ -211,15 +211,15 @@
(uintptr_t)bottom, (uintptr_t)s->stackTop);
for (top = s->stackTop; top > bottom; top -= layout->size) {
returnAddress = *((GC_returnAddress*)(top - GC_RETURNADDRESS_SIZE));
- index = getFrameIndexFromReturnAddress (s, returnAddress);
+ findex = getFrameIndexFromReturnAddress (s, returnAddress);
if (DEBUG_PROFILE)
- fprintf (stderr, "top = "FMTPTR" index = "FMTFI"\n",
- (uintptr_t)top, index);
- unless (index < s->frameLayoutsLength)
- die ("top = "FMTPTR" returnAddress = "FMTRA" index = "FMTFI"\n",
- (uintptr_t)top, (uintptr_t)returnAddress, index);
- f (s, index);
- layout = &(s->frameLayouts[index]);
+ fprintf (stderr, "top = "FMTPTR" findex = "FMTFI"\n",
+ (uintptr_t)top, findex);
+ unless (findex < s->frameLayoutsLength)
+ die ("top = "FMTPTR" returnAddress = "FMTRA" findex = "FMTFI"\n",
+ (uintptr_t)top, (uintptr_t)returnAddress, findex);
+ f (s, findex);
+ layout = &(s->frameLayouts[findex]);
assert (layout->size > 0);
}
if (DEBUG_PROFILE)
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/frame.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/frame.c 2006-05-04 15:26:50 UTC (rev 4448)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/frame.c 2006-05-04 19:12:26 UTC (rev 4449)
@@ -16,23 +16,23 @@
return res;
}
-GC_frameLayout getFrameLayoutFromFrameIndex (GC_state s, GC_frameIndex index) {
+GC_frameLayout getFrameLayoutFromFrameIndex (GC_state s, GC_frameIndex findex) {
GC_frameLayout layout;
if (DEBUG_DETAILED)
- fprintf (stderr, "index = "FMTFI" frameLayoutsLength = %"PRIu32"\n",
- index, s->frameLayoutsLength);
- assert (index < s->frameLayoutsLength);
- layout = &(s->frameLayouts[index]);
+ fprintf (stderr, "findex = "FMTFI" frameLayoutsLength = %"PRIu32"\n",
+ findex, s->frameLayoutsLength);
+ assert (findex < s->frameLayoutsLength);
+ layout = &(s->frameLayouts[findex]);
assert (layout->size > 0);
return layout;
}
GC_frameLayout getFrameLayoutFromReturnAddress (GC_state s, GC_returnAddress ra) {
GC_frameLayout layout;
- GC_frameIndex index;
+ GC_frameIndex findex;
- index = getFrameIndexFromReturnAddress (s, ra);
- layout = getFrameLayoutFromFrameIndex(s, index);
+ findex = getFrameIndexFromReturnAddress (s, ra);
+ layout = getFrameLayoutFromFrameIndex(s, findex);
return layout;
}
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/frame.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/frame.h 2006-05-04 15:26:50 UTC (rev 4448)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/frame.h 2006-05-04 19:12:26 UTC (rev 4449)
@@ -52,7 +52,7 @@
#if (defined (MLTON_GC_INTERNAL_FUNCS))
static inline GC_frameIndex getFrameIndexFromReturnAddress (GC_state s, GC_returnAddress ra);
-static inline GC_frameLayout getFrameLayoutFromFrameIndex (GC_state s, GC_frameIndex index);
+static inline GC_frameLayout getFrameLayoutFromFrameIndex (GC_state s, GC_frameIndex findex);
static inline GC_frameLayout getFrameLayoutFromReturnAddress (GC_state s, GC_returnAddress ra);
#endif /* (defined (MLTON_GC_INTERNAL_FUNCS)) */
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/generational.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/generational.c 2006-05-04 15:26:50 UTC (rev 4448)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/generational.c 2006-05-04 19:12:26 UTC (rev 4449)
@@ -186,6 +186,7 @@
}
}
+#if ASSERT
/* isCrossMapOk is a slower, but easier to understand, way of
* computing the crossMap. updateCrossMap (below) incrementally
* updates the crossMap, checking only the part of the old generation
@@ -223,6 +224,7 @@
GC_release (map, mapSize);
return TRUE;
}
+#endif
void updateCrossMap (GC_state s) {
GC_cardMapIndex cardIndex;
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/generational.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/generational.h 2006-05-04 15:26:50 UTC (rev 4448)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/generational.h 2006-05-04 19:12:26 UTC (rev 4449)
@@ -74,7 +74,9 @@
static void createCardMapAndCrossMap (GC_state s);
static void resizeCardMapAndCrossMap (GC_state s);
+#if ASSERT
static bool isCrossMapOk (GC_state s);
+#endif
static void updateCrossMap (GC_state s);
#endif /* (defined (MLTON_GC_INTERNAL_FUNCS)) */
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/heap.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/heap.c 2006-05-04 15:26:50 UTC (rev 4448)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/heap.c 2006-05-04 19:12:26 UTC (rev 4449)
@@ -309,9 +309,9 @@
/* Write the heap to a file and try again. */
int fd;
char template[80];
- char *tmpDefault;
+ const char *tmpDefault;
char *tmpDir;
- char *tmpVar;
+ const char *tmpVar;
#if (defined (__MSVCRT__))
tmpVar = "TEMP";
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/int-inf.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/int-inf.c 2006-05-04 15:26:50 UTC (rev 4448)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/int-inf.c 2006-05-04 19:12:26 UTC (rev 4449)
@@ -86,7 +86,8 @@
/*
* Initialize an __mpz_struct to use the space provided by the heap.
*/
-void initIntInfRes (GC_state s, __mpz_struct *res, size_t bytes) {
+void initIntInfRes (GC_state s, __mpz_struct *res,
+ __attribute__ ((unused)) size_t bytes) {
GC_intInf bp;
assert (bytes <= (size_t)(s->limitPlusSlop - s->frontier));
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/invariant.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/invariant.c 2006-05-04 15:26:50 UTC (rev 4448)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/invariant.c 2006-05-04 19:12:26 UTC (rev 4449)
@@ -28,6 +28,7 @@
}
}
+#if ASSERT
bool invariantForGC (GC_state s) {
if (DEBUG)
fprintf (stderr, "invariantForGC\n");
@@ -91,6 +92,7 @@
fprintf (stderr, "invariantForGC passed\n");
return TRUE;
}
+#endif
bool invariantForMutatorFrontier (GC_state s) {
GC_thread thread = getThreadCurrent(s);
@@ -104,6 +106,7 @@
<= getStackLimit (s, stack) + getStackTopFrameSize (s, stack));
}
+#if ASSERT
bool invariantForMutator (GC_state s, bool frontier, bool stack) {
if (DEBUG)
displayGCState (s, stderr);
@@ -114,3 +117,4 @@
assert (invariantForGC (s));
return TRUE;
}
+#endif
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/invariant.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/invariant.h 2006-05-04 15:26:50 UTC (rev 4448)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/invariant.h 2006-05-04 19:12:26 UTC (rev 4449)
@@ -9,9 +9,13 @@
#if (defined (MLTON_GC_INTERNAL_FUNCS))
static inline void assertIsObjptrInFromSpace (GC_state s, objptr *opp);
+#if ASSERT
static bool invariantForGC (GC_state s);
+#endif
static inline bool invariantForMutatorFrontier (GC_state s);
static inline bool invariantForMutatorStack (GC_state s);
+#if ASSERT
static bool invariantForMutator (GC_state s, bool frontier, bool stack);
+#endif
#endif /* (defined (MLTON_GC_INTERNAL_FUNCS)) */
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/new-object.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/new-object.c 2006-05-04 15:26:50 UTC (rev 4448)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/new-object.c 2006-05-04 19:12:26 UTC (rev 4449)
@@ -84,7 +84,8 @@
return thread;
}
-static inline void setFrontier (GC_state s, pointer p, size_t bytes) {
+static inline void setFrontier (GC_state s, pointer p,
+ __attribute__ ((unused)) size_t bytes) {
p = alignFrontier (s, p);
assert ((size_t)(p - s->frontier) <= bytes);
GC_profileAllocInc (s, p - s->frontier);
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/object.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/object.c 2006-05-04 15:26:50 UTC (rev 4448)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/object.c 2006-05-04 19:12:26 UTC (rev 4449)
@@ -93,7 +93,7 @@
* If p points at the beginning of an object, then advanceToObjectData
* returns a pointer to the start of the object data.
*/
-pointer advanceToObjectData (GC_state s, pointer p) {
+pointer advanceToObjectData (__attribute__ ((unused)) GC_state s, pointer p) {
GC_header header;
pointer res;
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/profiling.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/profiling.c 2006-05-04 15:26:50 UTC (rev 4448)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/profiling.c 2006-05-04 19:12:26 UTC (rev 4449)
@@ -245,7 +245,7 @@
}
void GC_profileWrite (GC_state s, GC_profileData p, int fd) {
- char* kind;
+ const char* kind;
if (DEBUG_PROFILE)
fprintf (stderr, "GC_profileWrite\n");
@@ -415,6 +415,7 @@
break;
case PROFILE_NONE:
die ("impossible PROFILE_NONE");
+ break;
case PROFILE_TIME_FIELD:
case PROFILE_TIME_LABEL:
initProfilingTime (s);
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/stack.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/stack.c 2006-05-04 15:26:50 UTC (rev 4448)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/stack.c 2006-05-04 19:12:26 UTC (rev 4449)
@@ -40,7 +40,7 @@
}
/* Pointer to the bottommost word in use on the stack. */
-pointer getStackBottom (GC_state s, GC_stack stack) {
+pointer getStackBottom (__attribute__ ((unused)) GC_state s, GC_stack stack) {
pointer res;
res = ((pointer)stack) + sizeof (struct GC_stack);
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/stack.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/stack.h 2006-05-04 15:26:50 UTC (rev 4448)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/stack.h 2006-05-04 19:12:26 UTC (rev 4449)
@@ -58,7 +58,9 @@
static void displayStack (GC_state s, GC_stack stack, FILE *stream);
static inline bool isStackEmpty (GC_stack stack);
+#if ASSERT
static inline bool isStackReservedAligned (GC_state s, size_t reserved);
+#endif
static inline size_t sizeofStackSlop (GC_state s);
static inline size_t sizeofStackInitial (GC_state s);
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gen/gen-types.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gen/gen-types.c 2006-05-04 15:26:50 UTC (rev 4448)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gen/gen-types.c 2006-05-04 19:12:26 UTC (rev 4449)
@@ -8,7 +8,7 @@
#include "cenv.h"
#include "util.h"
-static char* mlTypesHPrefix[] = {
+static const char* mlTypesHPrefix[] = {
"/* Copyright (C) 2004-2006 Henry Cejtin, Matthew Fluet, Suresh",
" * Jagannathan, and Stephen Weeks.",
" *",
@@ -36,7 +36,7 @@
NULL
};
-static char* cTypesHPrefix[] = {
+static const char* cTypesHPrefix[] = {
"/* Copyright (C) 2004-2006 Henry Cejtin, Matthew Fluet, Suresh",
" * Jagannathan, and Stephen Weeks.",
" *",
@@ -50,7 +50,7 @@
NULL
};
-static char* cTypesSMLPrefix[] = {
+static const char* cTypesSMLPrefix[] = {
"(* Copyright (C) 2004-2006 Henry Cejtin, Matthew Fluet, Suresh",
" * Jagannathan, and Stephen Weeks.",
" *",
@@ -61,7 +61,7 @@
NULL
};
-static char* mlTypesHStd[] = {
+static const char* mlTypesHStd[] = {
"/* ML types */",
"typedef unsigned char* Pointer;",
// "typedef void* Pointer;",
@@ -256,23 +256,24 @@
writeNewline (cTypesSMLFd); \
} while (0)
-static char* mlTypesHSuffix[] = {
+static const char* mlTypesHSuffix[] = {
"#endif /* _MLTON_MLTYPES_H_ */",
NULL
};
-static char* cTypesHSuffix[] = {
+static const char* cTypesHSuffix[] = {
"#define C_Errno_t(t) t",
"",
"#endif /* _MLTON_CTYPES_H_ */",
NULL
};
-static char* cTypesSMLSuffix[] = {
+static const char* cTypesSMLSuffix[] = {
NULL
};
-int main (int argc, char* argv[]) {
+int main (__attribute__ ((unused)) int argc,
+ __attribute__ ((unused)) char* argv[]) {
int mlTypesHFd, cTypesHFd, cTypesSMLFd;
mlTypesHFd = open_safe ("ml-types.h", O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR);
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/platform/displayMem.linux.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/platform/displayMem.linux.c 2006-05-04 15:26:50 UTC (rev 4448)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/platform/displayMem.linux.c 2006-05-04 19:12:26 UTC (rev 4449)
@@ -1,4 +1,4 @@
-void GC_displayMem () {
+void GC_displayMem (void) {
static char buffer[256];
sprintf (buffer, "/bin/cat /proc/%d/maps\n", (int)(getpid ()));
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/platform/getText.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/platform/getText.c 2006-05-04 15:26:50 UTC (rev 4448)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/platform/getText.c 2006-05-04 19:12:26 UTC (rev 4449)
@@ -2,9 +2,9 @@
extern char _start;
extern char etext;
-void *GC_getTextStart () {
+void *GC_getTextStart (void) {
return &_start;
}
-void *GC_getTextEnd () {
+void *GC_getTextEnd (void) {
return &etext;
}
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/platform/linux.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/platform/linux.c 2006-05-04 15:26:50 UTC (rev 4448)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/platform/linux.c 2006-05-04 19:12:26 UTC (rev 4449)
@@ -20,7 +20,9 @@
* mips: ucp->m_context.sc_pc
* s390: ucp->m_context.sregs->regs.psw.addr
*/
-static void catcher (int sig, siginfo_t* sip, void* mystery) {
+static void catcher (__attribute__ ((unused)) int sig,
+ __attribute__ ((unused)) siginfo_t* sip,
+ void* mystery) {
#if (defined (__x86_64__))
#define REG_INDEX(NAME) (offsetof(struct sigcontext, NAME) / sizeof(greg_t))
#ifndef REG_RIP
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/platform/sysconf.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/platform/sysconf.c 2006-05-04 15:26:50 UTC (rev 4448)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/platform/sysconf.c 2006-05-04 19:12:26 UTC (rev 4449)
@@ -1,11 +1,11 @@
-size_t GC_pageSize () {
+size_t GC_pageSize (void) {
long int tmp;
tmp = sysconf (_SC_PAGESIZE);
return (size_t)tmp;
}
-size_t GC_totalRam () {
+size_t GC_totalRam (void) {
size_t pageSize = GC_pageSize ();
long int tmp;
@@ -13,7 +13,7 @@
return pageSize * (size_t)tmp;
}
-size_t GC_availRam () {
+size_t GC_availRam (void) {
size_t pageSize = GC_pageSize ();
long int tmp;
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/util/assert.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/util/assert.c 2006-05-04 15:26:50 UTC (rev 4448)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/util/assert.c 2006-05-04 19:12:26 UTC (rev 4449)
@@ -7,7 +7,7 @@
#include "util.h"
-void asfail(char *file, int line, char *prop) {
+void asfail(const char *file, int line, const char *prop) {
fflush(stdout);
fprintf(stderr, "%s:%d: assert(%s) failed.\n", file, line, prop);
abort();
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/util/assert.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/util/assert.h 2006-05-04 15:26:50 UTC (rev 4448)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/util/assert.h 2006-05-04 19:12:26 UTC (rev 4449)
@@ -10,7 +10,7 @@
#endif
/* Assertion failure routine */
-extern void asfail (char *file, int line, char *prop)
+extern void asfail (const char *file, int line, const char *prop)
__attribute__ ((noreturn));
/* Assertion verifier */
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/util/die.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/util/die.c 2006-05-04 15:26:50 UTC (rev 4448)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/util/die.c 2006-05-04 19:12:26 UTC (rev 4449)
@@ -7,7 +7,7 @@
#include "util.h"
-void die (char *fmt, ...) {
+void die (const char *fmt, ...) {
va_list args;
fflush(stdout);
@@ -18,7 +18,7 @@
exit(1);
}
-void diee (char * fmt, ...) {
+void diee (const char * fmt, ...) {
va_list args;
fflush(stdout);
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/util/die.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/util/die.h 2006-05-04 15:26:50 UTC (rev 4448)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/util/die.h 2006-05-04 19:12:26 UTC (rev 4449)
@@ -7,10 +7,10 @@
*/
/* issue error message and exit */
-extern void die (char *fmt, ...)
+extern void die (const char *fmt, ...)
__attribute__ ((format(printf, 1, 2)))
__attribute__ ((noreturn));
/* issue error message and exit. Also print strerror(errno). */
-extern void diee (char *fmt, ...)
+extern void diee (const char *fmt, ...)
__attribute__ ((format(printf, 1, 2)))
__attribute__ ((noreturn));
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/util/read_write.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/util/read_write.h 2006-05-04 15:26:50 UTC (rev 4448)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/util/read_write.h 2006-05-04 19:12:26 UTC (rev 4449)
@@ -46,7 +46,7 @@
write_safe (fd, &u, sizeof(uintptr_t));
}
-static inline void writeString (int fd, char* s) {
+static inline void writeString (int fd, const char* s) {
write_safe (fd, s, strlen(s));
}
@@ -89,7 +89,7 @@
writeString (fd, "\n");
}
-static inline void writeStringWithNewline (int fd, char* s) {
+static inline void writeStringWithNewline (int fd, const char* s) {
writeString (fd, s);
writeNewline (fd);
}
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/util/to-string.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/util/to-string.c 2006-05-04 15:26:50 UTC (rev 4448)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/util/to-string.c 2006-05-04 19:12:26 UTC (rev 4449)
@@ -101,7 +101,7 @@
}
char* sizeToBytesApproxString (size_t amount) {
- static char* suffixs[] = {"", "K", "M", "G"};
+ static const char* suffixs[] = {"", "K", "M", "G"};
static char buf1[BUF_SIZE];
static char buf2[BUF_SIZE];
static char buf3[BUF_SIZE];