diff --git a/mps/code/arenavm.c b/mps/code/arenavm.c index 1b1a15b50bb..81caf8bead5 100644 --- a/mps/code/arenavm.c +++ b/mps/code/arenavm.c @@ -1111,7 +1111,7 @@ static Res vmArenaExtend(VMArena vmArena, Size size) /* .chunk-create.fail: If we fail, try again with a smaller size */ { - int fidelity = 8; /* max fraction of addr-space we may 'waste' */ + unsigned fidelity = 8; /* max fraction of addr-space we may 'waste' */ Size chunkHalf; Size chunkMin = 4 * 1024; /* typical single page */ Size sliceSize; diff --git a/mps/code/bttest.c b/mps/code/bttest.c index 1b3514c839a..115df4e236d 100644 --- a/mps/code/bttest.c +++ b/mps/code/bttest.c @@ -289,7 +289,7 @@ static void obeyCommand(char *command) printf("negative integer arguments are invalid\n"); return; } - args[argCount] = l; + args[argCount] = (unsigned long)l; if (newP == p) { /* strtoul failed */ printf("couldn't parse an integer argument\n"); return; diff --git a/mps/code/cbstest.c b/mps/code/cbstest.c index 0777a08732b..c04c21eba81 100644 --- a/mps/code/cbstest.c +++ b/mps/code/cbstest.c @@ -563,7 +563,7 @@ static void find(CBS cbs, void *block, BT alloc, Size size, Bool high, extern int main(int argc, char *argv[]) { - int i; + unsigned i; Addr base, limit; mps_arena_t mpsArena; Arena arena; /* the ANSI arena which we use to allocate the BT */ diff --git a/mps/code/finalcv.c b/mps/code/finalcv.c index 81f121eeca6..355c841e1ae 100644 --- a/mps/code/finalcv.c +++ b/mps/code/finalcv.c @@ -97,7 +97,7 @@ enum { static void *test(void *arg, size_t s) { - int i; /* index */ + unsigned i; /* index */ mps_ap_t ap; mps_fmt_t fmt; mps_chain_t chain; diff --git a/mps/code/fmtdy.c b/mps/code/fmtdy.c index b7a2f7fa02f..21d47080d8e 100644 --- a/mps/code/fmtdy.c +++ b/mps/code/fmtdy.c @@ -692,10 +692,14 @@ static mps_addr_t dylan_skip(mps_addr_t object) static void dylan_copy(mps_addr_t old, mps_addr_t new) { - size_t length = (char *)dylan_skip(old) - (char *)old; + char *base = (char *)old; + char *limit = (char *)dylan_skip(old); + size_t length; + assert(base < limit); + length = (size_t)(limit - base); assert(dylan_wrapper_check(*(mps_word_t **)old)); /* .improve.memcpy: Can do better here as we know that new and old - * will be aligned (to MPS_PF_ALIGN) */ + will be aligned (to MPS_PF_ALIGN) */ (void)memcpy(new, old, length); } diff --git a/mps/code/mps.xcodeproj/project.pbxproj b/mps/code/mps.xcodeproj/project.pbxproj index 8f71736f689..cbee78a359f 100644 --- a/mps/code/mps.xcodeproj/project.pbxproj +++ b/mps/code/mps.xcodeproj/project.pbxproj @@ -3213,7 +3213,6 @@ GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO = NO; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES; GCC_WARN_ABOUT_MISSING_NEWLINE = YES; GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; @@ -3270,7 +3269,6 @@ GCC_VERSION = com.apple.compilers.llvm.clang.1_0; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO = NO; - GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES; GCC_WARN_ABOUT_MISSING_NEWLINE = YES; GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; diff --git a/mps/code/mv2test.c b/mps/code/mv2test.c index b2f7fcf7ea8..2937aafc807 100644 --- a/mps/code/mv2test.c +++ b/mps/code/mv2test.c @@ -76,7 +76,7 @@ static float ran1(long *idum) *idum=IA*(*idum-k*IQ)-IR*k; /* Compute idum=(IA*idum) % IM without overflows by Schrage's method. */ if (*idum < 0) *idum += IM; - j=iy/NDIV; /* Will be in the range 0..NTAB-1. */ + j=(int)(iy/NDIV); /* Will be in the range 0..NTAB-1. */ iy=iv[j]; /* Output previously stored value and refill the shuffle table. */ iv[j] = *idum; diff --git a/mps/code/poolmrg.c b/mps/code/poolmrg.c index a8c08047821..73ec8ac81f1 100644 --- a/mps/code/poolmrg.c +++ b/mps/code/poolmrg.c @@ -347,7 +347,7 @@ static RefPart MRGRefPartOfLink(Link link, Arena arena) AVERT(MRGLinkSeg, linkseg); linkBase = (Link)SegBase(seg); AVER(link >= linkBase); - index = link - linkBase; + index = (Index)(link - linkBase); AVER(index < MRGGuardiansPerSeg(Pool2MRG(SegPool(seg)))); return refPartOfIndex(linkseg->refSeg, index); @@ -475,7 +475,7 @@ static MessageClassStruct MRGMessageClassStruct = { * .segpair.destroy: We don't worry about the effect that destroying * these segs has on any of the pool rings. */ -static void MRGSegPairDestroy(MRGRefSeg refseg, MRG mrg) +static void MRGSegPairDestroy(MRGRefSeg refseg) { RingRemove(&refseg->mrgRing); RingFinish(&refseg->mrgRing); @@ -678,7 +678,7 @@ static void MRGFinish(Pool pool) RING_FOR(node, &mrg->refRing, nextNode) { MRGRefSeg refseg = RING_ELT(MRGRefSeg, mrgRing, node); - MRGSegPairDestroy(refseg, mrg); + MRGSegPairDestroy(refseg); } mrg->sig = SigInvalid; diff --git a/mps/code/protsgix.c b/mps/code/protsgix.c index ee47676a933..80a2f94dff0 100644 --- a/mps/code/protsgix.c +++ b/mps/code/protsgix.c @@ -79,18 +79,18 @@ static void sigHandle(int sig, siginfo_t *info, void *context) /* .sigh.args */ sigset_t asigset, oldset; struct sigaction sa; + UNUSED(context); AVER(sig == PROT_SIGNAL); /* .sigh.context */ if(PROT_SIGINFO_GOOD(info)) { AccessSet mode; - Addr base, limit; + Addr base; mode = AccessREAD | AccessWRITE; /* .sigh.mode */ /* We assume that the access is for one word at the address. */ base = (Addr)info->si_addr; /* .sigh.context */ - limit = AddrAdd(base, (Size)sizeof(Addr)); /* Offer each protection structure the opportunity to handle the */ /* exception. If it succeeds, then allow the mutator to continue. */ diff --git a/mps/code/steptest.c b/mps/code/steptest.c index ad1e2359508..7236e9aaa9c 100644 --- a/mps/code/steptest.c +++ b/mps/code/steptest.c @@ -59,7 +59,7 @@ static unsigned long step_frequencies[] = { #define TESTS (sizeof(step_frequencies) / sizeof(step_frequencies[0])) -static int test_number = 0; +static unsigned test_number = 0; /* objNULL needs to be odd so that it's ignored in exactRoots. */ diff --git a/mps/code/testlib.c b/mps/code/testlib.c index 027cbd2f9cd..d7f4bc60418 100644 --- a/mps/code/testlib.c +++ b/mps/code/testlib.c @@ -258,7 +258,7 @@ void randomize(int argc, char **argv) } else { /* time_t uses an arbitrary encoding, but hopefully the low order */ /* 31 bits will have at least one bit changed from run to run. */ - seedt = 1 + time(NULL) % (R_m - 1); + seedt = 1 + (unsigned long)time(NULL) % (R_m - 1); /* The value returned by time() on some OSs may simply be a * count of seconds: therefore successive runs may start with diff --git a/mps/code/trace.c b/mps/code/trace.c index 82b3047f1c7..a12800d4dd9 100644 --- a/mps/code/trace.c +++ b/mps/code/trace.c @@ -1667,7 +1667,7 @@ void TraceStart(Trace trace, double mortality, double finishingTime) if(nPolls >= (double)LONG_MAX) nPolls = (double)LONG_MAX; /* rate equals scanning work per number of polls available */ - trace->rate = (trace->foundation + sSurvivors) / (long)nPolls + 1; + trace->rate = (trace->foundation + sSurvivors) / (unsigned long)nPolls + 1; } /* @@ DIAG for rate of scanning here. */ diff --git a/mps/code/vmix.c b/mps/code/vmix.c index f5ba622f7c9..0718dd982fa 100644 --- a/mps/code/vmix.c +++ b/mps/code/vmix.c @@ -116,8 +116,7 @@ Res VMCreate(VM *vmReturn, Size size) /* type Align. */ AVER(pagesize > 0); AVER((unsigned long)pagesize <= (unsigned long)(Align)-1); - /* Note implicit conversion from "int" to "Align". */ - align = pagesize; + align = (Align)pagesize; AVER(SizeIsP2(align)); size = SizeAlignUp(size, align); if((size == 0) || (size > (Size)(size_t)-1)) diff --git a/mps/code/zcoll.c b/mps/code/zcoll.c index 70f77b2b4c7..494b443e6b7 100644 --- a/mps/code/zcoll.c +++ b/mps/code/zcoll.c @@ -681,7 +681,7 @@ static void testscriptC(mps_arena_t arena, mps_ap_t ap, const char *script) checksi(si, 1, script, scriptAll); script += sb; printf(" StackScan(%u)\n", on); - StackScan(arena, on); + StackScan(arena, on != 0); break; } case 'Z': {