Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build failure when not using fcntl with -Werror #1990

Merged
merged 4 commits into from
Nov 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions test/gtest-extra-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,6 @@

namespace {

// This is used to suppress coverity warnings about untrusted values.
std::string sanitize(const std::string& s) {
std::string result;
for (std::string::const_iterator i = s.begin(), end = s.end(); i != end; ++i)
result.push_back(static_cast<char>(*i & 0xff));
return result;
}

// Tests that assertion macros evaluate their arguments exactly once.
class SingleEvaluationTest : public ::testing::Test {
protected:
Expand Down Expand Up @@ -388,8 +380,8 @@ TEST(OutputRedirectTest, RestoreAndRead) {
std::fprintf(file.get(), "[[[");
OutputRedirect redir(file.get());
std::fprintf(file.get(), "censored");
EXPECT_EQ("censored", sanitize(redir.restore_and_read()));
EXPECT_EQ("", sanitize(redir.restore_and_read()));
EXPECT_EQ("censored", redir.restore_and_read());
EXPECT_EQ("", redir.restore_and_read());
std::fprintf(file.get(), "]]]");
file = buffered_file();
EXPECT_READ(read_end, "[[[]]]");
Expand Down
2 changes: 1 addition & 1 deletion test/posix-mock-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down