[commit: ghc] master: Typecast covers entire expression to fix format warning. (60c4986)

git at git.haskell.org git at git.haskell.org
Tue Feb 14 15:54:40 UTC 2017


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/60c49861465015659a25542692b6d259667759e5/ghc

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

commit 60c49861465015659a25542692b6d259667759e5
Author: bollu <siddu.druid at gmail.com>
Date:   Tue Feb 14 08:43:58 2017 -0500

    Typecast covers entire expression to fix format warning.
    
    - Fixes (#12636).
    - changes all the typecasts to _unsinged long long_ to
      have the format specifiers work.
    
    Reviewers: austin, bgamari, erikd, simonmar, Phyx
    
    Reviewed By: erikd, Phyx
    
    Subscribers: thomie
    
    Differential Revision: https://phabricator.haskell.org/D3129


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

60c49861465015659a25542692b6d259667759e5
 rts/ProfHeap.c | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/rts/ProfHeap.c b/rts/ProfHeap.c
index d492b89..608b976 100644
--- a/rts/ProfHeap.c
+++ b/rts/ProfHeap.c
@@ -770,17 +770,22 @@ dumpCensus( Census *census )
     traceHeapProfSampleBegin(era);
 
 #ifdef PROFILING
+    /* change typecast to uint64_t to remove
+     * print formatting warning. See #12636 */
     if (RtsFlags.ProfFlags.doHeapProfile == HEAP_BY_LDV) {
-        fprintf(hp_file, "VOID\t%lu\n",
-                (unsigned long)(census->void_total) * sizeof(W_));
-        fprintf(hp_file, "LAG\t%lu\n",
-                (unsigned long)(census->not_used - census->void_total) * sizeof(W_));
-        fprintf(hp_file, "USE\t%lu\n",
-                (unsigned long)(census->used - census->drag_total) * sizeof(W_));
-        fprintf(hp_file, "INHERENT_USE\t%lu\n",
-                (unsigned long)(census->prim) * sizeof(W_));
-        fprintf(hp_file, "DRAG\t%lu\n",
-                (unsigned long)(census->drag_total) * sizeof(W_));
+        fprintf(hp_file, "VOID\t%" FMT_Word64 "\n",
+                (uint64_t)(census->void_total *
+                                     sizeof(W_)));
+        fprintf(hp_file, "LAG\t%" FMT_Word64 "\n",
+                (uint64_t)((census->not_used - census->void_total) *
+                                     sizeof(W_)));
+        fprintf(hp_file, "USE\t%" FMT_Word64 "\n",
+                (uint64_t)((census->used - census->drag_total) *
+                                     sizeof(W_)));
+        fprintf(hp_file, "INHERENT_USE\t%" FMT_Word64 "\n",
+                (uint64_t)(census->prim * sizeof(W_)));
+        fprintf(hp_file, "DRAG\t%" FMT_Word64 "\n",
+                (uint64_t)(census->drag_total * sizeof(W_)));
         printSample(false, census->time);
         return;
     }



More information about the ghc-commits mailing list