Typecast covers entire expression to fix format warning.
authorbollu <siddu.druid@gmail.com>
Tue, 14 Feb 2017 13:43:58 +0000 (08:43 -0500)
committerBen Gamari <ben@smart-cactus.org>
Tue, 14 Feb 2017 15:53:01 +0000 (10:53 -0500)
- 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

rts/ProfHeap.c

index d492b89..608b976 100644 (file)
@@ -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;
     }