From 61e57b32a07a3f2d8ed76cf0741c112200620a62 Mon Sep 17 00:00:00 2001 From: Ashton Fagg Date: Fri, 6 Nov 2020 17:27:03 -0500 Subject: [PATCH] Fix tests so they compile with -Werror and -pedantic when on a machine that's not using FCNTL --- test/gtest-extra-test.cc | 2 ++ test/posix-mock-test.cc | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/test/gtest-extra-test.cc b/test/gtest-extra-test.cc index ea728607..80777d9b 100644 --- a/test/gtest-extra-test.cc +++ b/test/gtest-extra-test.cc @@ -22,6 +22,7 @@ namespace { +#if FMT_USE_FCNTL // This is used to suppress coverity warnings about untrusted values. std::string sanitize(const std::string& s) { std::string result; @@ -29,6 +30,7 @@ std::string sanitize(const std::string& s) { result.push_back(static_cast(*i & 0xff)); return result; } +#endif // Tests that assertion macros evaluate their arguments exactly once. class SingleEvaluationTest : public ::testing::Test { diff --git a/test/posix-mock-test.cc b/test/posix-mock-test.cc index eb85756d..2f30e81c 100644 --- a/test/posix-mock-test.cc +++ b/test/posix-mock-test.cc @@ -194,12 +194,12 @@ int(test::fileno)(FILE* stream) { # define EXPECT_EQ_POSIX(expected, actual) #endif +#if FMT_USE_FCNTL static void write_file(fmt::cstring_view filename, fmt::string_view content) { fmt::buffered_file f(filename, "w"); f.print("{}", content); } -#if FMT_USE_FCNTL using fmt::file; TEST(UtilTest, GetPageSize) {