Improved support for pelles c:

* Refactor nmake files so that a compiler-specific makefile is included; move Microsoft Visual C-specific options to mv.nmk.
* Add nmake files for Pelles (w3i3pc.nmk and pc.nmk).
* Rename spw3i3mv.c to spw3i3.c and spw3i6mv.c to spw3i6.c since these are also used by Pelles C.
* Make reasonable changes to the source code to avoid warnings from Pelles C:
** check results of function calls;
** avoid useless return values;
** undef max before defining it;
** ensure printf formats are checkable;
** move notreached() assertions to the end of blocks;
** suppress warnings in cases where the code shouldn't be changed ("Unreachable code", "Inline assembly code is not portable", "Structured Exception Handling is not portable").

Copied from Perforce
 Change: 184977
 ServerID: perforce.ravenbrook.com
This commit is contained in:
Gareth Rees 2014-03-24 18:23:29 +00:00
parent a3575822cc
commit c94be13bdf
56 changed files with 536 additions and 228 deletions

View file

@ -107,7 +107,7 @@ Bool ABQPush(ABQ abq, void *element)
if (ABQIsFull(abq))
return FALSE;
mps_lib_memcpy(ABQElement(abq, abq->in), element, abq->elementSize);
(void)mps_lib_memcpy(ABQElement(abq, abq->in), element, abq->elementSize);
abq->in = ABQNextIndex(abq, abq->in);
AVERT(ABQ, abq);
@ -126,7 +126,7 @@ Bool ABQPop(ABQ abq, void *elementReturn)
if (ABQIsEmpty(abq))
return FALSE;
mps_lib_memcpy(elementReturn, ABQElement(abq, abq->out), abq->elementSize);
(void)mps_lib_memcpy(elementReturn, ABQElement(abq, abq->out), abq->elementSize);
abq->out = ABQNextIndex(abq, abq->out);
@ -146,7 +146,7 @@ Bool ABQPeek(ABQ abq, void *elementReturn)
if (ABQIsEmpty(abq))
return FALSE;
mps_lib_memcpy(elementReturn, ABQElement(abq, abq->out), abq->elementSize);
(void)mps_lib_memcpy(elementReturn, ABQElement(abq, abq->out), abq->elementSize);
/* Identical to pop, but don't increment out */
@ -261,7 +261,7 @@ void ABQIterate(ABQ abq, ABQIterateMethod iterate, void *closureP, Size closureS
AVERT(Bool, delete);
if (!delete) {
if (copy != index)
mps_lib_memcpy(ABQElement(abq, copy), element, abq->elementSize);
(void)mps_lib_memcpy(ABQElement(abq, copy), element, abq->elementSize);
copy = ABQNextIndex(abq, copy);
}
index = ABQNextIndex(abq, index);
@ -272,8 +272,8 @@ void ABQIterate(ABQ abq, ABQIterateMethod iterate, void *closureP, Size closureS
/* If any elements were deleted, need to copy remainder of queue. */
if (copy != index) {
while (index != in) {
mps_lib_memcpy(ABQElement(abq, copy), ABQElement(abq, index),
abq->elementSize);
(void)mps_lib_memcpy(ABQElement(abq, copy), ABQElement(abq, index),
abq->elementSize);
copy = ABQNextIndex(abq, copy);
index = ABQNextIndex(abq, index);
}

View file

@ -130,7 +130,7 @@ static void step(void)
DestroyTestBlock(a);
break;
default:
if (!deleted & (pushee > popee)) {
if (!deleted && (pushee > popee)) {
TestBlock b;
TestClosureStruct cl;
deleted = (unsigned)abqRnd (pushee - popee) + popee;

View file

@ -285,7 +285,7 @@ static void test(mps_arena_t arena)
if (objs % 1024 == 0) {
report(arena);
putchar('.');
fflush(stdout);
(void)fflush(stdout);
}
++objs;

View file

@ -236,7 +236,7 @@ static void *test(void *arg, size_t s)
if (objs % 1024 == 0) {
report(arena);
putchar('.');
fflush(stdout);
(void)fflush(stdout);
}
++objs;

View file

@ -152,7 +152,7 @@ static void *test(void *arg, size_t haveAmbigous)
lastStep = totalSize;
printf("\nSize %"PRIuLONGEST" bytes, %lu objects.\n",
(ulongest_t)totalSize, objs);
fflush(stdout);
(void)fflush(stdout);
for(i = 0; i < exactRootsCOUNT; ++i)
cdie(exactRoots[i] == objNULL || dylan_check(exactRoots[i]),
"all roots check");
@ -184,7 +184,7 @@ static void *test(void *arg, size_t haveAmbigous)
if (objs % 256 == 0) {
printf(".");
report();
fflush(stdout);
(void)fflush(stdout);
}
}

View file

@ -111,7 +111,7 @@ static void *test(void *arg, size_t s)
lastStep = totalSize;
printf("\nSize %"PRIuLONGEST" bytes, %lu objects.\n",
(ulongest_t)totalSize, objs);
fflush(stdout);
(void)fflush(stdout);
for(i = 0; i < exactRootsCOUNT; ++i)
cdie(exactRoots[i] == objNULL || dylan_check(exactRoots[i]),
"all roots check");
@ -139,7 +139,7 @@ static void *test(void *arg, size_t s)
++objs;
if (objs % 256 == 0) {
printf(".");
fflush(stdout);
(void)fflush(stdout);
}
}

View file

@ -111,11 +111,6 @@ static mps_res_t stress(mps_class_t class, size_t (*size)(unsigned long i),
}
#define max(a, b) (((a) > (b)) ? (a) : (b))
#define alignUp(w, a) (((w) + (a) - 1) & ~((size_t)(a) - 1))
/* randomSizeAligned -- produce sizes both large and small,
* aligned by platform alignment */

View file

@ -155,7 +155,7 @@ Bool ArenaCheck(Arena arena)
CHECKL(BoolCheck(arena->hasFreeCBS));
if (arena->hasFreeCBS)
CBSCheck(ArenaFreeCBS(arena));
CHECKL(CBSCheck(ArenaFreeCBS(arena)));
return TRUE;
}

View file

@ -530,7 +530,7 @@ static Res VMArenaInit(Arena *arenaReturn, ArenaClass class, ArgList args)
/* Copy the stack-allocated VM parameters into their home in the VMArena. */
AVER(sizeof(vmArena->vmParams) == sizeof(vmParams));
mps_lib_memcpy(vmArena->vmParams, vmParams, sizeof(vmArena->vmParams));
(void)mps_lib_memcpy(vmArena->vmParams, vmParams, sizeof(vmArena->vmParams));
/* <design/arena/#coop-vm.struct.vmarena.extendby.init> */
vmArena->extendBy = userSize;

View file

@ -216,7 +216,7 @@ static void test(mps_arena_t arena,
}
}
mps_arena_collect(arena);
die(mps_arena_collect(arena), "mps_arena_collect");
mps_arena_release(arena);
for(i = 0; i < TABLE_SLOTS; ++i) {

View file

@ -221,7 +221,7 @@ static void test(mps_arena_t arena,
}
}
mps_arena_collect(arena);
die(mps_arena_collect(arena), "mps_arena_collect");
mps_arena_release(arena);
for(i = 0; i < TABLE_SLOTS; ++i) {
@ -274,8 +274,8 @@ static void *setup(void *v, size_t s)
die(mps_root_create_reg(&stack, arena, mps_rank_ambig(), 0, thr,
mps_stack_scan_ambig, v, 0),
"Root Create\n");
EnsureHeaderFormat(&dylanfmt, arena);
EnsureHeaderWeakFormat(&dylanweakfmt, arena);
die(EnsureHeaderFormat(&dylanfmt, arena), "EnsureHeaderFormat");
die(EnsureHeaderWeakFormat(&dylanweakfmt, arena), "EnsureHeaderWeakFormat");
MPS_ARGS_BEGIN(args) {
/* Ask the leafpool to allocate in the nursery, as we're using it to test
weaknesss and want things to die in it promptly. */

View file

@ -125,7 +125,7 @@ static void get(void)
{
if (argInRange(0)) {
Bool b = (BTGet)(bt, args[0]);
printf(b ? "TRUE\n" : "FALSE\n");
puts(b ? "TRUE" : "FALSE");
}
}
@ -148,7 +148,7 @@ static void isSetRange(void)
{
if (checkDefaultRange(0)) {
Bool b = BTIsSetRange(bt, args[0], args[1]);
printf(b ? "TRUE\n" : "FALSE\n");
puts(b ? "TRUE" : "FALSE");
}
}
@ -157,7 +157,7 @@ static void isResRange(void)
{
if (checkDefaultRange(0)) {
Bool b = BTIsResRange(bt, args[0], args[1]);
printf(b ? "TRUE\n" : "FALSE\n");
puts(b ? "TRUE" : "FALSE");
}
}
@ -325,7 +325,7 @@ static void showBT(void) {
i = 0;
while((i < btSize) && (i < 50)) {
if (i % 10 == 0)
c = (char)((i / 10) % 10) + '0';
c = (char)(((i / 10) % 10) + '0');
else
c = ' ';
putchar(c);
@ -334,7 +334,7 @@ static void showBT(void) {
putchar('\n');
i = 0;
while((i < btSize) && (i < 50)) {
c = (char)(i % 10) +'0';
c = (char)((i % 10) +'0');
putchar(c);
++ i;
}
@ -374,7 +374,7 @@ extern int main(int argc, char *argv[])
while(1) {
char input[100];
printf("bt test> ");
fflush(stdout);
(void)fflush(stdout);
if (fgets(input, 100, stdin)) {
obeyCommand(input);
showBT();

View file

@ -96,8 +96,8 @@ $(PFM)\cool\mps.lib: \
$(MPMOBJ) $(AMCOBJ) $(AMSOBJ) $(AWLOBJ) $(LOOBJ) $(SNCOBJ) \
$(MVFFOBJ) $(PLINTHOBJ) $(POOLNOBJ)
$(ECHO) $@
cl /c $(CFLAGS) /Fd$(PFM)\$(VARIETY)\ /Fo$(PFM)\$(VARIETY)\version.o version.c
$(LIBMAN) $(LIBFLAGS) /OUT:$@ $** $(PFM)\$(VARIETY)\version.o
$(CC) /c $(CFLAGS) /Fo$(PFM)\$(VARIETY)\version.obj version.c
$(LIBMAN) $(LIBFLAGS) /OUT:$@ $** $(PFM)\$(VARIETY)\version.obj
# OTHER GENUINE TARGETS
@ -267,13 +267,13 @@ $(PFM)\$(VARIETY)\mpseventsql.obj: $(PFM)\$(VARIETY)\eventsql.obj
$(ECHO) $@
@if not exist $(PFM) mkdir $(PFM)
@if not exist $(PFM)\$(VARIETY) mkdir $(PFM)\$(VARIETY)
cl /c $(CFLAGS) /Fd$(PFM)\$(VARIETY)\ /Fo$@ $<
$(CC) /c $(CFLAGS) /Fo$@ $<
$(PFM)\$(VARIETY)\sqlite3.obj:
$(ECHO) $@
@if not exist $(PFM) mkdir $(PFM)
@if not exist $(PFM)\$(VARIETY) mkdir $(PFM)\$(VARIETY)
cl /c $(CFLAGSSQL) /Fd$(PFM)\$(VARIETY)\ /Fo$@ sqlite3.c
$(CC) /c $(CFLAGSSQL) /Fo$@ sqlite3.c
{}.asm{$(PFM)\$(VARIETY)}.obj:
$(ECHO) $@
@ -295,7 +295,7 @@ $(PFM)\$(VARIETY)\sqlite3.obj:
{$(PFM)\$(VARIETY)}.obj{$(PFM)\$(VARIETY)}.exe:
$(ECHO) $@
$(LINKER) $(LINKFLAGS) /PDB:$*.pdb /OUT:$@ $(**)
$(LINKER) $(LINKFLAGS) /OUT:$@ $(**)
# C. COPYRIGHT AND LICENSE

View file

@ -219,20 +219,15 @@ ECHO = echo
# C FLAGS
# /MD means compile for multi-threaded environment with separate C library DLL.
# /MT means compile for multi-threaded environment.
# /ML means compile for single-threaded environment.
# A 'd' at the end means compile for debugging.
CFLAGSTARGETPRE =
CFLAGSTARGETPOST =
CRTFLAGSHOT = /MT
CRTFLAGSCOOL = /MTd
LINKFLAGSHOT = libcmt.lib
LINKFLAGSCOOL = libcmtd.lib
CRTFLAGSHOT =
CRTFLAGSCOOL =
LINKFLAGSHOT =
LINKFLAGSCOOL =
CFLAGSSQLPRE = /nologo $(PFMDEFS)
CFLAGSCOMMONPRE = /nologo /W4 /WX $(PFMDEFS) $(CFLAGSTARGETPRE)
CFLAGSCOMMONPRE = /nologo $(PFMDEFS) $(CFLAGSTARGETPRE)
CFLAGSSQLPOST =
CFLAGSCOMMONPOST = $(CFLAGSTARGETPOST)
@ -247,7 +242,7 @@ CFLAGSHOT = /O2 /DNDEBUG
# building a DLL, mpsdy.dll, the linker step will fail (error LNK2001:
# unresolved external symbol __chkesp). See
# http://support.microsoft.com/kb/q191669/
CFLAGSCOOL = /Od
CFLAGSCOOL =
CFLAGSINTERNAL = /Zi
CFLAGSEXTERNAL =
@ -280,7 +275,7 @@ LFCOOL = $(LINKFLAGSCOOL) $(LINKFLAGSINTERNAL)
# %%VARIETY: When adding a new variety, define a macro containing the flags
# for the new variety
LIBMAN = lib # can't call this LIB - it screws the environment
LIBFLAGSCOMMON = /nologo
LIBFLAGSCOMMON =
LIBFLAGSRASH =
LIBFLAGSHOT =

View file

@ -172,7 +172,7 @@
/* "constant conditional" (MPS_END) */
#pragma warning(disable: 4127)
/* "unreachable code" (ASSERT, if cond is constantly true). */
/* "unreachable code" (AVER, if cond is constantly true). */
#pragma warning(disable: 4702)
/* "expression evaluates to a function which is missing an argument list" */
@ -211,6 +211,17 @@
#endif /* MPS_BUILD_MV */
/* Suppress Pelles C warnings at warning level 2 */
/* Essentially the same settings are done in testlib.h. */
#ifdef MPS_BUILD_PC
/* "Unreachable code" (AVER, if condition is constantly true). */
#pragma warn(disable: 2154)
#endif /* MPS_BUILD_PC */
/* EPVMDefaultSubsequentSegSIZE is a default for the alignment of
* subsequent segments (non-initial at each save level) in EPVM. See
* design.mps.poolepvm.arch.segment.size.

View file

@ -419,7 +419,7 @@ void EventDump(mps_lib_FILE *stream)
/* This can happen if there's a backtrace very early in the life of
the MPS, and will cause an access violation if we continue. */
if (!eventInited) {
WriteF(stream, "No events\n", NULL);
(void)WriteF(stream, "No events\n", NULL);
return;
}

View file

@ -87,7 +87,7 @@ extern Word EventKindControl;
size = offsetof(Event##name##Struct, f1) + _string_len + sizeof('\0'); \
EVENT_BEGIN(name, size) \
_event->f0 = (p0); \
mps_lib_memcpy(_event->f1, (string), _string_len); \
(void)mps_lib_memcpy(_event->f1, (string), _string_len); \
_event->f1[_string_len] = '\0'; \
EVENT_END(name, size); \
END

View file

@ -64,12 +64,12 @@ static const char *prog; /* program name */
static void fevwarn(const char *prefix, const char *format, va_list args)
{
fflush(stdout); /* sync */
fprintf(stderr, "%s: %s @", prog, prefix);
EVENT_CLOCK_PRINT(stderr, eventTime);
fprintf(stderr, " ");
vfprintf(stderr, format, args);
fprintf(stderr, "\n");
(void)fflush(stdout); /* sync */
(void)fprintf(stderr, "%s: %s @", prog, prefix);
(void)EVENT_CLOCK_PRINT(stderr, eventTime);
(void)fprintf(stderr, " ");
(void)vfprintf(stderr, format, args);
(void)fprintf(stderr, "\n");
}
/* evwarn -- flush stdout, warn to stderr */
@ -100,10 +100,9 @@ static void everror(const char *format, ...)
static void usage(void)
{
fprintf(stderr,
"Usage: %s [-f logfile] [-h]\n"
"See \"Telemetry\" in the reference manual for instructions.\n",
prog);
(void)fprintf(stderr, "Usage: %s [-f logfile] [-h]\n"
"See \"Telemetry\" in the reference manual for instructions.\n",
prog);
}
@ -270,7 +269,7 @@ static void readLog(FILE *stream)
break;
}
EVENT_CLOCK_PRINT(stdout, eventTime);
(void)EVENT_CLOCK_PRINT(stdout, eventTime);
printf(" %4X", (unsigned)code);
switch (code) {
@ -286,7 +285,7 @@ static void readLog(FILE *stream)
}
putchar('\n');
fflush(stdout);
(void)fflush(stdout);
} /* while(!feof(input)) */
}

View file

@ -54,26 +54,24 @@ static void everror(const char *format, ...)
{
va_list args;
fflush(stdout); /* sync */
fprintf(stderr, "%s: ", prog);
(void)fflush(stdout); /* sync */
(void)fprintf(stderr, "%s: ", prog);
va_start(args, format);
vfprintf(stderr, format, args);
fprintf(stderr, "\n");
(void)vfprintf(stderr, format, args);
(void)fprintf(stderr, "\n");
va_end(args);
exit(EXIT_FAILURE);
}
static void usage(void)
{
fprintf(stderr,
"Usage: %s [-l <logfile>]\n",
prog);
(void)fprintf(stderr, "Usage: %s [-l <logfile>]\n", prog);
}
static void usageError(void)
{
usage();
everror("Bad usage");
usage();
everror("Bad usage");
}
/* parseArgs -- parse command line arguments */
@ -289,7 +287,7 @@ static void recordLabel(char *p)
address = parseHex(&p);
if (address > (Word)-1) {
printf("label address too large!");
(void)printf("label address too large!");
return;
}
@ -440,24 +438,27 @@ static void readLog(FILE *input)
if ((major != EVENT_VERSION_MAJOR) ||
(median != EVENT_VERSION_MEDIAN) ||
(minor != EVENT_VERSION_MINOR)) {
fprintf(stderr, "Event log version does not match: %d.%d.%d vs %d.%d.%d\n",
(int)major, (int)median, (int)minor,
EVENT_VERSION_MAJOR,
EVENT_VERSION_MEDIAN,
EVENT_VERSION_MINOR);
(void)fprintf(stderr, "Event log version does not match: "
"%d.%d.%d vs %d.%d.%d\n",
(int)major, (int)median, (int)minor,
EVENT_VERSION_MAJOR,
EVENT_VERSION_MEDIAN,
EVENT_VERSION_MINOR);
}
if (maxCode > EventCodeMAX) {
fprintf(stderr, "Event log may contain unknown events with codes from %d to %d\n",
EventCodeMAX+1, (int)maxCode);
(void)fprintf(stderr, "Event log may contain unknown events "
"with codes from %d to %d\n",
EventCodeMAX+1, (int)maxCode);
}
if (wordWidth > MPS_WORD_WIDTH) {
int newHexWordWidth = (int)((wordWidth + 3) / 4);
if (newHexWordWidth > hexWordWidth) {
fprintf(stderr,
"Event log word width is greater than on current platform;"
"previous values may be printed too narrowly.\n");
(void)fprintf(stderr,
"Event log word width is greater than on current "
"platform; previous values may be printed too "
"narrowly.\n");
}
hexWordWidth = newHexWordWidth;
}

View file

@ -231,7 +231,7 @@ static void *test(void *arg, size_t s)
if (objs % 1024 == 0) {
report(arena);
putchar('.');
fflush(stdout);
(void)fflush(stdout);
}
++objs;

View file

@ -86,7 +86,7 @@ static void register_numbered_tree(mps_word_t tree, mps_arena_t arena)
{
/* don't finalize ints */
if ((tree & 1) == 0) {
mps_finalize(arena, (mps_addr_t *)&tree);
die(mps_finalize(arena, (mps_addr_t *)&tree), "mps_finalize");
register_numbered_tree(DYLAN_VECTOR_SLOT(tree, 0), arena);
register_numbered_tree(DYLAN_VECTOR_SLOT(tree, 1), arena);
}
@ -125,7 +125,7 @@ static void register_indirect_tree(mps_word_t tree, mps_arena_t arena)
/* don't finalize ints */
if ((tree & 1) == 0) {
mps_word_t indirect = DYLAN_VECTOR_SLOT(tree,2);
mps_finalize(arena, (mps_addr_t *)&indirect);
die(mps_finalize(arena, (mps_addr_t *)&indirect), "mps_finalize");
register_indirect_tree(DYLAN_VECTOR_SLOT(tree, 0), arena);
register_indirect_tree(DYLAN_VECTOR_SLOT(tree, 1), arena);
}
@ -186,7 +186,7 @@ static void *test(void *arg, size_t s)
(mps_collections(arena) < collectionCOUNT)) {
mps_word_t final_this_time = 0;
printf("Collecting...");
fflush(stdout);
(void)fflush(stdout);
die(mps_arena_collect(arena), "collect");
printf(" Done.\n");
while (mps_message_poll(arena)) {
@ -227,7 +227,7 @@ static void *test(void *arg, size_t s)
(mps_collections(arena) < collectionCOUNT)) {
mps_word_t final_this_time = 0;
printf("Collecting...");
fflush(stdout);
(void)fflush(stdout);
die(mps_arena_collect(arena), "collect");
printf(" Done.\n");
while (mps_message_poll(arena)) {

View file

@ -83,13 +83,13 @@ static Index (indexOfAddr)(FBMState state, Addr a)
static void describe(FBMState state) {
switch (state->type) {
case FBMTypeCBS:
CBSDescribe(state->the.cbs, mps_lib_get_stdout());
die(CBSDescribe(state->the.cbs, mps_lib_get_stdout()), "CBSDescribe");
break;
case FBMTypeFreelist:
FreelistDescribe(state->the.fl, mps_lib_get_stdout());
die(FreelistDescribe(state->the.fl, mps_lib_get_stdout()), "FreelistDescribe");
break;
default:
fail();
cdie(0, "invalid state->type");
break;
}
}
@ -157,7 +157,7 @@ static void check(FBMState state)
FreelistIterate(state->the.fl, checkFLCallback, (void *)&closure, 0);
break;
default:
fail();
cdie(0, "invalid state->type");
return;
}
@ -311,7 +311,7 @@ static void allocate(FBMState state, Addr base, Addr limit)
res = FreelistDelete(&oldRange, state->the.fl, &range);
break;
default:
fail();
cdie(0, "invalid state->type");
return;
}
@ -387,7 +387,7 @@ static void deallocate(FBMState state, Addr base, Addr limit)
res = FreelistInsert(&freeRange, state->the.fl, &range);
break;
default:
fail();
cdie(0, "invalid state->type");
return;
}
@ -467,7 +467,7 @@ static void find(FBMState state, Size size, Bool high, FindDelete findDelete)
(&foundRange, &oldRange, state->the.fl, size * state->align, findDelete);
break;
default:
fail();
cdie(0, "invalid state->type");
return;
}
@ -538,7 +538,7 @@ static void test(FBMState state, unsigned n) {
find(state, size, high, findDelete);
break;
default:
fail();
cdie(0, "invalid state->type");
return;
}
if ((i + 1) % 1000 == 0)

View file

@ -77,7 +77,7 @@ static void register_numbered_tree(mps_word_t tree, mps_arena_t arena)
/* don't finalize ints */
if ((tree & 1) == 0) {
mps_addr_t tree_ref = (mps_addr_t)tree;
mps_finalize(arena, &tree_ref);
die(mps_finalize(arena, &tree_ref), "mps_finalize");
register_numbered_tree(DYLAN_VECTOR_SLOT(tree, 0), arena);
register_numbered_tree(DYLAN_VECTOR_SLOT(tree, 1), arena);
}
@ -117,7 +117,7 @@ static void register_indirect_tree(mps_word_t tree, mps_arena_t arena)
if ((tree & 1) == 0) {
mps_word_t indirect = DYLAN_VECTOR_SLOT(tree,2);
mps_addr_t indirect_ref = (mps_addr_t)indirect;
mps_finalize(arena, &indirect_ref);
die(mps_finalize(arena, &indirect_ref), "mps_finalize");
register_indirect_tree(DYLAN_VECTOR_SLOT(tree, 0), arena);
register_indirect_tree(DYLAN_VECTOR_SLOT(tree, 1), arena);
}
@ -175,7 +175,7 @@ static void *test(void *arg, size_t s)
(mps_collections(arena) < collectionCOUNT)) {
mps_word_t final_this_time = 0;
printf("Collecting...");
fflush(stdout);
(void)fflush(stdout);
die(mps_arena_collect(arena), "collect");
printf(" Done.\n");
while (mps_message_poll(arena)) {
@ -213,7 +213,7 @@ static void *test(void *arg, size_t s)
(mps_collections(arena) < collectionCOUNT)) {
mps_word_t final_this_time = 0;
printf("Collecting...");
fflush(stdout);
(void)fflush(stdout);
die(mps_arena_collect(arena), "collect");
printf(" Done.\n");
while (mps_message_poll(arena)) {

View file

@ -470,8 +470,8 @@ extern mps_res_t dylan_scan1(mps_ss_t mps_ss, mps_addr_t *object_io)
break;
case 1: /* stretchy non-traceable */
notreached(); /* Not used by DylanWorks yet */
p += vt + 1;
notreached(); /* Not used by DylanWorks yet */
break;
case 2: /* non-stretchy traceable */
@ -482,7 +482,6 @@ extern mps_res_t dylan_scan1(mps_ss_t mps_ss, mps_addr_t *object_io)
break;
case 3: /* stretchy traceable */
notreached(); /* DW doesn't create them yet */
vl = *(mps_word_t *)p; /* vector length */
assert((vl & 3) == 1); /* check Dylan integer tag */
vl >>= 2; /* untag it */
@ -490,6 +489,7 @@ extern mps_res_t dylan_scan1(mps_ss_t mps_ss, mps_addr_t *object_io)
res = dylan_scan_contig(mps_ss, p, p + vl);
if(res) return res;
p += vt; /* skip to end of whole vector */
notreached(); /* DW doesn't create them yet */
break;
case 4: /* non-word */
@ -500,11 +500,11 @@ extern mps_res_t dylan_scan1(mps_ss_t mps_ss, mps_addr_t *object_io)
break;
case 5: /* stretchy non-word */
notreached(); /* DW doesn't create them yet */
es = (vh & 0xff) >> 3;
vb = (vh >> 16) & 0xff;
vt += vb;
p += NONWORD_LENGTH(vt, es) + 1;
notreached(); /* DW doesn't create them yet */
break;
default:

View file

@ -149,11 +149,6 @@ static mps_res_t stress(size_t (*size)(unsigned long, mps_align_t),
}
#define max(a, b) (((a) > (b)) ? (a) : (b))
#define alignUp(w, a) (((w) + (a) - 1) & ~((size_t)(a) - 1))
/* randomSizeAligned -- produce sizes both large and small,
* aligned by platform alignment */

View file

@ -131,8 +131,7 @@ static void allocMultiple(PoolStat stat)
static void reportResults(PoolStat stat, const char *name)
{
printf("\nResults for ");
fputs(name, stdout);
printf("\nResults for %s\n", name);
printf("\n");
printf(" Allocated %"PRIuLONGEST" objects\n", (ulongest_t)stat->aCount);
printf(" Freed %"PRIuLONGEST" objects\n", (ulongest_t)stat->fCount);

View file

@ -84,8 +84,10 @@ int main(int argc, char *argv[])
for(i = 0; i < nTHREADS; i++)
t[i] = CreateThread(NULL, 0, thread0, NULL, 0, &id);
for(i = 0; i < nTHREADS; i++)
WaitForSingleObject(t[i], INFINITE);
for(i = 0; i < nTHREADS; i++) {
cdie(WaitForSingleObject(t[i], INFINITE) == WAIT_OBJECT_0,
"WaitForSingleObject");
}
Insist(shared == nTHREADS*COUNT);

View file

@ -43,7 +43,7 @@ SegPref SegPrefDefault(void)
void SegPrefInit(SegPref pref)
{
mps_lib_memcpy(pref, &segPrefDefault, sizeof(SegPrefStruct));
(void)mps_lib_memcpy(pref, &segPrefDefault, sizeof(SegPrefStruct));
}

View file

@ -92,11 +92,6 @@ static mps_res_t stress(mps_class_t class, size_t (*size)(int i),
}
#define max(a, b) (((a) > (b)) ? (a) : (b))
#define alignUp(w, a) (((w) + (a) - 1) & ~((size_t)(a) - 1))
/* randomSize -- produce sizes both latge and small */
static size_t randomSize(int i)
@ -153,7 +148,7 @@ static mps_pool_debug_option_s fenceOptions = {
/* testInArena -- test all the pool classes in the given arena */
static int testInArena(mps_arena_t arena, mps_pool_debug_option_s *options)
static void testInArena(mps_arena_t arena, mps_pool_debug_option_s *options)
{
/* IWBN to test MVFFDebug, but the MPS doesn't support debugging */
/* cross-segment allocation (possibly MVFF ought not to). */
@ -176,8 +171,6 @@ static int testInArena(mps_arena_t arena, mps_pool_debug_option_s *options)
die(stress(mps_class_mv(), randomSize, arena,
(size_t)65536, (size_t)32, (size_t)65536),
"stress MV");
return 0;
}

View file

@ -194,8 +194,8 @@
#include "protw3.c" /* Windows protection */
#include "proti3.c" /* 32-bit Intel mutator context decoding */
#include "prmci3w3.c" /* Windows on 32-bit Intel mutator context */
#include "ssw3i3mv.c" /* Windows on 32-bit stack scan for Microsoft C */
#include "spw3i3mv.c" /* Windows on 32-bit stack probe for Microsoft C */
#include "ssw3i3mv.c" /* Windows on 32-bit Intel stack scan for Microsoft C */
#include "spw3i3.c" /* Windows on 32-bit Intel stack probe */
#include "mpsiw3.c" /* Windows interface layer extras */
/* Windows on 64-bit Intel with Microsoft Visual Studio */
@ -210,8 +210,8 @@
#include "protw3.c" /* Windows protection */
#include "proti6.c" /* 64-bit Intel mutator context decoding */
#include "prmci6w3.c" /* Windows on 64-bit Intel mutator context */
#include "ssw3i6mv.c" /* Windows on 64-bit stack scan for Microsoft C */
#include "spw3i6mv.c" /* Windows on 64-bit stack probe for Microsoft C */
#include "ssw3i6mv.c" /* Windows on 64-bit Intel stack scan for Microsoft C */
#include "spw3i6.c" /* Windows on 64-bit Intel stack probe */
#include "mpsiw3.c" /* Windows interface layer extras */
/* Windows on 32-bit Intel with Pelles C */
@ -226,7 +226,7 @@
#include "proti3.c" /* 32-bit Intel mutator context decoding */
#include "prmci3w3.c" /* Windows on 32-bit Intel mutator context */
#include "ssw3i3pc.c" /* Windows on 32-bit stack scan for Pelles C */
#include "spw3i3mv.c" /* Intel stack probe */
#include "spw3i3.c" /* 32-bit Intel stack probe */
#include "mpsiw3.c" /* Windows interface layer extras */
#else

View file

@ -1737,12 +1737,12 @@ mps_word_t mps_telemetry_control(mps_word_t resetMask, mps_word_t flipMask)
void mps_telemetry_set(mps_word_t setMask)
{
EventControl((Word)setMask, (Word)setMask);
(void)EventControl((Word)setMask, (Word)setMask);
}
void mps_telemetry_reset(mps_word_t resetMask)
{
EventControl((Word)resetMask, 0);
(void)EventControl((Word)resetMask, 0);
}
mps_word_t mps_telemetry_get(void)

View file

@ -94,8 +94,6 @@ struct tlonglong {
/* alignmentTest -- test default alignment is acceptable */
#define max(a, b) (((a) > (b)) ? (a) : (b))
static void alignmentTest(mps_arena_t arena)
{
mps_pool_t pool;
@ -404,7 +402,7 @@ static void *test(void *arg, size_t s)
if (rnd() & 1) {
printf("Using auto_header format.\n");
EnsureHeaderFormat(&format, arena);
die(EnsureHeaderFormat(&format, arena), "EnsureHeaderFormat");
ap_headerSIZE = headerSIZE; /* from fmthe.h */
} else {
printf("Using normal format (no implicit object header: client pointers point at start of storage).\n");

View file

@ -65,9 +65,9 @@ static void mps_lib_assert_fail_default(const char *file,
unsigned line,
const char *condition)
{
fflush(stdout); /* synchronize */
fprintf(stderr, "%s:%u: MPS ASSERTION FAILED: %s\n", file, line, condition);
fflush(stderr); /* make sure the message is output */
(void)fflush(stdout); /* synchronize */
(void)fprintf(stderr, "%s:%u: MPS ASSERTION FAILED: %s\n", file, line, condition);
(void)fflush(stderr); /* make sure the message is output */
ASSERT_ABORT(); /* see config.h */
}

74
mps/code/mv.nmk Normal file
View file

@ -0,0 +1,74 @@
# -*- makefile -*-
#
# mv.nmk: NMAKE FRAGMENT FOR MICROSOFT VISUAL C/C++
#
# $Id: //info.ravenbrook.com/project/mps/branch/2014-03-21/pellesc/code/gc.gmk#1 $
# Copyright (c) 2014 Ravenbrook Limited. See end of file for license.
#
# This file is included by platform nmake files that use the Microsoft
# Visual C/C+ compiler. It defines the compiler-specific variables
# that the common nmake file fragment (<code/commpost.nmk>) requires.
CC = cl
LIBMAN = lib
LINKER = link
# /Gs appears to be necessary to suppress stack checks. Stack checks
# (if not suppressed) generate a dependency on the C library, __chkesp,
# which causes the linker step to fail when building the DLL, mpsdy.dll.
CFLAGSCOMMONPRE = $(CFLAGSCOMMONPRE) /W4 /WX /Gs /Fd$(PFM)\$(VARIETY)
LIBFLAGSCOMMON = $(LIBFLAGSCOMMON) /nologo
# /MD means compile for multi-threaded environment with separate C library DLL.
# /MT means compile for multi-threaded environment.
# /ML means compile for single-threaded environment.
# A 'd' at the end means compile for debugging.
CRTFLAGSHOT = $(CRTFLAGSHOT) /MT
CRTFLAGSCOOL = $(CRTFLAGSCOOL) /MTd
CFLAGSCOOL = $(CFLAGSCOOL) /Od
LINKFLAGSCOMMON = $(LINKFLAGSCOMMON) /PDB:$*.pdb
LINKFLAGSHOT = $(LINKFLAGSHOT) libcmt.lib
LINKFLAGSCOOL = $(LINKFLAGSCOOL) libcmtd.lib
# C. COPYRIGHT AND LICENSE
#
# Copyright (C) 2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
# All rights reserved. This is an open source license. Contact
# Ravenbrook for commercial licensing options.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# 3. Redistributions in any form must be accompanied by information on how
# to obtain complete source code for this software and any accompanying
# software that uses this software. The source code must either be
# included in the distribution or be available for no more than the cost
# of distribution plus a nominal fee, and must be freely redistributable
# under reasonable conditions. For an executable file, complete source
# code means the source code for all modules it contains. It does not
# include source code for modules or files that typically accompany the
# major components of the operating system on which the executable file
# runs.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
# PURPOSE, OR NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View file

@ -38,11 +38,9 @@ static double expdev(void)
}
#define max(a, b) (((a) > (b)) ? (a) : (b))
static size_t min;
static size_t mean;
static size_t max;
static size_t size_min;
static size_t size_mean;
static size_t size_max;
static int verbose = 0;
static mps_pool_t pool;
@ -50,8 +48,8 @@ static size_t randomSize(unsigned long i)
{
/* Distribution centered on mean. Verify that allocations
below min and above max are handled correctly */
size_t s = (max - mean)/4;
size_t m = mean;
size_t s = (size_max - size_mean)/4;
size_t m = size_mean;
double r;
double x;
@ -73,8 +71,6 @@ static size_t randomSize(unsigned long i)
#define TEST_SET_SIZE 1234
#define TEST_LOOPS 27
#define alignUp(w, a) (((w) + (a) - 1) & ~((size_t)(a) - 1))
static mps_res_t make(mps_addr_t *p, mps_ap_t ap, size_t size)
{
mps_res_t res;
@ -182,14 +178,14 @@ static void stress_with_arena_class(mps_arena_class_t aclass, Bool zoned)
"mps_arena_create");
} MPS_ARGS_END(args);
min = MPS_PF_ALIGN;
mean = 42;
max = 8192;
size_min = MPS_PF_ALIGN;
size_mean = 42;
size_max = 8192;
MPS_ARGS_BEGIN(args) {
MPS_ARGS_ADD(args, MPS_KEY_MIN_SIZE, min);
MPS_ARGS_ADD(args, MPS_KEY_MEAN_SIZE, mean);
MPS_ARGS_ADD(args, MPS_KEY_MAX_SIZE, max);
MPS_ARGS_ADD(args, MPS_KEY_MIN_SIZE, size_min);
MPS_ARGS_ADD(args, MPS_KEY_MEAN_SIZE, size_mean);
MPS_ARGS_ADD(args, MPS_KEY_MAX_SIZE, size_max);
MPS_ARGS_ADD(args, MPS_KEY_MVT_RESERVE_DEPTH, TEST_SET_SIZE/2);
MPS_ARGS_ADD(args, MPS_KEY_MVT_FRAG_LIMIT, 0.3);
die(stress(mps_class_mvt(), arena, randomSize, args), "stress MVT");

59
mps/code/pc.nmk Normal file
View file

@ -0,0 +1,59 @@
# -*- makefile -*-
#
# pc.nmk: NMAKE FRAGMENT FOR PELLES C
#
# $Id: //info.ravenbrook.com/project/mps/branch/2014-03-21/pellesc/code/gc.gmk#1 $
# Copyright (c) 2014 Ravenbrook Limited. See end of file for license.
#
# This file is included by platform nmake files that use the Pelles C
# compiler. It defines the compiler-specific variables that the common
# nmake file fragment (<code/commpost.nmk>) requires.
CC = pocc
LIBMAN = polib
LINKER = polink
CFLAGSCOMMONPRE = $(CFLAGSCOMMONPRE) /Ze /W2
CRTFLAGSHOT = /MT
CRTFLAGSCOOL = /MT
# C. COPYRIGHT AND LICENSE
#
# Copyright (C) 2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
# All rights reserved. This is an open source license. Contact
# Ravenbrook for commercial licensing options.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# 3. Redistributions in any form must be accompanied by information on how
# to obtain complete source code for this software and any accompanying
# software that uses this software. The source code must either be
# included in the distribution or be available for no more than the cost
# of distribution plus a nominal fee, and must be freely redistributable
# under reasonable conditions. For an executable file, complete source
# code means the source code for all modules it contains. It does not
# include source code for modules or files that typically accompany the
# major components of the operating system on which the executable file
# runs.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
# PURPOSE, OR NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View file

@ -278,7 +278,9 @@ static Res MVTInit(Pool pool, ArgList args)
if (res != ResOK)
goto failABQ;
FreelistInit(MVTFreelist(mvt), align);
res = FreelistInit(MVTFreelist(mvt), align);
if (res != ResOK)
goto failABQ;
pool->alignment = align;
mvt->reuseSize = reuseSize;
@ -757,9 +759,11 @@ static Bool MVTDeleteOverlapping(Bool *deleteReturn, void *element,
/* MVTReserve -- add a range to the available range queue, and if the
* queue is full, return segments to the arena.
* queue is full, return segments to the arena. Return TRUE if it
* succeeded in adding the range to the queue, FALSE if the queue
* overflowed.
*/
static Res MVTReserve(MVT mvt, Range range)
static Bool MVTReserve(MVT mvt, Range range)
{
AVERT(MVT, mvt);
AVERT(Range, range);
@ -774,18 +778,18 @@ static Res MVTReserve(MVT mvt, Range range)
SURELY(ABQPeek(MVTABQ(mvt), &oldRange));
AVERT(Range, &oldRange);
if (!MVTReturnSegs(mvt, &oldRange, arena))
goto failOverflow;
goto overflow;
METER_ACC(mvt->returns, RangeSize(&oldRange));
if (!ABQPush(MVTABQ(mvt), range))
goto failOverflow;
goto overflow;
}
return ResOK;
return TRUE;
failOverflow:
overflow:
mvt->abqOverflow = TRUE;
METER_ACC(mvt->overflows, RangeSize(range));
return ResFAIL;
return FALSE;
}
@ -820,7 +824,7 @@ static Res MVTInsert(MVT mvt, Addr base, Addr limit)
* are coalesced on the ABQ.
*/
ABQIterate(MVTABQ(mvt), MVTDeleteOverlapping, &newRange, 0);
MVTReserve(mvt, &newRange);
(void)MVTReserve(mvt, &newRange);
}
return ResOK;
@ -875,11 +879,11 @@ static Res MVTDelete(MVT mvt, Addr base, Addr limit)
*/
RangeInit(&rangeLeft, RangeBase(&rangeOld), base);
if (RangeSize(&rangeLeft) >= mvt->reuseSize)
MVTReserve(mvt, &rangeLeft);
(void)MVTReserve(mvt, &rangeLeft);
RangeInit(&rangeRight, limit, RangeLimit(&rangeOld));
if (RangeSize(&rangeRight) >= mvt->reuseSize)
MVTReserve(mvt, &rangeRight);
(void)MVTReserve(mvt, &rangeRight);
return ResOK;
}
@ -1269,8 +1273,6 @@ static Bool MVTReturnSegs(MVT mvt, Range range, Arena arena)
*/
static Bool MVTRefillCallback(MVT mvt, Range range)
{
Res res;
AVERT(ABQ, MVTABQ(mvt));
AVERT(Range, range);
@ -1278,11 +1280,7 @@ static Bool MVTRefillCallback(MVT mvt, Range range)
return TRUE;
METER_ACC(mvt->refillPushes, ABQDepth(MVTABQ(mvt)));
res = MVTReserve(mvt, range);
if (res != ResOK)
return FALSE;
return TRUE;
return MVTReserve(mvt, range);
}
static Bool MVTCBSRefillCallback(CBS cbs, Range range,

View file

@ -109,11 +109,13 @@ LONG WINAPI ProtSEHfilter(LPEXCEPTION_POINTERS info)
void ProtSetup(void)
{
void *handler;
/* See "AddVectoredExceptionHandler function (Windows)"
<http://msdn.microsoft.com/en-us/library/windows/desktop/ms679274%28v=vs.85%29.aspx> */
/* ProtSetup is called only once per process, not once per arena, so
this exception handler is only installed once. */
AddVectoredExceptionHandler(1uL, ProtSEHfilter);
handler = AddVectoredExceptionHandler(1uL, ProtSEHfilter);
AVER(handler != NULL);
}

View file

@ -318,15 +318,14 @@ static void validate(void)
for(i = 0; i < listl; ++i) {
cdie(((QSCell)reg[1])->tag == QSInt, "validate int");
if((mps_word_t)((QSCell)reg[1])->value != list[i]) {
fprintf(stdout,
"mps_res_t: Element %"PRIuLONGEST" of the two lists do not match.\n",
(ulongest_t)i);
(void)fprintf(stdout, "mps_res_t: Element %"PRIuLONGEST" of the "
"two lists do not match.\n", (ulongest_t)i);
return;
}
reg[1] = (mps_addr_t)((QSCell)reg[1])->tail;
}
cdie(reg[1] == (mps_word_t)0, "validate end");
fprintf(stdout, "Note: Lists compare equal.\n");
(void)fprintf(stdout, "Note: Lists compare equal.\n");
}

View file

@ -125,9 +125,6 @@ static mps_res_t stress(mps_class_t class,
}
#define max(a, b) (((a) > (b)) ? (a) : (b))
/* randomSize8 -- produce sizes both latge and small */
static size_t randomSize8(int i)
@ -163,7 +160,7 @@ static mps_sac_classes_s classes8[4] = { {8, 1, 1}, {16, 1, 2}, {136, 9, 5},
static mps_sac_classes_s classes16[4] = { {16, 1, 1}, {32, 1, 2}, {144, 9, 5},
{topClassSIZE, 9, 4} };
static int testInArena(mps_arena_t arena)
static void testInArena(mps_arena_t arena)
{
mps_pool_debug_option_s *debugOptions;
mps_sac_classes_s *classes;
@ -183,7 +180,6 @@ static int testInArena(mps_arena_t arena)
die(stress(mps_class_mv(), classCOUNT, classes, randomSize8, arena,
(size_t)65536, (size_t)32, (size_t)65536),
"stress MV");
return 0;
}

View file

@ -33,8 +33,8 @@
/* Forward declarations */
static SegClass AMSTSegClassGet(void);
static PoolClass AMSTPoolClassGet(void);
extern SegClass AMSTSegClassGet(void);
extern PoolClass AMSTPoolClassGet(void);
/* Start by defining the AMST pool (AMS Test pool) */
@ -789,7 +789,7 @@ static void *test(void *arg, size_t s)
&ambigRoots[0], ambigRootsCOUNT),
"root_create_table(ambig)");
fputs(indent, stdout);
(void)fputs(indent, stdout);
/* create an ap, and leave it busy */
die(mps_reserve(&busy_init, busy_ap, 64), "mps_reserve busy");
@ -801,7 +801,7 @@ static void *test(void *arg, size_t s)
printf("\nSize %"PRIuLONGEST" bytes, %"PRIuLONGEST" objects.\n",
(ulongest_t)totalSize, (ulongest_t)objs);
printf("%s", indent);
fflush(stdout);
(void)fflush(stdout);
for(i = 0; i < exactRootsCOUNT; ++i)
cdie(exactRoots[i] == objNULL || dylan_check(exactRoots[i]),
"all roots check");
@ -832,7 +832,7 @@ static void *test(void *arg, size_t s)
++objs;
if (objs % 256 == 0) {
printf(".");
fflush(stdout);
(void)fflush(stdout);
}
}

View file

@ -800,7 +800,7 @@ Bool SplayTreeDelete(SplayTree splay, Tree node) {
TreeClearRight(node);
SplayTreeSetRoot(splay, TreeLeft(node));
TreeClearLeft(node);
SplaySplay(splay, NULL, compareGreater);
(void)SplaySplay(splay, NULL, compareGreater);
leftLast = SplayTreeRoot(splay);
AVER(leftLast != TreeEMPTY);
AVER(!TreeHasRight(leftLast));
@ -856,7 +856,7 @@ static Tree SplayTreeSuccessor(SplayTree splay) {
/* temporarily chop off the left half-tree, inclusive of root */
SplayTreeSetRoot(splay, TreeRight(oldRoot));
TreeSetRight(oldRoot, TreeEMPTY);
SplaySplay(splay, NULL, compareLess);
(void)SplaySplay(splay, NULL, compareLess);
newRoot = SplayTreeRoot(splay);
AVER(newRoot != TreeEMPTY);
AVER(TreeLeft(newRoot) == TreeEMPTY);
@ -968,7 +968,7 @@ Tree SplayTreeFirst(SplayTree splay) {
if (SplayTreeIsEmpty(splay))
return TreeEMPTY;
SplaySplay(splay, NULL, compareLess);
(void)SplaySplay(splay, NULL, compareLess);
node = SplayTreeRoot(splay);
AVER(node != TreeEMPTY);
AVER(TreeLeft(node) == TreeEMPTY);

View file

@ -1,4 +1,4 @@
/* spw3i3mv.c: STACK PROBE FOR 32-BIT WINDOWS
/* spw3i3.c: STACK PROBE FOR 32-BIT WINDOWS
*
* $Id$
* Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license.
@ -13,6 +13,13 @@
#include "mpm.h"
#ifdef MPS_BUILD_PC
/* "[ISO] Inline assembly code is not portable." */
#pragma warn(disable: 2007)
#endif /* MPS_BUILD_PC */
void StackProbe(Size depth)
{

View file

@ -1,4 +1,4 @@
/* spw3i6mv.c: STACK PROBE FOR 64-BIT WINDOWS
/* spw3i6.c: STACK PROBE FOR 64-BIT WINDOWS
*
* $Id$
* Copyright (c) 2013 Ravenbrook Limited. See end of file for license.

View file

@ -109,7 +109,8 @@ static double my_clock(void)
{
FILETIME ctime, etime, ktime, utime;
double dk, du;
GetProcessTimes(currentProcess, &ctime, &etime, &ktime, &utime);
cdie(GetProcessTimes(currentProcess, &ctime, &etime, &ktime, &utime) != 0,
"GetProcessTimes");
dk = ktime.dwHighDateTime * 4096.0 * 1024.0 * 1024.0 +
ktime.dwLowDateTime;
dk /= 10.0;
@ -391,7 +392,7 @@ static void *test(void *arg, size_t s)
if (collections > old_collections) {
old_collections = collections;
putchar('.');
fflush(stdout);
(void)fflush(stdout);
}
}

View file

@ -209,13 +209,14 @@ extern int main(int argc, char *argv[])
while(1) {
char input[INPUT_BUFFER_SIZE];
printf("telemetry test> ");
fflush(stdout);
(void)fflush(stdout);
if (fgets(input, INPUT_BUFFER_SIZE , stdin)) {
obeyCommand(input);
} else {
doQuit();
break;
}
}
doQuit();
return EXIT_SUCCESS;
}

View file

@ -122,7 +122,7 @@ static unsigned long seed_verify_float = 1;
static unsigned long rnd_verify_float(void)
{
double s;
s = seed_verify_float;
s = (double)seed_verify_float;
s *= R_a_float;
s = fmod(s, R_m_float);
seed_verify_float = (unsigned long)s;
@ -285,7 +285,7 @@ void randomize(int argc, char *argv[])
argv[0], seed0);
rnd_state_set(seed0);
}
fflush(stdout); /* ensure seed is not lost in case of failure */
(void)fflush(stdout); /* ensure seed is not lost in case of failure */
}
unsigned long rnd_state(void)
@ -341,10 +341,10 @@ _mps_RES_ENUM(RES_STRINGS_ROW, X)
void verror(const char *format, va_list args)
{
fflush(stdout); /* synchronize */
vfprintf(stderr, format, args);
fprintf(stderr, "\n");
fflush(stderr); /* make sure the message is output */
(void)fflush(stdout); /* synchronize */
(void)vfprintf(stderr, format, args);
(void)fprintf(stderr, "\n");
(void)fflush(stderr); /* make sure the message is output */
/* On Windows, the abort signal pops up a dialog box. This suspends
* the test suite until a button is pressed, which is not acceptable
* for offline testing, so if the MPS_TESTLIB_NOABORT environment
@ -413,7 +413,7 @@ void assert_die(const char *file, unsigned line, const char *condition)
void testlib_init(int argc, char *argv[])
{
mps_lib_assert_fail_install(assert_die);
(void)mps_lib_assert_fail_install(assert_die);
randomize(argc, argv);
}

View file

@ -69,6 +69,20 @@
#endif /* MPS_BUILD_MV */
/* Suppress Pelles C warnings at warning level 2 */
/* Some of these are also done in config.h. */
#ifdef MPS_BUILD_PC
/* "Structured Exception Handling is not portable." (mps_tramp). */
#pragma warn(disable: 2008)
/* "Unreachable code" (AVER, if condition is constantly true). */
#pragma warn(disable: 2154)
#endif /* MPS_BUILD_PC */
/* ulongest_t -- longest unsigned integer type
*
* Define a longest unsigned integer type for testing, scanning, and
@ -119,6 +133,20 @@ typedef long longest_t;
#define testlib_unused(v) ((void)(v))
/* max -- return larger value
*
* Note: evaluates its arguments twice.
*/
#undef max
#define max(a, b) (((a) > (b)) ? (a) : (b))
/* alignUp -- align word to alignment */
#define alignUp(w, a) (((w) + (a) - 1) & ~((size_t)(a) - 1))
/* die -- succeed or die
*
* If the first argument is not ResOK then prints the second

View file

@ -5,16 +5,13 @@
PFM = w3i3mv
# /Gs appears to be necessary to suppress stack checks. Stack checks
# (if not suppressed) generate a dependency on the C library, __chkesp,
# which causes the linker step to fail when building the DLL, mpsdy.dll.
PFMDEFS = /DCONFIG_PF_STRING="w3i3mv" /DCONFIG_PF_W3I3MV \
/DWIN32 /D_WINDOWS /Gs
PFMDEFS = /DCONFIG_PF_STRING="w3i3mv" /DCONFIG_PF_W3I3MV /DWIN32 /D_WINDOWS
!INCLUDE commpre.nmk
!INCLUDE mv.nmk
# MPM sources: core plus platform-specific.
MPM = $(MPMCOMMON) <proti3> <prmci3w3> <spw3i3mv> <ssw3i3mv> <thw3i3>
MPM = $(MPMCOMMON) <proti3> <prmci3w3> <spw3i3> <ssw3i3mv> <thw3i3>

View file

@ -1,5 +0,0 @@
%.obj: %.c
pocc /Ze $<
amcss.exe: amcss.obj abq.obj arena.obj arenacl.obj arenavm.obj arg.obj boot.obj bt.obj buffer.obj cbs.obj dbgpool.obj dbgpooli.obj event.obj fmtdy.obj fmtdy.obj fmtdytst.obj fmthe.obj fmtno.obj fmtno.obj format.obj freelist.obj global.obj ld.obj lockw3.obj locus.obj message.obj meter.obj mpm.obj mpsi.obj mpsioan.obj mpsiw3.obj mpsliban.obj pool.obj poolabs.obj poolamc.obj poolams.obj poolamsi.obj poolawl.obj poollo.obj poolmfs.obj poolmrg.obj poolmv2.obj poolmv.obj poolmvff.obj pooln.obj poolsnc.obj proti3.obj prmci3w3.obj protocol.obj protw3.obj range.obj ref.obj reserv.obj ring.obj root.obj sa.obj sac.obj seg.obj shield.obj spw3i3mv.obj splay.obj ss.obj ssw3i3pc.obj table.obj testlib.obj thw3.obj thw3i3.obj trace.obj traceanc.obj tract.obj tree.obj version.obj vmw3.obj walk.obj
polink $^ /OUT:$@

171
mps/code/w3i3pc.nmk Normal file
View file

@ -0,0 +1,171 @@
# w3i3pc.nmk: WINDOWS (IA-32) NMAKE FILE -*- makefile -*-
#
# $Id: //info.ravenbrook.com/project/mps/branch/2014-03-21/pellesc/code/w3i3pc.nmk#1 $
# Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license.
PFM = w3i3pc
# /Gs appears to be necessary to suppress stack checks. Stack checks
# (if not suppressed) generate a dependency on the C library, __chkesp,
# which causes the linker step to fail when building the DLL, mpsdy.dll.
PFMDEFS = /DCONFIG_PF_STRING="w3i3pc" /DCONFIG_PF_W3I3PC /DWIN32 /D_WINDOWS
!INCLUDE commpre.nmk
!INCLUDE pc.nmk
# MPM sources: core plus platform-specific.
MPM = $(MPMCOMMON) <proti3> <prmci3w3> <spw3i3> <ssw3i3pc> <thw3i3>
# Source to object file mappings and CFLAGS amalgamation
#
# %%VARIETY %%PART: When adding a new variety or part, add new macros which
# expand to the files included in the part for each variety
#
# %%VARIETY: When adding a new variety, add a CFLAGS macro which expands to
# the flags that that variety should use when compiling C. And a LINKFLAGS
# macro which expands to the flags that the variety should use when building
# executables. And a LIBFLAGS macro which expands to the flags that the
# variety should use when building libraries
!IF "$(VARIETY)" == "hot"
CFLAGS=$(CFLAGSCOMMONPRE) $(CFHOT) $(CFLAGSCOMMONPOST)
CFLAGSSQL=$(CFLAGSSQLPRE) $(CFHOT) $(CFLAGSSQLPOST)
LINKFLAGS=$(LINKFLAGSCOMMON) $(LFHOT)
LIBFLAGS=$(LIBFLAGSCOMMON) $(LIBFLAGSHOT)
MPMOBJ0 = $(MPM:<=w3i3pc\hot\)
PLINTHOBJ0 = $(PLINTH:<=w3i3pc\hot\)
AMSOBJ0 = $(AMS:<=w3i3pc\hot\)
AMCOBJ0 = $(AMC:<=w3i3pc\hot\)
AWLOBJ0 = $(AWL:<=w3i3pc\hot\)
LOOBJ0 = $(LO:<=w3i3pc\hot\)
SNCOBJ0 = $(SNC:<=w3i3pc\hot\)
MVFFOBJ0 = $(MVFF:<=w3i3pc\hot\)
DWOBJ0 = $(DW:<=w3i3pc\hot\)
FMTTESTOBJ0 = $(FMTTEST:<=w3i3pc\hot\)
POOLNOBJ0 = $(POOLN:<=w3i3pc\hot\)
TESTLIBOBJ0 = $(TESTLIB:<=w3i3pc\hot\)
!ELSEIF "$(VARIETY)" == "cool"
CFLAGS=$(CFLAGSCOMMONPRE) $(CFCOOL) $(CFLAGSCOMMONPOST)
CFLAGSSQL=$(CFLAGSSQLPRE) $(CFCOOL) $(CFLAGSSQLPOST)
LINKFLAGS=$(LINKFLAGSCOMMON) $(LFCOOL)
LIBFLAGS=$(LIBFLAGSCOMMON) $(LIBFLAGSCOOL)
MPMOBJ0 = $(MPM:<=w3i3pc\cool\)
PLINTHOBJ0 = $(PLINTH:<=w3i3pc\cool\)
AMSOBJ0 = $(AMS:<=w3i3pc\cool\)
AMCOBJ0 = $(AMC:<=w3i3pc\cool\)
AWLOBJ0 = $(AWL:<=w3i3pc\cool\)
LOOBJ0 = $(LO:<=w3i3pc\cool\)
SNCOBJ0 = $(SNC:<=w3i3pc\cool\)
MVFFOBJ0 = $(MVFF:<=w3i3pc\cool\)
DWOBJ0 = $(DW:<=w3i3pc\cool\)
FMTTESTOBJ0 = $(FMTTEST:<=w3i3pc\cool\)
POOLNOBJ0 = $(POOLN:<=w3i3pc\cool\)
TESTLIBOBJ0 = $(TESTLIB:<=w3i3pc\cool\)
!ELSEIF "$(VARIETY)" == "rash"
CFLAGS=$(CFLAGSCOMMONPRE) $(CFRASH) $(CFLAGSCOMMONPOST)
CFLAGSSQL=$(CFLAGSSQLPRE) $(CFRASH) $(CFLAGSSQLPOST)
LINKFLAGS=$(LINKFLAGSCOMMON) $(LFRASH)
LIBFLAGS=$(LIBFLAGSCOMMON) $(LIBFLAGSRASH)
MPMOBJ0 = $(MPM:<=w3i3pc\rash\)
PLINTHOBJ0 = $(PLINTH:<=w3i3pc\rash\)
AMSOBJ0 = $(AMS:<=w3i3pc\rash\)
AMCOBJ0 = $(AMC:<=w3i3pc\rash\)
AWLOBJ0 = $(AWL:<=w3i3pc\rash\)
LOOBJ0 = $(LO:<=w3i3pc\rash\)
SNCOBJ0 = $(SNC:<=w3i3pc\rash\)
MVFFOBJ0 = $(MVFF:<=w3i3pc\rash\)
DWOBJ0 = $(DW:<=w3i3pc\rash\)
FMTTESTOBJ0 = $(FMTTEST:<=w3i3pc\rash\)
POOLNOBJ0 = $(POOLN:<=w3i3pc\rash\)
TESTLIBOBJ0 = $(TESTLIB:<=w3i3pc\rash\)
#!ELSEIF "$(VARIETY)" == "cv"
#CFLAGS=$(CFLAGSCOMMON) $(CFCV)
#LINKFLAGS=$(LINKFLAGSCOMMON) $(LFCV)
#LIBFLAGS=$(LIBFLAGSCOMMON) $(LIBFLAGSCV)
#MPMOBJ0 = $(MPM:<=w3i3pc\cv\)
#MPMOBJ = $(MPMOBJ0:>=.obj)
#PLINTHOBJ0 = $(PLINTH:<=w3i3pc\cv\)
#PLINTHOBJ = $(PLINTHOBJ0:>=.obj)
#AMSOBJ0 = $(AMS:<=w3i3pc\cv\)
#AMSOBJ = $(AMSOBJ0:>=.obj)
#AMCOBJ0 = $(AMC:<=w3i3pc\cv\)
#AMCOBJ = $(AMCOBJ0:>=.obj)
#AWLOBJ0 = $(AWL:<=w3i3pc\cv\)
#AWLOBJ = $(AWLOBJ0:>=.obj)
#LOOBJ0 = $(LO:<=w3i3pc\cv\)
#LOOBJ = $(LOOBJ0:>=.obj)
#SNCOBJ0 = $(SNC:<=w3i3pc\cv\)
#SNCOBJ = $(SNCOBJ0:>=.obj)
#DWOBJ0 = $(DW:<=w3i3pc\cv\)
#DWOBJ = $(DWOBJ0:>=.obj)
#POOLNOBJ0 = $(POOLN:<=w3i3pc\cv\)
#POOLNOBJ = $(POOLNOBJ0:>=.obj)
#TESTLIBOBJ0 = $(TESTLIB:<=w3i3pc\cv\)
#TESTLIBOBJ = $(TESTLIBOBJ0:>=.obj)
!ENDIF
# %%PART: When adding a new part, add new macros which expand to the object
# files included in the part
MPMOBJ = $(MPMOBJ0:>=.obj)
PLINTHOBJ = $(PLINTHOBJ0:>=.obj)
AMSOBJ = $(AMSOBJ0:>=.obj)
AMCOBJ = $(AMCOBJ0:>=.obj)
AWLOBJ = $(AWLOBJ0:>=.obj)
LOOBJ = $(LOOBJ0:>=.obj)
SNCOBJ = $(SNCOBJ0:>=.obj)
MVFFOBJ = $(MVFFOBJ0:>=.obj)
DWOBJ = $(DWOBJ0:>=.obj)
FMTTESTOBJ = $(FMTTESTOBJ0:>=.obj)
POOLNOBJ = $(POOLNOBJ0:>=.obj)
TESTLIBOBJ = $(TESTLIBOBJ0:>=.obj)
!INCLUDE commpost.nmk
# C. COPYRIGHT AND LICENSE
#
# Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
# All rights reserved. This is an open source license. Contact
# Ravenbrook for commercial licensing options.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# 3. Redistributions in any form must be accompanied by information on how
# to obtain complete source code for this software and any accompanying
# software that uses this software. The source code must either be
# included in the distribution or be available for no more than the cost
# of distribution plus a nominal fee, and must be freely redistributable
# under reasonable conditions. For an executable file, complete source
# code means the source code for all modules it contains. It does not
# include source code for modules or files that typically accompany the
# major components of the operating system on which the executable file
# runs.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
# PURPOSE, OR NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View file

@ -5,15 +5,11 @@
PFM = w3i6mv
# /Gs appears to be necessary to suppress stack checks. Stack checks
# (if not suppressed) generate a dependency on the C library, __chkesp,
# which causes the linker step to fail when building the DLL, mpsdy.dll.
PFMDEFS = /DCONFIG_PF_STRING="w3i6mv" /DCONFIG_PF_W3I6MV \
/DWIN32 /D_WINDOWS /Gs
PFMDEFS = /DCONFIG_PF_STRING="w3i6mv" /DCONFIG_PF_W3I6MV /DWIN32 /D_WINDOWS
MASM = ml64
# MPM sources: core plus platform-specific.
MPM = $(MPMCOMMON) <proti6> <prmci6w3> <spw3i6mv> <ssw3i6mv> <thw3i6>
MPM = $(MPMCOMMON) <proti6> <prmci6w3> <spw3i6> <ssw3i6mv> <thw3i6>
!INCLUDE commpre.nmk

View file

@ -308,7 +308,8 @@ static Res ArenaRootsWalk(Globals arenaGlobals, mps_roots_stepper_t f,
if (SegFirst(&seg, arena)) {
do {
if ((SegPool(seg)->class->attr & AttrGC) != 0) {
TraceAddWhite(trace, seg);
res = TraceAddWhite(trace, seg);
AVER(res == ResOK);
}
} while (SegNext(&seg, arena, seg));
}

View file

@ -119,12 +119,11 @@ static void showStatsAscii(size_t notcon, size_t con, size_t live, size_t alimit
count = (a < 200) ? a + 1 : c;
for(i = 0; i < count; i++) {
printf( (i == a) ? "A"
: (i < n) ? "n"
: (i < l) ? "L"
: (i < c) ? "_"
: " "
);
putchar((i == a) ? 'A'
: (i < n) ? 'n'
: (i < l) ? 'L'
: (i < c) ? '_'
: ' ');
}
printf("\n");
}
@ -370,7 +369,7 @@ static void CatalogDo(mps_arena_t arena, mps_ap_t ap)
myrootExact[CatalogRootIndex] = Catalog;
get(arena);
fflush(stdout);
(void)fflush(stdout);
CatalogCheck();
for(i = 0; i < CatalogVar; i += 1) {
@ -383,7 +382,7 @@ static void CatalogDo(mps_arena_t arena, mps_ap_t ap)
get(arena);
printf("Page %d: make articles\n", i);
fflush(stdout);
(void)fflush(stdout);
for(j = 0; j < PageVar; j += 1) {
die(make_dylan_vector(&v, ap, ArtFix + ArtVar), "Art");
@ -405,7 +404,7 @@ static void CatalogDo(mps_arena_t arena, mps_ap_t ap)
}
}
}
fflush(stdout);
(void)fflush(stdout);
CatalogCheck();
}
@ -625,7 +624,7 @@ static void testscriptC(mps_arena_t arena, mps_ap_t ap, const char *script)
script += sb;
printf(" Collect\n");
stackwipe();
mps_arena_collect(arena);
die(mps_arena_collect(arena), "mps_arena_collect");
mps_arena_release(arena);
break;
}

View file

@ -242,7 +242,7 @@ static void testscriptC(mps_arena_t arena, const char *script)
}
case 'C': {
printf(" Collect\n");
mps_arena_collect(arena);
die(mps_arena_collect(arena), "mps_arena_collect");
break;
}
case 'F': {

View file

@ -59,9 +59,9 @@ set TEST_COUNT=0
set PASS_COUNT=0
set FAIL_COUNT=0
set SEPARATOR=----------------------------------------
set LOGDIR=%TMP%\mps-%VARIETY%-log
set LOGDIR=%TMP%\mps-%PFM%-%VARIETY%-log
echo Logging test output to %LOGDIR%
rmdir /q /s %LOGDIR%
rmdir /q /s %LOGDIR% 2> NUL
mkdir %LOGDIR%
if "%1"=="" call :run_tests %ALL_TEST_CASES%