From: Matthew F. <fl...@ml...> - 2011-05-27 08:00:19
|
Unused but set variables detected by gcc 4.6. In gcc 4.6, -Wall implies -Wunused and -Wunused implies -Wunused-but-set-variable. Eliminate truly unused variables and use __attribute__ ((unused)) on variables only used in assertions. ---------------------------------------------------------------------- U mlton/trunk/runtime/basis/Posix/Signal.c U mlton/trunk/runtime/basis/Real/gdtoa.c U mlton/trunk/runtime/basis/Real/strto.c U mlton/trunk/runtime/gc/copy-thread.c U mlton/trunk/runtime/gc/heap.c U mlton/trunk/runtime/gc/init-world.c U mlton/trunk/runtime/gc/profiling.c ---------------------------------------------------------------------- Modified: mlton/trunk/runtime/basis/Posix/Signal.c =================================================================== --- mlton/trunk/runtime/basis/Posix/Signal.c 2011-05-24 02:34:31 UTC (rev 7533) +++ mlton/trunk/runtime/basis/Posix/Signal.c 2011-05-27 15:00:11 UTC (rev 7534) @@ -104,7 +104,7 @@ } void Posix_Signal_sigsuspend (void) { - int res; + int __attribute__ ((unused)) res; res = sigsuspend (&Posix_Signal_sigset); assert (-1 == res); Modified: mlton/trunk/runtime/basis/Real/gdtoa.c =================================================================== --- mlton/trunk/runtime/basis/Real/gdtoa.c 2011-05-24 02:34:31 UTC (rev 7533) +++ mlton/trunk/runtime/basis/Real/gdtoa.c 2011-05-27 15:00:11 UTC (rev 7534) @@ -14,10 +14,8 @@ int i; ULong L[1]; char *result; - ULong sign; memcpy(L, &f, sizeof(Real32_t)); - sign = L[0] & 0x80000000L; bits[0] = L[0] & 0x7fffff; if (0 != (ex = (L[0] >> 23) & 0xff)) bits[0] |= 0x800000; @@ -40,7 +38,6 @@ int i; ULong L[2]; char *result; - ULong sign; int x0, x1; if (isBigEndian()) { @@ -51,7 +48,6 @@ x1 = 0; } memcpy(L, &d, sizeof(Real64_t)); - sign = L[x0] & 0x80000000L; bits[0] = L[x1]; bits[1] = L[x0] & 0xfffff; if (0 != (ex = (L[x0] >> 20) & 0x7ff)) Modified: mlton/trunk/runtime/basis/Real/strto.c =================================================================== --- mlton/trunk/runtime/basis/Real/strto.c 2011-05-24 02:34:31 UTC (rev 7533) +++ mlton/trunk/runtime/basis/Real/strto.c 2011-05-27 15:00:11 UTC (rev 7534) @@ -4,9 +4,8 @@ Real32_t Real32_strto (NullString8_t s, C_Int_t rounding) { char *endptr; Real32_t res; - int ret; - ret = gdtoa__strtorf ((const char*)s, &endptr, (int)rounding, &res); + gdtoa__strtorf ((const char*)s, &endptr, (int)rounding, &res); assert (NULL != endptr); return res; } @@ -14,9 +13,8 @@ Real64_t Real64_strto (NullString8_t s, C_Int_t rounding) { char *endptr; Real64_t res; - int ret; - ret = gdtoa__strtord ((const char*)s, &endptr, (int)rounding, &res); + gdtoa__strtord ((const char*)s, &endptr, (int)rounding, &res); assert (NULL != endptr); return res; } Modified: mlton/trunk/runtime/gc/copy-thread.c =================================================================== --- mlton/trunk/runtime/gc/copy-thread.c 2011-05-24 02:34:31 UTC (rev 7533) +++ mlton/trunk/runtime/gc/copy-thread.c 2011-05-27 15:00:11 UTC (rev 7534) @@ -1,4 +1,5 @@ -/* Copyright (C) 1999-2007 Henry Cejtin, Matthew Fluet, Suresh +/* Copyright (C) 2011 Matthew Fluet. + * Copyright (C) 1999-2007 Henry Cejtin, Matthew Fluet, Suresh * Jagannathan, and Stephen Weeks. * Copyright (C) 1997-2000 NEC Research Institute. * @@ -35,7 +36,7 @@ GC_thread fromThread; GC_stack fromStack; GC_thread toThread; - GC_stack toStack; + GC_stack __attribute__ ((unused)) toStack; if (DEBUG_THREADS) fprintf (stderr, "GC_copyCurrentThread\n"); @@ -57,7 +58,7 @@ GC_thread fromThread; GC_stack fromStack; GC_thread toThread; - GC_stack toStack; + GC_stack __attribute__ ((unused)) toStack; if (DEBUG_THREADS) fprintf (stderr, "GC_copyThread ("FMTPTR")\n", (uintptr_t)p); Modified: mlton/trunk/runtime/gc/heap.c =================================================================== --- mlton/trunk/runtime/gc/heap.c 2011-05-24 02:34:31 UTC (rev 7533) +++ mlton/trunk/runtime/gc/heap.c 2011-05-27 15:00:11 UTC (rev 7534) @@ -1,4 +1,4 @@ -/* Copyright (C) 2009-2010 Matthew Fluet. +/* Copyright (C) 2009-2011 Matthew Fluet. * Copyright (C) 2005-2008 Henry Cejtin, Matthew Fluet, Suresh * Jagannathan, and Stephen Weeks. * @@ -41,7 +41,7 @@ size_t liveMapsSize, liveWithMapsSize; size_t currentMapsSize, currentWithMapsSize; size_t resSize, resWithMapsSize; - size_t syslimSize, syslimMapsSize, syslimWithMapsSize; + size_t syslimSize, __attribute__ ((unused)) syslimMapsSize, syslimWithMapsSize; double ratio; syslimWithMapsSize = alignDown (SIZE_MAX, s->sysvals.pageSize); @@ -553,12 +553,11 @@ */ void resizeHeapSecondary (GC_state s) { size_t primarySize, primaryWithMapsSize; - size_t secondarySize, secondaryWithMapsSize; + size_t secondarySize; primarySize = s->heap.size; primaryWithMapsSize = s->heap.withMapsSize; secondarySize = s->secondaryHeap.size; - secondaryWithMapsSize = s->secondaryHeap.withMapsSize; if (DEBUG_RESIZING) fprintf (stderr, "secondaryHeapResize\n"); if (0 == secondarySize) Modified: mlton/trunk/runtime/gc/init-world.c =================================================================== --- mlton/trunk/runtime/gc/init-world.c 2011-05-24 02:34:31 UTC (rev 7533) +++ mlton/trunk/runtime/gc/init-world.c 2011-05-27 15:00:11 UTC (rev 7534) @@ -1,4 +1,5 @@ -/* Copyright (C) 1999-2008 Henry Cejtin, Matthew Fluet, Suresh +/* Copyright (C) 2011 Matthew Fluet. + * Copyright (C) 1999-2008 Henry Cejtin, Matthew Fluet, Suresh * Jagannathan, and Stephen Weeks. * Copyright (C) 1997-2000 NEC Research Institute. * @@ -51,7 +52,7 @@ size_t bytes; bool neg; __mpz_struct resmpz; - int ans; + __attribute__ ((unused)) int ans; assert (isFrontierAligned (s, s->frontier)); for (i = 0; i < s->intInfInitsLength; i++) { Modified: mlton/trunk/runtime/gc/profiling.c =================================================================== --- mlton/trunk/runtime/gc/profiling.c 2011-05-24 02:34:31 UTC (rev 7533) +++ mlton/trunk/runtime/gc/profiling.c 2011-05-27 15:00:11 UTC (rev 7534) @@ -1,4 +1,5 @@ -/* Copyright (C) 1999-2007 Henry Cejtin, Matthew Fluet, Suresh +/* Copyright (C) 2011 Matthew Fluet. + * Copyright (C) 1999-2007 Henry Cejtin, Matthew Fluet, Suresh * Jagannathan, and Stephen Weeks. * Copyright (C) 1997-2000 NEC Research Institute. * @@ -76,7 +77,6 @@ void enterForProfiling (GC_state s, GC_sourceSeqIndex sourceSeqIndex) { uint32_t i; - GC_profileData p; GC_sourceIndex sourceIndex; uint32_t *sourceSeq; @@ -84,7 +84,6 @@ fprintf (stderr, "enterForProfiling ("FMTSSI")\n", sourceSeqIndex); assert (s->profiling.stack); assert (sourceSeqIndex < s->sourceMaps.sourceSeqsLength); - p = s->profiling.data; sourceSeq = s->sourceMaps.sourceSeqs[sourceSeqIndex]; for (i = 1; i <= sourceSeq[0]; i++) { sourceIndex = sourceSeq[i]; @@ -123,10 +122,8 @@ } void leaveSourceForProfiling (GC_state s, GC_profileMasterIndex i) { - GC_profileData p; GC_profileStack ps; - p = s->profiling.data; ps = getProfileStackInfo (s, i); assert (ps->numOccurrences > 0); ps->numOccurrences--; @@ -136,7 +133,6 @@ void leaveForProfiling (GC_state s, GC_sourceSeqIndex sourceSeqIndex) { int32_t i; - GC_profileData p; GC_sourceIndex sourceIndex; uint32_t *sourceSeq; @@ -144,7 +140,6 @@ fprintf (stderr, "leaveForProfiling ("FMTSSI")\n", sourceSeqIndex); assert (s->profiling.stack); assert (sourceSeqIndex < s->sourceMaps.sourceSeqsLength); - p = s->profiling.data; sourceSeq = s->sourceMaps.sourceSeqs[sourceSeqIndex]; for (i = sourceSeq[0]; i > 0; i--) { sourceIndex = sourceSeq[i]; |