From: Gereon Kremer Date: Mon, 26 Apr 2021 20:16:27 +0000 (+0200) Subject: Protect int stats methods (#6442) X-Git-Tag: cvc5-1.0.0~1828 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e9362389e834d97ad2ef2a9c02d6c1fb57239524;p=cvc5.git Protect int stats methods (#6442) This PR protects two methods of the IntStat class in case statistics are disabled. --- diff --git a/src/util/statistics_stats.cpp b/src/util/statistics_stats.cpp index 971c592ac..1ecbf61ce 100644 --- a/src/util/statistics_stats.cpp +++ b/src/util/statistics_stats.cpp @@ -68,17 +68,23 @@ IntStat& IntStat::operator+=(int64_t val) void IntStat::maxAssign(int64_t val) { - if (d_data->d_value < val) + if constexpr (Configuration::isStatisticsBuild()) { - d_data->d_value = val; + if (d_data->d_value < val) + { + d_data->d_value = val; + } } } void IntStat::minAssign(int64_t val) { - if (d_data->d_value > val) + if constexpr (Configuration::isStatisticsBuild()) { - d_data->d_value = val; + if (d_data->d_value > val) + { + d_data->d_value = val; + } } }