[commit: ghc] master: rts: Fix "variable set but not used" warning (74c7016)

git at git.haskell.org git at git.haskell.org
Tue Aug 1 12:58:18 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/74c70166dc70486f3535d3c9d12071ea8a447389/ghc

>---------------------------------------------------------------

commit 74c70166dc70486f3535d3c9d12071ea8a447389
Author: Ben Gamari <bgamari.foss at gmail.com>
Date:   Mon Jul 31 22:33:51 2017 -0400

    rts: Fix "variable set but not used" warning
    
    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


>---------------------------------------------------------------

74c70166dc70486f3535d3c9d12071ea8a447389
 rts/RetainerProfile.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/rts/RetainerProfile.c b/rts/RetainerProfile.c
index 6ca09fc..1d5e923 100644
--- a/rts/RetainerProfile.c
+++ b/rts/RetainerProfile.c
@@ -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!



More information about the ghc-commits mailing list