Source code
Revision control
Copy as Markdown
Other Tools
# HG changeset patch
# User Christian Holler <choller@mozilla.com>
# Date 1596126946 -7200
# Thu Jul 30 18:35:46 2020 +0200
# Node ID 6c779ec81530b6784a714063af66085681ab7318
# Parent 64e7d096fa77a62b71a306b2c5383b8f75ac4945
[libFuzzer] Suppress warnings about unused return values
diff --git a/FuzzerIO.cpp b/FuzzerIO.cpp
--- a/FuzzerIO.cpp
+++ b/FuzzerIO.cpp
@@ -3,16 +3,17 @@
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// IO functions.
//===----------------------------------------------------------------------===//
+#include "mozilla/Unused.h"
#include "FuzzerDefs.h"
#include "FuzzerExtFunctions.h"
#include "FuzzerIO.h"
#include "FuzzerUtil.h"
#include <algorithm>
#include <cstdarg>
#include <fstream>
#include <iterator>
@@ -68,17 +69,17 @@ void WriteToFile(const std::string &Data
WriteToFile(reinterpret_cast<const uint8_t *>(Data.c_str()), Data.size(),
Path);
}
void WriteToFile(const uint8_t *Data, size_t Size, const std::string &Path) {
// Use raw C interface because this function may be called from a sig handler.
FILE *Out = fopen(Path.c_str(), "wb");
if (!Out) return;
- fwrite(Data, sizeof(Data[0]), Size, Out);
+ mozilla::Unused << fwrite(Data, sizeof(Data[0]), Size, Out);
fclose(Out);
}
void ReadDirToVectorOfUnits(const char *Path, Vector<Unit> *V,
long *Epoch, size_t MaxSize, bool ExitOnError) {
long E = Epoch ? *Epoch : 0;
Vector<std::string> Files;
ListFilesInDirRecursive(Path, Epoch, &Files, /*TopDir*/true);
diff --git a/FuzzerIOPosix.cpp b/FuzzerIOPosix.cpp
--- a/FuzzerIOPosix.cpp
+++ b/FuzzerIOPosix.cpp
@@ -2,16 +2,17 @@
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// IO functions implementation using Posix API.
//===----------------------------------------------------------------------===//
+#include "mozilla/Unused.h"
#include "FuzzerPlatform.h"
#if LIBFUZZER_POSIX || LIBFUZZER_FUCHSIA
#include "FuzzerExtFunctions.h"
#include "FuzzerIO.h"
#include <cstdarg>
#include <cstdio>
#include <dirent.h>
@@ -150,17 +151,17 @@ bool IsInterestingCoverageFile(const std
if (FileName.find("/usr/include/") != std::string::npos)
return false;
if (FileName == "<null>")
return false;
return true;
}
void RawPrint(const char *Str) {
- write(2, Str, strlen(Str));
+ mozilla::Unused << write(2, Str, strlen(Str));
}
void MkDir(const std::string &Path) {
mkdir(Path.c_str(), 0700);
}
void RmDir(const std::string &Path) {
rmdir(Path.c_str());