Commit 32de80f3 authored by neverlord's avatar neverlord

clang compatibility

parent e555bc8f
...@@ -60,8 +60,9 @@ class actor_proxy_cache { ...@@ -60,8 +60,9 @@ class actor_proxy_cache {
std::uint32_t process_id, std::uint32_t process_id,
Fun fun) { Fun fun) {
key_tuple lb{nid, process_id, std::numeric_limits<actor_id>::min()}; key_tuple lb{nid, process_id, std::numeric_limits<actor_id>::min()};
key_tuple ub{nid, process_id, std::numeric_limits<actor_id>::max()}; { key_tuple ub{nid, process_id, std::numeric_limits<actor_id>::max()};
lock_guard<util::shared_spinlock> guard{m_lock}; { // lifetime scope of guard
lock_guard<util::shared_spinlock> guard(m_lock);
auto e = m_entries.end(); auto e = m_entries.end();
auto first = m_entries.lower_bound(lb); auto first = m_entries.lower_bound(lb);
if (first != e) { if (first != e) {
......
...@@ -266,7 +266,7 @@ class default_uniform_type_info_impl : public util::abstract_uniform_type_info<T ...@@ -266,7 +266,7 @@ class default_uniform_type_info_impl : public util::abstract_uniform_type_info<T
template<typename R, class C, typename... Args> template<typename R, class C, typename... Args>
typename std::enable_if<is_invalid<R>::value>::type typename std::enable_if<is_invalid<R>::value>::type
push_back(R C::*mem_ptr, Args&&... args) { push_back(R C::*, Args&&...) {
static_assert(util::is_primitive<R>::value, static_assert(util::is_primitive<R>::value,
"T is neither a primitive type nor a " "T is neither a primitive type nor a "
"stl-compliant list/map"); "stl-compliant list/map");
......
...@@ -35,7 +35,9 @@ ...@@ -35,7 +35,9 @@
namespace cppa { namespace detail { namespace cppa { namespace detail {
struct empty_tuple : abstract_tuple { class empty_tuple : public abstract_tuple {
public:
using abstract_tuple::const_iterator; using abstract_tuple::const_iterator;
......
...@@ -343,7 +343,7 @@ struct match_impl<wildcard_position::multiple, Tuple, Ts...> { ...@@ -343,7 +343,7 @@ struct match_impl<wildcard_position::multiple, Tuple, Ts...> {
}; };
template<class Tuple, class List> template<class Tuple, class List>
class match_impl_from_type_list; struct match_impl_from_type_list;
template<class Tuple, typename... Ts> template<class Tuple, typename... Ts>
struct match_impl_from_type_list<Tuple, util::type_list<Ts...> > { struct match_impl_from_type_list<Tuple, util::type_list<Ts...> > {
......
...@@ -31,6 +31,8 @@ ...@@ -31,6 +31,8 @@
#ifndef VALUE_GUARD_HPP #ifndef VALUE_GUARD_HPP
#define VALUE_GUARD_HPP #define VALUE_GUARD_HPP
#include <type_traits>
#include "cppa/util/rm_ref.hpp" #include "cppa/util/rm_ref.hpp"
#include "cppa/util/void_type.hpp" #include "cppa/util/void_type.hpp"
#include "cppa/util/type_list.hpp" #include "cppa/util/type_list.hpp"
...@@ -69,12 +71,6 @@ class value_guard { ...@@ -69,12 +71,6 @@ class value_guard {
return true; return true;
} }
template<class Tail, typename Arg0, typename... Args>
static inline bool _eval(const util::void_type&, const Tail& tail,
const Arg0&, const Args&... args ) {
return _eval(tail.head, tail.tail(), args...);
}
template<typename T0, typename T1> template<typename T0, typename T1>
static inline bool cmp(const T0& lhs, const T1& rhs) { static inline bool cmp(const T0& lhs, const T1& rhs) {
return lhs == rhs; return lhs == rhs;
...@@ -85,8 +81,8 @@ class value_guard { ...@@ -85,8 +81,8 @@ class value_guard {
return lhs == rhs.get(); return lhs == rhs.get();
} }
template<typename Head, class Tail, typename Arg0, typename... Args> template<typename Head, typename Tail0, typename... Tail, typename Arg0, typename... Args>
static inline bool _eval(const Head& head, const Tail& tail, static inline bool _eval(const Head& head, const tdata<Tail0, Tail...>& tail,
const Arg0& arg0, const Args&... args) { const Arg0& arg0, const Args&... args) {
return cmp(head, arg0) && _eval(tail.head, tail.tail(), args...); return cmp(head, arg0) && _eval(tail.head, tail.tail(), args...);
} }
......
...@@ -40,7 +40,7 @@ namespace cppa { ...@@ -40,7 +40,7 @@ namespace cppa {
// forward declaration of details // forward declaration of details
namespace detail { namespace detail {
template<typename...> class tdata; template<typename...> struct tdata;
template<typename...> struct pseudo_tuple; template<typename...> struct pseudo_tuple;
} }
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include <new> #include <new>
#include <cstdint> #include <cstdint>
#include <typeinfo>
#include <stdexcept> #include <stdexcept>
#include <type_traits> #include <type_traits>
...@@ -102,20 +103,20 @@ class primitive_variant { ...@@ -102,20 +103,20 @@ class primitive_variant {
}; };
// use static call dispatching to select member // use static call dispatching to select member
inline decltype(i8)& get(util::pt_token<pt_int8>) { return i8; } inline auto get(util::pt_token<pt_int8>) -> decltype(i8)& { return i8; }
inline decltype(i16)& get(util::pt_token<pt_int16>) { return i16; } inline auto get(util::pt_token<pt_int16>) -> decltype(i16)& { return i16; }
inline decltype(i32)& get(util::pt_token<pt_int32>) { return i32; } inline auto get(util::pt_token<pt_int32>) -> decltype(i32)& { return i32; }
inline decltype(i64)& get(util::pt_token<pt_int64>) { return i64; } inline auto get(util::pt_token<pt_int64>) -> decltype(i64)& { return i64; }
inline decltype(u8)& get(util::pt_token<pt_uint8>) { return u8; } inline auto get(util::pt_token<pt_uint8>) -> decltype(u8)& { return u8; }
inline decltype(u16)& get(util::pt_token<pt_uint16>) { return u16; } inline auto get(util::pt_token<pt_uint16>) -> decltype(u16)& { return u16; }
inline decltype(u32)& get(util::pt_token<pt_uint32>) { return u32; } inline auto get(util::pt_token<pt_uint32>) -> decltype(u32)& { return u32; }
inline decltype(u64)& get(util::pt_token<pt_uint64>) { return u64; } inline auto get(util::pt_token<pt_uint64>) -> decltype(u64)& { return u64; }
inline decltype(fl)& get(util::pt_token<pt_float>) { return fl; } inline auto get(util::pt_token<pt_float>) -> decltype(fl)& { return fl; }
inline decltype(db)& get(util::pt_token<pt_double>) { return db; } inline auto get(util::pt_token<pt_double>) -> decltype(db)& { return db; }
inline decltype(ldb)& get(util::pt_token<pt_long_double>) { return ldb; } inline auto get(util::pt_token<pt_long_double>) -> decltype(ldb)& { return ldb; }
inline decltype(s8)& get(util::pt_token<pt_u8string>) { return s8; } inline auto get(util::pt_token<pt_u8string>) -> decltype(s8)& { return s8; }
inline decltype(s16)& get(util::pt_token<pt_u16string>) { return s16; } inline auto get(util::pt_token<pt_u16string>) -> decltype(s16)& { return s16; }
inline decltype(s32)& get(util::pt_token<pt_u32string>) { return s32; } inline auto get(util::pt_token<pt_u32string>) -> decltype(s32)& { return s32; }
// get(...) const overload // get(...) const overload
template<primitive_type PT> template<primitive_type PT>
......
...@@ -385,8 +385,8 @@ struct tl_binary_forall { ...@@ -385,8 +385,8 @@ struct tl_binary_forall {
template<class List, template<typename> class Predicate> template<class List, template<typename> class Predicate>
struct tl_exists { struct tl_exists {
static constexpr bool value = static constexpr bool value =
Predicate<class List::head>::value Predicate<typename List::head>::value
|| tl_exists<class List::tail, Predicate>::value; || tl_exists<typename List::tail, Predicate>::value;
}; };
template<template<typename> class Predicate> template<template<typename> class Predicate>
...@@ -402,8 +402,8 @@ struct tl_exists<type_list<>, Predicate> { ...@@ -402,8 +402,8 @@ struct tl_exists<type_list<>, Predicate> {
*/ */
template<class List, template<typename> class Predicate> template<class List, template<typename> class Predicate>
struct tl_count { struct tl_count {
static constexpr size_t value = (Predicate<class List::head>::value ? 1 : 0) static constexpr size_t value = (Predicate<typename List::head>::value ? 1 : 0)
+ tl_count<class List::tail, Predicate>::value; + tl_count<typename List::tail, Predicate>::value;
}; };
template<template<typename> class Predicate> template<template<typename> class Predicate>
...@@ -418,8 +418,8 @@ struct tl_count<type_list<>, Predicate> { ...@@ -418,8 +418,8 @@ struct tl_count<type_list<>, Predicate> {
*/ */
template<class List, template<typename> class Predicate> template<class List, template<typename> class Predicate>
struct tl_count_not { struct tl_count_not {
static constexpr size_t value = (Predicate<class List::head>::value ? 0 : 1) static constexpr size_t value = (Predicate<typename List::head>::value ? 0 : 1)
+ tl_count_not<class List::tail, Predicate>::value; + tl_count_not<typename List::tail, Predicate>::value;
}; };
template<template<typename> class Predicate> template<template<typename> class Predicate>
...@@ -837,7 +837,7 @@ struct tl_is_zipped { ...@@ -837,7 +837,7 @@ struct tl_is_zipped {
template<class List, typename What = void_type> template<class List, typename What = void_type>
struct tl_trim { struct tl_trim {
typedef typename util::if_else< typedef typename util::if_else<
std::is_same<class List::back, What>, std::is_same<typename List::back, What>,
typename tl_trim<typename tl_pop_back<List>::type, What>::type, typename tl_trim<typename tl_pop_back<List>::type, What>::type,
util::wrapped<List> util::wrapped<List>
>::type >::type
......
...@@ -33,23 +33,16 @@ ...@@ -33,23 +33,16 @@
namespace cppa { namespace util { namespace cppa { namespace util {
// forward declaration
template<typename... Types> struct type_list;
struct void_type { struct void_type {
typedef void_type head;
typedef type_list<> tail;
constexpr void_type() { } constexpr void_type() { }
constexpr void_type(const void_type&) { } constexpr void_type(const void_type&) { }
void_type& operator=(const void_type&) = default;
// anything could be used to initialize a void... // anything could be used to initialize a void...
template<typename Arg0, typename... Args> template<typename Arg>
void_type(Arg0&&, Args&&...) { } constexpr void_type(const Arg&) { }
}; };
inline bool operator==(const void_type&, const void_type&) { return true; } inline bool operator==(const void_type&, const void_type&) { return true; }
inline bool operator!=(const void_type&, const void_type&) { return false; }
} } // namespace cppa::util } } // namespace cppa::util
......
...@@ -43,7 +43,7 @@ int main(int, char**) { ...@@ -43,7 +43,7 @@ int main(int, char**) {
assert(announce<foo_pair2>(&foo_pair2::first, &foo_pair2::second) == false); assert(announce<foo_pair2>(&foo_pair2::first, &foo_pair2::second) == false);
// send a foo to ourselves // send a foo to ourselves
send(self, foo{ { 1, 2, 3, 4 }, 5 }); send(self, foo{std::vector<int>{1, 2, 3, 4}, 5});
// send a foo_pair2 to ourselves // send a foo_pair2 to ourselves
send(self, foo_pair2{3, 4}); send(self, foo_pair2{3, 4});
// quits the program // quits the program
......
...@@ -64,7 +64,9 @@ struct exit_observer : cppa::attachable { ...@@ -64,7 +64,9 @@ struct exit_observer : cppa::attachable {
namespace cppa { namespace cppa {
struct scheduler_helper { class scheduler_helper {
public:
typedef intrusive_ptr<detail::converted_thread_context> ptr_type; typedef intrusive_ptr<detail::converted_thread_context> ptr_type;
......
...@@ -72,6 +72,7 @@ void stop_and_kill(std::atomic<T*>& ptr) { ...@@ -72,6 +72,7 @@ void stop_and_kill(std::atomic<T*>& ptr) {
} }
} }
/*
void delete_singletons() { void delete_singletons() {
if (self.unchecked() != nullptr) { if (self.unchecked() != nullptr) {
try { self.unchecked()->quit(exit_reason::normal); } try { self.unchecked()->quit(exit_reason::normal); }
...@@ -91,6 +92,7 @@ void delete_singletons() { ...@@ -91,6 +92,7 @@ void delete_singletons() {
if (et && !et->deref()) delete et; if (et && !et->deref()) delete et;
delete s_uniform_type_info_map.load(); delete s_uniform_type_info_map.load();
} }
*/
template<typename T> template<typename T>
T* lazy_get(std::atomic<T*>& ptr, bool register_atexit_fun = false) { T* lazy_get(std::atomic<T*>& ptr, bool register_atexit_fun = false) {
......
...@@ -30,7 +30,7 @@ template<typename T1, typename T2> ...@@ -30,7 +30,7 @@ template<typename T1, typename T2>
inline bool cppa_check_value_fun(const T1& value1, const T2& value2, inline bool cppa_check_value_fun(const T1& value1, const T2& value2,
char const* file_name, char const* file_name,
int line_number, int line_number,
size_t& error_count) { size_t& error_count) {
if (cppa_check_value_fun_eq(value1, value2) == false) { if (cppa_check_value_fun_eq(value1, value2) == false) {
std::cerr << "ERROR in file " << file_name << " on line " << line_number std::cerr << "ERROR in file " << file_name << " on line " << line_number
<< " => expected value: " << value1 << " => expected value: " << value1
......
...@@ -6,6 +6,12 @@ ...@@ -6,6 +6,12 @@
#include "cppa/cppa.hpp" #include "cppa/cppa.hpp"
namespace cppa {
inline std::ostream& operator<<(std::ostream& out, const atom_value& a) {
return (out << to_string(a));
}
}
using std::cout; using std::cout;
using std::endl; using std::endl;
using std::string; using std::string;
...@@ -13,15 +19,7 @@ using std::string; ...@@ -13,15 +19,7 @@ using std::string;
using namespace cppa; using namespace cppa;
using namespace cppa::util; using namespace cppa::util;
namespace { namespace { constexpr auto s_foo = atom("FooBar"); }
constexpr auto s_foo = atom("FooBar");
inline std::ostream& operator<<(std::ostream& out, const atom_value& a) {
return (out << to_string(a));
}
} // namespace <anonymous>
template<atom_value AtomValue, typename... Types> template<atom_value AtomValue, typename... Types>
void foo() { void foo() {
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
#include "cppa/primitive_variant.hpp" #include "cppa/primitive_variant.hpp"
using namespace cppa;
namespace { namespace {
struct streamer { struct streamer {
...@@ -13,16 +11,25 @@ struct streamer { ...@@ -13,16 +11,25 @@ struct streamer {
void operator()(const T& value) { void operator()(const T& value) {
o << value; o << value;
} }
void operator()(const std::u16string&) {
}
void operator()(const std::u32string&) {
}
}; };
inline std::ostream& operator<<(std::ostream& o, } // namespace <anonymous>
const cppa::primitive_variant& pv) {
namespace cppa {
inline std::ostream& operator<<(std::ostream& o, const primitive_variant& pv) {
streamer s{o}; streamer s{o};
pv.apply(s); pv.apply(s);
return o; return o;
} }
} // namespace cppa
} // namespace <anonymous>
using namespace cppa;
size_t test__primitive_variant() { size_t test__primitive_variant() {
CPPA_TEST(test__primitive_variant); CPPA_TEST(test__primitive_variant);
......
...@@ -87,8 +87,10 @@ bool operator!=(const struct_b& lhs, const struct_b& rhs) { ...@@ -87,8 +87,10 @@ bool operator!=(const struct_b& lhs, const struct_b& rhs) {
return !(lhs == rhs); return !(lhs == rhs);
} }
typedef std::map<std::string, std::u16string> strmap;
struct struct_c { struct struct_c {
std::map<std::string, std::u16string> strings; strmap strings;
std::set<int> ints; std::set<int> ints;
}; };
...@@ -213,7 +215,7 @@ size_t test__serialization() { ...@@ -213,7 +215,7 @@ size_t test__serialization() {
&struct_b::z, &struct_b::z,
&struct_b::ints); &struct_b::ints);
// testees // testees
struct_b b1 = { { 1, 2 }, 3, { 4, 5, 6, 7, 8, 9, 10 } }; struct_b b1 = { { 1, 2 }, 3, std::list<int>{ 4, 5, 6, 7, 8, 9, 10 } };
struct_b b2; struct_b b2;
struct_b b3; struct_b b3;
// expected result of to_string(&b1, meta_b) // expected result of to_string(&b1, meta_b)
...@@ -245,7 +247,7 @@ size_t test__serialization() { ...@@ -245,7 +247,7 @@ size_t test__serialization() {
// get meta type of struct_c and "announce" // get meta type of struct_c and "announce"
announce<struct_c>(&struct_c::strings, &struct_c::ints); announce<struct_c>(&struct_c::strings, &struct_c::ints);
// testees // testees
struct_c c1 = { { { "abc", u"cba" }, { "x", u"y" } }, { 9, 4, 5 } }; struct_c c1{strmap{{"abc", u"cba" }, { "x", u"y" }}, std::set<int>{9, 4, 5}};
struct_c c2; { struct_c c2; {
// serialize c1 to buf // serialize c1 to buf
binary_serializer bs; binary_serializer bs;
......
...@@ -36,10 +36,6 @@ inline bool operator==(const foo& lhs, const foo& rhs) { ...@@ -36,10 +36,6 @@ inline bool operator==(const foo& lhs, const foo& rhs) {
return lhs.value == rhs.value; return lhs.value == rhs.value;
} }
inline bool operator!=(const foo& lhs, const foo& rhs) {
return !(lhs == rhs);
}
} // namespace <anonymous> } // namespace <anonymous>
using namespace cppa; using namespace cppa;
......
...@@ -8,11 +8,7 @@ ...@@ -8,11 +8,7 @@
#include "cppa/util/fiber.hpp" #include "cppa/util/fiber.hpp"
#include "cppa/detail/yield_interface.hpp" #include "cppa/detail/yield_interface.hpp"
using namespace cppa; namespace cppa { namespace detail {
using namespace cppa::util;
using namespace cppa::detail;
namespace {
std::ostream& operator<<(std::ostream& o, yield_state ys) { std::ostream& operator<<(std::ostream& o, yield_state ys) {
switch (ys) { switch (ys) {
...@@ -29,7 +25,11 @@ std::ostream& operator<<(std::ostream& o, yield_state ys) { ...@@ -29,7 +25,11 @@ std::ostream& operator<<(std::ostream& o, yield_state ys) {
} }
} }
} // namespace <anonymous> } } // namespace cppa::detail
using namespace cppa;
using namespace cppa::util;
using namespace cppa::detail;
struct pseudo_worker { struct pseudo_worker {
......
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