Unverified Commit a8b36933 by Roman Lebedev Committed by GitHub

Merge pull request #905 from LebedevRI/misc-cleanup

Fix some issues seen in some static analysis reports
parents c50ac68c 51d991f1
...@@ -204,7 +204,7 @@ def root(location = None, arch = None, version = None, threading = None, ...@@ -204,7 +204,7 @@ def root(location = None, arch = None, version = None, threading = None,
exceptions = 'sjlj' exceptions = 'sjlj'
else: else:
exceptions = keys[0] exceptions = keys[0]
if revision == None: if revision is None:
revision = max(versions[version][arch][threading][exceptions].keys()) revision = max(versions[version][arch][threading][exceptions].keys())
if not location: if not location:
location = os.path.join(tempfile.gettempdir(), 'mingw-builds') location = os.path.join(tempfile.gettempdir(), 'mingw-builds')
......
...@@ -435,7 +435,7 @@ void ParseCommandLineFlags(int* argc, char** argv) { ...@@ -435,7 +435,7 @@ void ParseCommandLineFlags(int* argc, char** argv) {
using namespace benchmark; using namespace benchmark;
BenchmarkReporter::Context::executable_name = BenchmarkReporter::Context::executable_name =
(argc && *argc > 0) ? argv[0] : "unknown"; (argc && *argc > 0) ? argv[0] : "unknown";
for (int i = 1; i < *argc; ++i) { for (int i = 1; argc && i < *argc; ++i) {
if (ParseBoolFlag(argv[i], "benchmark_list_tests", if (ParseBoolFlag(argv[i], "benchmark_list_tests",
&FLAGS_benchmark_list_tests) || &FLAGS_benchmark_list_tests) ||
ParseStringFlag(argv[i], "benchmark_filter", &FLAGS_benchmark_filter) || ParseStringFlag(argv[i], "benchmark_filter", &FLAGS_benchmark_filter) ||
......
...@@ -264,7 +264,7 @@ class BenchmarkRunner { ...@@ -264,7 +264,7 @@ class BenchmarkRunner {
// So what seems to be the sufficiently-large iteration count? Round up. // So what seems to be the sufficiently-large iteration count? Round up.
const IterationCount max_next_iters = const IterationCount max_next_iters =
0.5 + std::max(multiplier * i.iters, i.iters + 1.0); std::lround(std::max(multiplier * i.iters, i.iters + 1.0));
// But we do have *some* sanity limits though.. // But we do have *some* sanity limits though..
const IterationCount next_iters = std::min(max_next_iters, kMaxIterations); const IterationCount next_iters = std::min(max_next_iters, kMaxIterations);
......
...@@ -12,6 +12,9 @@ ...@@ -12,6 +12,9 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
#ifndef COUNTER_H_
#define COUNTER_H_
#include "benchmark/benchmark.h" #include "benchmark/benchmark.h"
namespace benchmark { namespace benchmark {
...@@ -25,3 +28,5 @@ bool SameNames(UserCounters const& l, UserCounters const& r); ...@@ -25,3 +28,5 @@ bool SameNames(UserCounters const& l, UserCounters const& r);
} // end namespace internal } // end namespace internal
} // end namespace benchmark } // end namespace benchmark
#endif // COUNTER_H_
...@@ -92,7 +92,7 @@ std::string FormatKV(std::string const& key, double value) { ...@@ -92,7 +92,7 @@ std::string FormatKV(std::string const& key, double value) {
return ss.str(); return ss.str();
} }
int64_t RoundDouble(double v) { return static_cast<int64_t>(v + 0.5); } int64_t RoundDouble(double v) { return std::lround(v); }
} // end namespace } // end namespace
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment