From a6e44d3c565e1dbec5e51730a1c4491b46e5c557 Mon Sep 17 00:00:00 2001 From: hellerve Date: Wed, 24 Jan 2018 13:08:46 +0100 Subject: [PATCH] compiler: remove unused variable warning; core: add Statistics usage to Bench, fix ambiguity in Statistics --- core/Bench.carp | 2 ++ core/Statistics.carp | 4 ++-- src/Deftype.hs | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/core/Bench.carp b/core/Bench.carp index 22db7fa1..38c3f02d 100644 --- a/core/Bench.carp +++ b/core/Bench.carp @@ -1,3 +1,5 @@ +(load "Statistics.carp") + (system-include "bench.h") (register get-time-elapsed (Fn [] Double)) diff --git a/core/Statistics.carp b/core/Statistics.carp index 5a39d609..32782652 100644 --- a/core/Statistics.carp +++ b/core/Statistics.carp @@ -27,7 +27,7 @@ total)))) (defn mean [data] - (/ (sum data) (from-int (Array.count data)))) + (/ (Statistics.sum data) (from-int (Array.count data)))) (defn min [a] (let [m (Double.copy (Array.nth a 0))] @@ -184,7 +184,7 @@ (defn summary [samples] (Summary.init - (sum samples) + (Statistics.sum samples) (min samples) (max samples) (mean samples) diff --git a/src/Deftype.hs b/src/Deftype.hs index 8b9780cc..fa2bb344 100644 --- a/src/Deftype.hs +++ b/src/Deftype.hs @@ -226,6 +226,7 @@ templatePrn pathStrings structTy@(StructTy name varTys) [XObj (Arr membersXObjs) , " // convert members to string here:" , " string temp = NULL;" , " int tempsize = 0;" + , " (void)tempsize; // that way we remove the occasional unused warning " , calculateStructStrSize typeEnv env correctedMembers structTy , " string buffer = CARP_MALLOC(size);" , " string bufferPtr = buffer;" @@ -260,6 +261,7 @@ templateStr typeEnv env t@(StructTy typeName _) members = , " // convert members to string here:" , " string temp = NULL;" , " int tempsize = 0;" + , " (void)tempsize; // that way we remove the occasional unused warning " , calculateStructStrSize typeEnv env correctedMembers structTy , " string buffer = CARP_MALLOC(size);" , " string bufferPtr = buffer;"