Eliminate unused variable warnings in the alloc code.  In the places
where unused attributes have been added, arguably, the return code
should be passed up to the caller or, if the return code indicates an
error, we should fast-fail.
diff --git a/vm/Thread.h b/vm/Thread.h
index 964c968..ba9417a 100644
--- a/vm/Thread.h
+++ b/vm/Thread.h
@@ -374,7 +374,8 @@
  */
 INLINE void dvmLockMutex(pthread_mutex_t* pMutex)
 {
-    int cc = pthread_mutex_lock(pMutex);
+    int cc __attribute__ ((__unused__));
+    cc = pthread_mutex_lock(pMutex);
     assert(cc == 0);
 }
 
@@ -391,7 +392,8 @@
  */
 INLINE void dvmUnlockMutex(pthread_mutex_t* pMutex)
 {
-    int cc = pthread_mutex_unlock(pMutex);
+    int cc __attribute__ ((__unused__));
+    cc = pthread_mutex_unlock(pMutex);
     assert(cc == 0);
 }
 
@@ -400,7 +402,8 @@
  */
 INLINE void dvmDestroyMutex(pthread_mutex_t* pMutex)
 {
-    int cc = pthread_mutex_destroy(pMutex);
+    int cc __attribute__ ((__unused__));
+    cc  = pthread_mutex_destroy(pMutex);
     assert(cc == 0);
 }
 
diff --git a/vm/alloc/Heap.c b/vm/alloc/Heap.c
index 8178489..de43ecf 100644
--- a/vm/alloc/Heap.c
+++ b/vm/alloc/Heap.c
@@ -211,7 +211,6 @@
 Object *dvmGetNextHeapWorkerObject(HeapWorkerOperation *op)
 {
     Object *obj;
-    LargeHeapRefTable *table;
     GcHeap *gcHeap = gDvm.gcHeap;
 
     assert(op != NULL);
@@ -496,7 +495,6 @@
     GcHeap *gcHeap = gDvm.gcHeap;
     DvmHeapChunk *hc;
     void *ptr;
-    bool triedGc, triedGrowing;
 
 #if 0
     /* handy for spotting large allocations */
@@ -551,7 +549,6 @@
      */
     hc = tryMalloc(size);
     if (hc != NULL) {
-alloc_succeeded:
         /* We've got the memory.
          */
         if ((flags & ALLOC_FINALIZABLE) != 0) {
diff --git a/vm/alloc/HeapDebug.c b/vm/alloc/HeapDebug.c
index 54b5cb6..86d5833 100644
--- a/vm/alloc/HeapDebug.c
+++ b/vm/alloc/HeapDebug.c
@@ -110,14 +110,12 @@
 
 void dvmLogGcStats(size_t numFreed, size_t sizeFreed, size_t gcTimeMs)
 {
-    const GcHeap *gcHeap = gDvm.gcHeap;
     size_t perHeapActualSize[HEAP_SOURCE_MAX_HEAP_COUNT],
            perHeapAllowedSize[HEAP_SOURCE_MAX_HEAP_COUNT],
            perHeapNumAllocated[HEAP_SOURCE_MAX_HEAP_COUNT],
            perHeapSizeAllocated[HEAP_SOURCE_MAX_HEAP_COUNT];
     unsigned char eventBuf[1 + (1 + sizeof(long long)) * 4];
     size_t actualSize, allowedSize, numAllocated, sizeAllocated;
-    size_t i;
     size_t softLimit = dvmHeapSourceGetIdealFootprint();
     size_t nHeaps = dvmHeapSourceGetNumHeaps();
 
diff --git a/vm/alloc/HeapSource.c b/vm/alloc/HeapSource.c
index 209c72d..4a31a53 100644
--- a/vm/alloc/HeapSource.c
+++ b/vm/alloc/HeapSource.c
@@ -389,7 +389,6 @@
 {
     GcHeap *gcHeap;
     HeapSource *hs;
-    Heap *heap;
     mspace msp;
     size_t length;
     void *base;
@@ -1063,8 +1062,6 @@
 static void
 snapIdealFootprint()
 {
-    HeapSource *hs = gHs;
-
     HS_BOILERPLATE();
 
     setIdealFootprint(getSoftFootprint(true));
@@ -1090,7 +1087,6 @@
 void dvmSetTargetHeapUtilization(float newTarget)
 {
     HeapSource *hs = gHs;
-    size_t newUtilization;
 
     HS_BOILERPLATE();
 
@@ -1164,8 +1160,7 @@
  * targetUtilization is in the range 1..HEAP_UTILIZATION_MAX.
  */
 static size_t
-getUtilizationTarget(const HeapSource *hs,
-        size_t liveSize, size_t targetUtilization)
+getUtilizationTarget(size_t liveSize, size_t targetUtilization)
 {
     size_t targetSize;
 
@@ -1228,7 +1223,7 @@
     currentHeapUsed += hs->externalBytesAllocated;
 #endif
     targetHeapSize =
-            getUtilizationTarget(hs, currentHeapUsed, hs->targetUtilization);
+            getUtilizationTarget(currentHeapUsed, hs->targetUtilization);
 #if LET_EXTERNAL_INFLUENCE_UTILIZATION
     currentHeapUsed -= hs->externalBytesAllocated;
     targetHeapSize -= hs->externalBytesAllocated;
@@ -1420,12 +1415,6 @@
 static bool
 externalAlloc(HeapSource *hs, size_t n, bool grow)
 {
-    Heap *heap;
-    size_t currentHeapSize;
-    size_t newTotal;
-    size_t max;
-    bool grew;
-
     assert(hs->externalLimit >= hs->externalBytesAllocated);
 
     HSTRACE("externalAlloc(%zd%s)\n", n, grow ? ", grow" : "");
@@ -1455,7 +1444,7 @@
 
     /* GROW */
     hs->externalBytesAllocated += n;
-    hs->externalLimit = getUtilizationTarget(hs,
+    hs->externalLimit = getUtilizationTarget(
             hs->externalBytesAllocated, EXTERNAL_TARGET_UTILIZATION);
     HSTRACE("EXTERNAL grow limit to %zd\n", hs->externalLimit);
     return true;
@@ -1487,7 +1476,6 @@
 dvmTrackExternalAllocation(size_t n)
 {
     HeapSource *hs = gHs;
-    size_t overhead;
     bool ret = false;
 
     /* gHs caches an entry in gDvm.gcHeap;  we need to hold the
@@ -1570,7 +1558,6 @@
 dvmTrackExternalFree(size_t n)
 {
     HeapSource *hs = gHs;
-    size_t newIdealSize;
     size_t newExternalLimit;
     size_t oldExternalBytesAllocated;
 
@@ -1607,7 +1594,7 @@
 
     /* Shrink as quickly as we can.
      */
-    newExternalLimit = getUtilizationTarget(hs,
+    newExternalLimit = getUtilizationTarget(
             hs->externalBytesAllocated, EXTERNAL_TARGET_UTILIZATION);
     if (newExternalLimit < oldExternalBytesAllocated) {
         /* Make sure that the remaining free space is at least
diff --git a/vm/alloc/HeapTable.c b/vm/alloc/HeapTable.c
index b56de64..61a88ec 100644
--- a/vm/alloc/HeapTable.c
+++ b/vm/alloc/HeapTable.c
@@ -38,10 +38,7 @@
 }
 
 #define heapRefTableIsFull(refs) \
-    ({ \
-        const HeapRefTable *HRTIF_refs = (refs); \
-        dvmIsReferenceTableFull(refs); \
-    })
+    dvmIsReferenceTableFull(refs)
 
 bool dvmHeapInitHeapRefTable(HeapRefTable *refs, size_t nelems)
 {
@@ -173,7 +170,6 @@
     obj = NULL;
     table = *pTable;
     if (table != NULL) {
-        GcHeap *gcHeap = gDvm.gcHeap;
         HeapRefTable *refs = &table->refs;
 
         /* We should never have an empty table node in the list.
diff --git a/vm/alloc/HeapTable.h b/vm/alloc/HeapTable.h
index 784e8fd..a49bea9 100644
--- a/vm/alloc/HeapTable.h
+++ b/vm/alloc/HeapTable.h
@@ -41,10 +41,7 @@
             dvmAddToReferenceTable((refs), (ptr))
 
 #define dvmHeapNumHeapRefTableEntries(refs) \
-    ({ \
-        const HeapRefTable *NHRTE_refs = (refs); \
-        dvmReferenceTableEntries(refs); \
-    })
+            dvmReferenceTableEntries(refs)
 
 #define dvmHeapRemoveFromHeapRefTable(refs, ptr) \
             dvmRemoveFromReferenceTable((refs), (refs)->table, (ptr))
diff --git a/vm/alloc/HeapWorker.c b/vm/alloc/HeapWorker.c
index 228be5a..4c26a2f 100644
--- a/vm/alloc/HeapWorker.c
+++ b/vm/alloc/HeapWorker.c
@@ -76,7 +76,8 @@
      * so this should not get stuck.
      */
     while (!gDvm.heapWorkerReady) {
-        int cc = pthread_cond_wait(&gDvm.heapWorkerCond, &gDvm.heapWorkerLock);
+        int cc __attribute__ ((__unused__));
+        cc = pthread_cond_wait(&gDvm.heapWorkerCond, &gDvm.heapWorkerLock);
         assert(cc == 0);
     }
 
@@ -128,11 +129,6 @@
         u8 now = dvmGetRelativeTimeUsec();
         u8 delta = now - heapWorkerInterpStartTime;
 
-        u8 heapWorkerInterpCpuStartTime =
-            gDvm.gcHeap->heapWorkerInterpCpuStartTime;
-        u8 nowCpu = dvmGetOtherThreadCpuTimeUsec(gDvm.heapWorkerHandle);
-        u8 deltaCpu = nowCpu - heapWorkerInterpCpuStartTime;
-
         if (delta > HEAP_WORKER_WATCHDOG_TIMEOUT &&
             (gDvm.debuggerActive || gDvm.nativeDebuggerActive))
         {
@@ -468,12 +464,11 @@
          * context switch.
          */
     } else {
-        struct timeval now;
-
 #ifdef HAVE_TIMEDWAIT_MONOTONIC
         clock_gettime(CLOCK_MONOTONIC, &timeout);
         timeout.tv_sec += timeoutSec;
 #else
+        struct timeval now;
         gettimeofday(&now, NULL);
         timeout.tv_sec = now.tv_sec + timeoutSec;
         timeout.tv_nsec = now.tv_usec * 1000;
diff --git a/vm/alloc/MarkSweep.c b/vm/alloc/MarkSweep.c
index 6f41f88..979209b 100644
--- a/vm/alloc/MarkSweep.c
+++ b/vm/alloc/MarkSweep.c
@@ -857,8 +857,6 @@
             }
 
             if (schedEnqueue) {
-                uintptr_t workBits;
-
                 /* Stuff the enqueue bit in the bottom of the pointer.
                  * Assumes that objects are 8-byte aligned.
                  *
@@ -1061,8 +1059,6 @@
 
 void dvmHeapFinishMarkStep()
 {
-    HeapBitmap *markBitmap;
-    HeapBitmap objectBitmap;
     GcMarkContext *markContext;
 
     markContext = &gDvm.gcHeap->markContext;