Fixed warnings from -Weffc++

This commit is contained in:
Sebastian Meßmer 2015-10-17 20:35:17 +02:00
parent dd8bf7b01c
commit 97fce00391
7 changed files with 26 additions and 12 deletions

View File

@ -4,6 +4,7 @@
#include <atomic>
#include <chrono>
#include <messmer/cpp-utils/macros.h>
namespace fspp {
class Profiler {
@ -14,6 +15,8 @@ namespace fspp {
private:
std::atomic_uint_fast64_t *_targetForAddingNanosec;
std::chrono::high_resolution_clock::time_point _beginTime;
DISALLOW_COPY_AND_ASSIGN(Profiler);
};
inline Profiler::Profiler(std::atomic_uint_fast64_t *targetForAddingNanosec)

View File

@ -31,6 +31,8 @@ using std::chrono::seconds;
class Barrier {
public:
Barrier(): m(), cv(), finished(false) {}
template<class A, class B>
void WaitAtMost(const duration<A, B> &atMost) {
unique_lock<mutex> lock(m);
@ -47,7 +49,7 @@ public:
private:
mutex m;
condition_variable cv;
bool finished = false;
bool finished;
};
class FuseCloseTest: public FuseTest, public WithParamInterface<int> {

View File

@ -27,14 +27,17 @@ public:
};
struct FuseOpenFileListTest: public ::testing::Test {
const int FILEID1 = 4;
const int FLAGS1 = 5;
const int FILEID2 = 6;
const int FLAGS2 = 7;
const int FILEID3 = 8;
const int FLAGS3 = 9;
static constexpr int FILEID1 = 4;
static constexpr int FLAGS1 = 5;
static constexpr int FILEID2 = 6;
static constexpr int FLAGS2 = 7;
static constexpr int FILEID3 = 8;
static constexpr int FLAGS3 = 9;
FuseOpenFileListTest(): list() {}
FuseOpenFileList list;
int open(int fileid, int flags) {
return list.open(make_unique_ref<MockOpenFile>(fileid, flags));
}

View File

@ -14,11 +14,14 @@ public:
};
struct IdListTest: public ::testing::Test {
const int OBJ1 = 3;
const int OBJ2 = 10;
const int OBJ3 = 8;
static constexpr int OBJ1 = 3;
static constexpr int OBJ2 = 10;
static constexpr int OBJ3 = 8;
IdListTest(): list() {}
IdList<MyObj> list;
int add(int num) {
return list.add(make_unique_ref<MyObj>(num));
}

View File

@ -84,7 +84,7 @@ public:
class FuseTest: public ::testing::Test {
public:
const char* FILENAME = "/myfile";
static constexpr const char* FILENAME = "/myfile";
FuseTest();

View File

@ -12,7 +12,7 @@ using std::string;
using fspp::fuse::Fuse;
FuseThread::FuseThread(Fuse *fuse)
:_fuse(fuse) {
:_fuse(fuse), _child() {
}
void FuseThread::start(int argc, char *argv[]) {

View File

@ -3,6 +3,7 @@
#define MESSMER_FSPP_TEST_TESTUTILS_FUSETHREAD_H_
#include <thread>
#include <messmer/cpp-utils/macros.h>
namespace fspp {
namespace fuse {
@ -19,6 +20,8 @@ public:
private:
fspp::fuse::Fuse *_fuse;
std::thread _child;
DISALLOW_COPY_AND_ASSIGN(FuseThread);
};
#endif