Fixed warnings from -Weffc++
This commit is contained in:
parent
dd8bf7b01c
commit
97fce00391
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
#include <messmer/cpp-utils/macros.h>
|
||||||
|
|
||||||
namespace fspp {
|
namespace fspp {
|
||||||
class Profiler {
|
class Profiler {
|
||||||
@ -14,6 +15,8 @@ namespace fspp {
|
|||||||
private:
|
private:
|
||||||
std::atomic_uint_fast64_t *_targetForAddingNanosec;
|
std::atomic_uint_fast64_t *_targetForAddingNanosec;
|
||||||
std::chrono::high_resolution_clock::time_point _beginTime;
|
std::chrono::high_resolution_clock::time_point _beginTime;
|
||||||
|
|
||||||
|
DISALLOW_COPY_AND_ASSIGN(Profiler);
|
||||||
};
|
};
|
||||||
|
|
||||||
inline Profiler::Profiler(std::atomic_uint_fast64_t *targetForAddingNanosec)
|
inline Profiler::Profiler(std::atomic_uint_fast64_t *targetForAddingNanosec)
|
||||||
|
@ -31,6 +31,8 @@ using std::chrono::seconds;
|
|||||||
|
|
||||||
class Barrier {
|
class Barrier {
|
||||||
public:
|
public:
|
||||||
|
Barrier(): m(), cv(), finished(false) {}
|
||||||
|
|
||||||
template<class A, class B>
|
template<class A, class B>
|
||||||
void WaitAtMost(const duration<A, B> &atMost) {
|
void WaitAtMost(const duration<A, B> &atMost) {
|
||||||
unique_lock<mutex> lock(m);
|
unique_lock<mutex> lock(m);
|
||||||
@ -47,7 +49,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
mutex m;
|
mutex m;
|
||||||
condition_variable cv;
|
condition_variable cv;
|
||||||
bool finished = false;
|
bool finished;
|
||||||
};
|
};
|
||||||
|
|
||||||
class FuseCloseTest: public FuseTest, public WithParamInterface<int> {
|
class FuseCloseTest: public FuseTest, public WithParamInterface<int> {
|
||||||
|
@ -27,14 +27,17 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct FuseOpenFileListTest: public ::testing::Test {
|
struct FuseOpenFileListTest: public ::testing::Test {
|
||||||
const int FILEID1 = 4;
|
static constexpr int FILEID1 = 4;
|
||||||
const int FLAGS1 = 5;
|
static constexpr int FLAGS1 = 5;
|
||||||
const int FILEID2 = 6;
|
static constexpr int FILEID2 = 6;
|
||||||
const int FLAGS2 = 7;
|
static constexpr int FLAGS2 = 7;
|
||||||
const int FILEID3 = 8;
|
static constexpr int FILEID3 = 8;
|
||||||
const int FLAGS3 = 9;
|
static constexpr int FLAGS3 = 9;
|
||||||
|
|
||||||
|
FuseOpenFileListTest(): list() {}
|
||||||
|
|
||||||
FuseOpenFileList list;
|
FuseOpenFileList list;
|
||||||
|
|
||||||
int open(int fileid, int flags) {
|
int open(int fileid, int flags) {
|
||||||
return list.open(make_unique_ref<MockOpenFile>(fileid, flags));
|
return list.open(make_unique_ref<MockOpenFile>(fileid, flags));
|
||||||
}
|
}
|
||||||
|
@ -14,11 +14,14 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct IdListTest: public ::testing::Test {
|
struct IdListTest: public ::testing::Test {
|
||||||
const int OBJ1 = 3;
|
static constexpr int OBJ1 = 3;
|
||||||
const int OBJ2 = 10;
|
static constexpr int OBJ2 = 10;
|
||||||
const int OBJ3 = 8;
|
static constexpr int OBJ3 = 8;
|
||||||
|
|
||||||
|
IdListTest(): list() {}
|
||||||
|
|
||||||
IdList<MyObj> list;
|
IdList<MyObj> list;
|
||||||
|
|
||||||
int add(int num) {
|
int add(int num) {
|
||||||
return list.add(make_unique_ref<MyObj>(num));
|
return list.add(make_unique_ref<MyObj>(num));
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ public:
|
|||||||
|
|
||||||
class FuseTest: public ::testing::Test {
|
class FuseTest: public ::testing::Test {
|
||||||
public:
|
public:
|
||||||
const char* FILENAME = "/myfile";
|
static constexpr const char* FILENAME = "/myfile";
|
||||||
|
|
||||||
FuseTest();
|
FuseTest();
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ using std::string;
|
|||||||
using fspp::fuse::Fuse;
|
using fspp::fuse::Fuse;
|
||||||
|
|
||||||
FuseThread::FuseThread(Fuse *fuse)
|
FuseThread::FuseThread(Fuse *fuse)
|
||||||
:_fuse(fuse) {
|
:_fuse(fuse), _child() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void FuseThread::start(int argc, char *argv[]) {
|
void FuseThread::start(int argc, char *argv[]) {
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#define MESSMER_FSPP_TEST_TESTUTILS_FUSETHREAD_H_
|
#define MESSMER_FSPP_TEST_TESTUTILS_FUSETHREAD_H_
|
||||||
|
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
#include <messmer/cpp-utils/macros.h>
|
||||||
|
|
||||||
namespace fspp {
|
namespace fspp {
|
||||||
namespace fuse {
|
namespace fuse {
|
||||||
@ -19,6 +20,8 @@ public:
|
|||||||
private:
|
private:
|
||||||
fspp::fuse::Fuse *_fuse;
|
fspp::fuse::Fuse *_fuse;
|
||||||
std::thread _child;
|
std::thread _child;
|
||||||
|
|
||||||
|
DISALLOW_COPY_AND_ASSIGN(FuseThread);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user