rts: Fix "variable set but not used" warning
authorBen Gamari <bgamari.foss@gmail.com>
Tue, 1 Aug 2017 02:33:51 +0000 (22:33 -0400)
committerBen Gamari <ben@smart-cactus.org>
Tue, 1 Aug 2017 12:57:15 +0000 (08:57 -0400)
gcc complains about this while building with Hadrian,
```
rts/RetainerProfile.c: In function ‘computeRetainerSet’:

rts/RetainerProfile.c:1758:18: error:
     error: variable ‘rtl’ set but not used
[-Werror=unused-but-set-variable]
         RetainerSet *rtl;
                      ^~~
     |
1758 |     RetainerSet *rtl;
     |                  ^
```

Reviewers: austin, erikd, simonmar, Phyx

Reviewed By: Phyx

Subscribers: Phyx, rwbarton, thomie

Differential Revision: https://phabricator.haskell.org/D3801

rts/RetainerProfile.c

index 6ca09fc..1d5e923 100644 (file)
@@ -1755,11 +1755,11 @@ static void
 computeRetainerSet( void )
 {
     StgWeak *weak;
-    RetainerSet *rtl;
     uint32_t g, n;
     StgPtr ml;
     bdescr *bd;
 #if defined(DEBUG_RETAINER)
+    RetainerSet *rtl;
     RetainerSet tmpRetainerSet;
 #endif
 
@@ -1801,9 +1801,9 @@ computeRetainerSet( void )
             for (ml = bd->start; ml < bd->free; ml++) {
 
                 maybeInitRetainerSet((StgClosure *)*ml);
-                rtl = retainerSetOf((StgClosure *)*ml);
 
 #if defined(DEBUG_RETAINER)
+                rtl = retainerSetOf((StgClosure *)*ml);
                 if (rtl == NULL) {
                     // first visit to *ml
                     // This is a violation of the interface rule!