Commit f14e7cb7 authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook Github Bot

Support -Werror=unused-function

Summary: Support `-Werror=unused-function`.

Reviewed By: Orvid, guangyfb

Differential Revision: D17252831

fbshipit-source-id: ccf3829ebaa6992341ff5b1ab84c173922eeae03
parent d4b04b02
......@@ -23,6 +23,7 @@
#include <glog/logging.h>
#include <folly/CppAttributes.h>
#include <folly/Portability.h>
#include <folly/String.h>
#include <folly/experimental/exception_tracer/ExceptionAbi.h>
......@@ -107,12 +108,12 @@ namespace {
struct ArmAbiTag {};
struct AnyAbiTag {};
bool isAbiCppException(ArmAbiTag, const char (&klazz)[8]) {
FOLLY_MAYBE_UNUSED bool isAbiCppException(ArmAbiTag, const char (&klazz)[8]) {
return klazz[4] == 'C' && klazz[5] == '+' && klazz[6] == '+' &&
klazz[7] == '\0';
}
bool isAbiCppException(AnyAbiTag, const uint64_t& klazz) {
FOLLY_MAYBE_UNUSED bool isAbiCppException(AnyAbiTag, const uint64_t& klazz) {
// The least significant four bytes must be "C++\0"
static const uint64_t cppClass =
((uint64_t)'C' << 24) | ((uint64_t)'+' << 16) | ((uint64_t)'+' << 8);
......
......@@ -16,6 +16,7 @@
#include <folly/functional/Invoke.h>
#include <folly/CppAttributes.h>
#include <folly/portability/GTest.h>
class InvokeTest : public testing::Test {};
......@@ -72,7 +73,7 @@ char go(Obj const&, char const*) {
namespace z {
struct Obj {};
} // namespace z
float go(z::Obj const&, int) {
FOLLY_MAYBE_UNUSED float go(z::Obj const&, int) {
return 9;
}
......
......@@ -40,13 +40,13 @@ MATCHER_P(LogHandlerMatcherImpl, config, "") {
* A helper function to use in EXPECT_THAT() for matching a TestLogHandler
* with the specified type and options.
*/
auto MatchLogHandler(const LogHandlerConfig& config) {
return LogHandlerMatcherImpl(config);
}
auto MatchLogHandler(
StringPiece type,
std::unordered_map<std::string, std::string> options) {
return LogHandlerMatcherImpl(LogHandlerConfig{type, std::move(options)});
}
auto MatchLogHandler(const LogHandlerConfig& config) {
return LogHandlerMatcherImpl(config);
return MatchLogHandler(LogHandlerConfig{type, std::move(options)});
}
} // namespace
......
......@@ -109,7 +109,9 @@ TEST(Expected, CoroutineFailure) {
co_return z;
}();
EXPECT_TRUE(r1.hasError());
EXPECT_NE(Err::bad(), r1.error());
EXPECT_EQ(Err::badder(), r1.error());
EXPECT_NE(Err::baddest(), r1.error());
}
TEST(Expected, CoroutineException) {
......
......@@ -17,6 +17,7 @@
#include <folly/Poly.h>
#include <folly/Conv.h>
#include <folly/CppAttributes.h>
#include <folly/poly/Nullable.h>
#include <folly/poly/Regular.h>
#include <folly/portability/GTest.h>
......@@ -718,7 +719,7 @@ struct Struct2 : Struct {
int property(Struct const&) {
return 42;
}
void property(Struct&, int) {}
FOLLY_MAYBE_UNUSED void property(Struct&, int) {}
int meow(Struct2&) {
return 42;
......
......@@ -31,6 +31,7 @@
#include <boost/algorithm/string/trim.hpp>
#include <boost/range/concepts.hpp>
#include <folly/CppAttributes.h>
#include <folly/Memory.h>
#include <folly/portability/GMock.h>
#include <folly/portability/GTest.h>
......@@ -1645,7 +1646,7 @@ class NonPOD {
public:
NonPOD() {}
};
void test_func(Range<const NonPOD*>) {}
FOLLY_MAYBE_UNUSED void test_func(Range<const NonPOD*>) {}
} // anonymous namespace
......
......@@ -85,27 +85,6 @@ struct CountCopyCtor {
int CountCopyCtor::gCount_ = 0;
struct Opaque {
int value;
friend bool operator==(Opaque a, Opaque b) {
return a.value == b.value;
}
friend bool operator<(Opaque a, Opaque b) {
return a.value < b.value;
}
struct Compare : std::less<int>, std::less<Opaque> {
using is_transparent = void;
using std::less<int>::operator();
using std::less<Opaque>::operator();
bool operator()(int a, Opaque b) const {
return std::less<int>::operator()(a, b.value);
}
bool operator()(Opaque a, int b) const {
return std::less<int>::operator()(a.value, b);
}
};
};
} // namespace
TEST(SortedVectorTypes, SetAssignmentInitListTest) {
......@@ -605,16 +584,6 @@ TEST(SortedVectorTypes, EraseTest2) {
EXPECT_EQ(m.size(), 5);
}
std::vector<int> extractValues(sorted_vector_set<CountCopyCtor> const& in) {
std::vector<int> ret;
std::transform(
in.begin(),
in.end(),
std::back_inserter(ret),
[](const CountCopyCtor& c) { return c.val_; });
return ret;
}
TEST(SortedVectorTypes, TestSetBulkInsertionSortMerge) {
auto s = std::vector<int>({6, 4, 8, 2});
......
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