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

include/enc: make clang happy #11638

Merged
merged 4 commits into from
Oct 27, 2016
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,15 @@ set(prefix ${CMAKE_INSTALL_PREFIX})
add_definitions("-DCEPH_LIBDIR=\"${CMAKE_INSTALL_FULL_LIBDIR}\"")
add_definitions("-DCEPH_PKGLIBDIR=\"${CMAKE_INSTALL_FULL_PKGLIBDIR}\"")
add_definitions("-DHAVE_CONFIG_H -D__CEPH__ -D_REENTRANT -D_THREAD_SAFE -D__STDC_FORMAT_MACROS")
if(LINUX)
add_definitions("-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64")
endif()

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wtype-limits -Wignored-qualifiers -Winit-self")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wpointer-arith -Werror=format-security -fno-strict-aliasing -fsigned-char")


if(CMAKE_CXX_COMPILER_ID STREQUAL GNU)
add_definitions("-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -rdynamic")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL Clang)
Expand Down
2 changes: 1 addition & 1 deletion src/common/cmdparse.cc
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ cmdmap_from_json(vector<string> cmd, map<string, cmd_vartype> *mapp, stringstrea
// if an empty array is acceptable, the caller should always check for
// vector<string> if the expected value of "vector<int64_t>" in the
// cmdmap is missing.
(*mapp)[it->first] = std::move(vector<string>());
(*mapp)[it->first] = vector<string>();
} else if (spvals.front().type() == json_spirit::str_type) {
vector<string> outv;
for (const auto& sv : spvals) {
Expand Down
26 changes: 13 additions & 13 deletions src/include/denc.h
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ inline void denc_lba(uint64_t& v, bufferptr::iterator& p) {
// denc top-level methods that call into denc_traits<T> methods

template<typename T, typename traits=denc_traits<T>>
inline typename std::enable_if<traits::supported &&
inline typename std::enable_if<traits::supported != 0 &&
!traits::featured>::type denc(
const T& o,
size_t& p,
Expand All @@ -458,7 +458,7 @@ inline typename std::enable_if<traits::supported &&
traits::bound_encode(o, p);
}
template<typename T, typename traits=denc_traits<T>>
inline typename std::enable_if<traits::supported &&
inline typename std::enable_if<traits::supported != 0 &&
traits::featured>::type denc(
const T& o,
size_t& p,
Expand All @@ -468,7 +468,7 @@ inline typename std::enable_if<traits::supported &&
}

template<typename T, typename traits=denc_traits<T>>
inline typename std::enable_if<traits::supported &&
inline typename std::enable_if<traits::supported != 0 &&
!traits::featured>::type denc(
const T& o,
buffer::list::contiguous_appender& p,
Expand All @@ -477,7 +477,7 @@ inline typename std::enable_if<traits::supported &&
traits::encode(o, p);
}
template<typename T, typename traits=denc_traits<T>>
inline typename std::enable_if<traits::supported &&
inline typename std::enable_if<traits::supported != 0 &&
traits::featured>::type denc(
const T& o,
buffer::list::contiguous_appender& p,
Expand All @@ -487,7 +487,7 @@ inline typename std::enable_if<traits::supported &&
}

template<typename T, typename traits=denc_traits<T>>
inline typename std::enable_if<traits::supported &&
inline typename std::enable_if<traits::supported != 0 &&
!traits::featured>::type denc(
T& o,
buffer::ptr::iterator& p,
Expand All @@ -496,7 +496,7 @@ inline typename std::enable_if<traits::supported &&
traits::decode(o, p);
}
template<typename T, typename traits=denc_traits<T>>
inline typename std::enable_if<traits::supported &&
inline typename std::enable_if<traits::supported != 0 &&
traits::featured>::type denc(
T& o,
buffer::ptr::iterator& p,
Expand Down Expand Up @@ -588,8 +588,8 @@ struct denc_traits<bufferlist> {
template<typename A, typename B>
struct denc_traits<
std::pair<A, B>,
typename std::enable_if<denc_traits<A>::supported &&
denc_traits<B>::supported>::type> {
typename std::enable_if<denc_traits<A>::supported != 0 &&
denc_traits<B>::supported != 0>::type> {
typedef denc_traits<A> a_traits;
typedef denc_traits<B> b_traits;

Expand Down Expand Up @@ -640,7 +640,7 @@ struct denc_traits<
template<typename T>
struct denc_traits<
std::list<T>,
typename std::enable_if<denc_traits<T>::supported>::type> {
typename std::enable_if<denc_traits<T>::supported != 0>::type> {
typedef denc_traits<T> traits;

enum { supported = true };
Expand Down Expand Up @@ -722,7 +722,7 @@ struct denc_traits<
template<typename T>
struct denc_traits<
std::vector<T>,
typename std::enable_if<denc_traits<T>::supported>::type> {
typename std::enable_if<denc_traits<T>::supported != 0>::type> {
typedef denc_traits<T> traits;

enum { supported = true };
Expand Down Expand Up @@ -831,7 +831,7 @@ struct denc_traits<
template<typename T>
struct denc_traits<
std::set<T>,
typename std::enable_if<denc_traits<T>::supported>::type> {
typename std::enable_if<denc_traits<T>::supported != 0>::type> {
typedef denc_traits<T> traits;

enum { supported = true };
Expand Down Expand Up @@ -943,8 +943,8 @@ struct denc_traits<
template<typename A, typename B>
struct denc_traits<
std::map<A, B>,
typename std::enable_if<denc_traits<A>::supported &&
denc_traits<B>::supported>::type> {
typename std::enable_if<denc_traits<A>::supported != 0 &&
denc_traits<B>::supported != 0>::type> {
typedef denc_traits<A> a_traits;
typedef denc_traits<B> b_traits;

Expand Down
2 changes: 1 addition & 1 deletion src/msg/async/PosixStack.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class PosixNetworkStack : public NetworkStack {
}
virtual void spawn_worker(unsigned i, std::function<void ()> &&func) override {
threads.resize(i+1);
threads[i] = std::move(std::thread(func));
threads[i] = std::thread(func);
}
virtual void join_worker(unsigned i) override {
assert(threads.size() > i && threads[i].joinable());
Expand Down
2 changes: 2 additions & 0 deletions src/test/encoding.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ TEST(EncodingRoundTrip, StringNewline) {
typedef std::multimap < int, std::string > multimap_t;
typedef multimap_t::value_type my_val_ty;

namespace std {
static std::ostream& operator<<(std::ostream& oss, const multimap_t &multimap)
{
for (multimap_t::const_iterator m = multimap.begin();
Expand All @@ -45,6 +46,7 @@ static std::ostream& operator<<(std::ostream& oss, const multimap_t &multimap)
}
return oss;
}
}

TEST(EncodingRoundTrip, Multimap) {
multimap_t multimap;
Expand Down