diff options
author | Kirk Shoop <kirk.shoop@microsoft.com> | 2014-10-02 21:06:29 -0700 |
---|---|---|
committer | Kirk Shoop <kirk.shoop@microsoft.com> | 2014-10-02 21:06:29 -0700 |
commit | 00766799d6950706167af26fe2e344f744b509ab (patch) | |
tree | 6d47c7d389c0ceb9c9665a7ee3ddd51507f10aee | |
parent | 8160e1a40216a8159120d933a2a3c077321d633a (diff) | |
download | RxCpp-00766799d6950706167af26fe2e344f744b509ab.tar.gz |
increases warning level, fixes warnings
temporarily removes combine_latest
probably breaks clang and gcc compilation
both must be fixed before pushing to master
-rw-r--r-- | Rx/v2/src/rxcpp/rx-observable.hpp | 47 | ||||
-rw-r--r-- | Rx/v2/src/rxcpp/schedulers/rx-test.hpp | 12 | ||||
-rw-r--r-- | projects/CMake/CMakeLists.txt | 19 |
3 files changed, 45 insertions, 33 deletions
diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index 1561c8e..10836ff 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -341,7 +341,7 @@ private: if (rxsc::current_thread::is_schedule_required()) { const auto& sc = rxsc::make_current_thread(); sc.create_worker(o.get_subscription()).schedule( - [&](const rxsc::schedulable& scbl) { + [&](const rxsc::schedulable&) { safe_subscribe(); }); } else { @@ -820,14 +820,23 @@ public: rxo::detail::concat_map<this_type, CollectionSelector, ResultSelector, Coordination>(*this, std::forward<CollectionSelector>(s), std::forward<ResultSelector>(rs), std::forward<Coordination>(sf))); } +#if 0 + template<class Coordination, class Selector, class T, class C = rxu::types_checked> + struct defer_combine_latest : public defer_observable<std::false_type, void, rxo::detail::map>{}; +#if 0 template<class Coordination, class Selector, class... ObservableN> - struct defer_combine_latest : public defer_observable< - rxu::all_true<is_coordination<Coordination>::value, !is_coordination<Selector>::value, !is_observable<Selector>::value, is_observable<ObservableN>::value...>, - this_type, - rxo::detail::combine_latest, Coordination, Selector, ObservableN...> + struct defer_combine_latest< + Coordination, + Selector, + rxu::types<ObservableN...>, + typename rxu::types_checked_from<typename Coordination::coordination_tag>::type> : + public defer_observable< + rxu::all_true<is_coordination<Coordination>::value, !is_coordination<Selector>::value, !is_observable<Selector>::value, is_observable<ObservableN>::value...>, + this_type, + rxo::detail::combine_latest, Coordination, Selector, ObservableN...> { }; - +#endif /// combine_latest -> /// All sources must be synchronized! This means that calls across all the subscribers must be serial. /// for each item from all of the observables use the Selector to select a value to emit from the new observable that is returned. @@ -835,9 +844,9 @@ public: template<class Selector, class... ObservableN> auto combine_latest(Selector&& s, ObservableN... on) const -> typename std::enable_if< - defer_combine_latest<identity_one_worker, Selector, this_type, ObservableN...>::value, - typename defer_combine_latest<identity_one_worker, Selector, this_type, ObservableN...>::observable_type>::type { - return defer_combine_latest<identity_one_worker, Selector, this_type, ObservableN...>::make(*this, identity_current_thread(), std::forward<Selector>(s), std::make_tuple(*this, on...)); + defer_combine_latest<identity_one_worker, Selector, this_type, rxu::types<ObservableN...>>::value, + typename defer_combine_latest<identity_one_worker, Selector, this_type, rxu::types<ObservableN...>>::observable_type>::type { + return defer_combine_latest<identity_one_worker, Selector, this_type, rxu::types<ObservableN...>>::make(*this, identity_current_thread(), std::forward<Selector>(s), std::make_tuple(*this, on...)); } /// combine_latest -> @@ -847,9 +856,9 @@ public: template<class Coordination, class Selector, class... ObservableN> auto combine_latest(Coordination cn, Selector&& s, ObservableN... on) const -> typename std::enable_if< - defer_combine_latest<Coordination, Selector, this_type, ObservableN...>::value, - typename defer_combine_latest<Coordination, Selector, this_type, ObservableN...>::observable_type>::type { - return defer_combine_latest<Coordination, Selector, this_type, ObservableN...>::make(*this, std::move(cn), std::forward<Selector>(s), std::make_tuple(*this, on...)); + defer_combine_latest<Coordination, Selector, this_type, rxu::types<ObservableN...>>::value, + typename defer_combine_latest<Coordination, Selector, this_type, rxu::types<ObservableN...>>::observable_type>::type { + return defer_combine_latest<Coordination, Selector, this_type, rxu::types<ObservableN...>>::make(*this, std::move(cn), std::forward<Selector>(s), std::make_tuple(*this, on...)); } /// combine_latest -> @@ -859,9 +868,9 @@ public: template<class... ObservableN> auto combine_latest(ObservableN... on) const -> typename std::enable_if< - defer_combine_latest<identity_one_worker, rxu::detail::pack, this_type, ObservableN...>::value, - typename defer_combine_latest<identity_one_worker, rxu::detail::pack, this_type, ObservableN...>::observable_type>::type { - return defer_combine_latest<identity_one_worker, rxu::detail::pack, this_type, ObservableN...>::make(*this, identity_current_thread(), rxu::pack(), std::make_tuple(*this, on...)); + defer_combine_latest<identity_one_worker, rxu::detail::pack, this_type, rxu::types<ObservableN...>>::value, + typename defer_combine_latest<identity_one_worker, rxu::detail::pack, this_type, rxu::types<ObservableN...>>::observable_type>::type { + return defer_combine_latest<identity_one_worker, rxu::detail::pack, this_type, rxu::types<ObservableN...>>::make(*this, identity_current_thread(), rxu::pack(), std::make_tuple(*this, on...)); } /// combine_latest -> @@ -871,11 +880,11 @@ public: template<class Coordination, class... ObservableN> auto combine_latest(Coordination cn, ObservableN... on) const -> typename std::enable_if< - defer_combine_latest<Coordination, rxu::detail::pack, this_type, ObservableN...>::value, - typename defer_combine_latest<Coordination, rxu::detail::pack, this_type, ObservableN...>::observable_type>::type { - return defer_combine_latest<Coordination, rxu::detail::pack, this_type, ObservableN...>::make(*this, std::move(cn), rxu::pack(), std::make_tuple(*this, on...)); + defer_combine_latest<Coordination, rxu::detail::pack, this_type, rxu::types<ObservableN...>>::value, + typename defer_combine_latest<Coordination, rxu::detail::pack, this_type, rxu::types<ObservableN...>>::observable_type>::type { + return defer_combine_latest<Coordination, rxu::detail::pack, this_type, rxu::types<ObservableN...>>::make(*this, std::move(cn), rxu::pack(), std::make_tuple(*this, on...)); } - +#endif /// group_by -> /// template<class KeySelector, class MarbleSelector, class BinaryPredicate> diff --git a/Rx/v2/src/rxcpp/schedulers/rx-test.hpp b/Rx/v2/src/rxcpp/schedulers/rx-test.hpp index ec77c40..331bea9 100644 --- a/Rx/v2/src/rxcpp/schedulers/rx-test.hpp +++ b/Rx/v2/src/rxcpp/schedulers/rx-test.hpp @@ -174,7 +174,7 @@ public: abort(); } virtual std::vector<rxn::subscription> subscriptions() const { - abort(); return std::vector<rxn::subscription>(); + abort(); } virtual std::vector<recorded_type> messages() const { @@ -247,7 +247,7 @@ public: auto n = message.value(); sc->schedule_relative(message.time(), make_schedulable( controller, - [n, o](const schedulable& scbl) { + [n, o](const schedulable&) { if (o.is_subscribed()) { n->accept(o); } @@ -300,7 +300,7 @@ public: auto n = message.value(); sc->schedule_absolute(message.time(), make_schedulable( controller, - [this, n](const schedulable& scbl) { + [this, n](const schedulable&) { auto local = this->observers; for (auto& o : local) { if (o.is_subscribed()) { @@ -471,13 +471,13 @@ public: }; std::shared_ptr<state_type> state(new state_type(this->make_subscriber<T>())); - schedule_absolute(created, [createSource, state](const schedulable& scbl) { + schedule_absolute(created, [createSource, state](const schedulable&) { state->source.reset(new typename state_type::source_type(createSource())); }); - schedule_absolute(subscribed, [state](const schedulable& scbl) { + schedule_absolute(subscribed, [state](const schedulable&) { state->source->subscribe(state->o); }); - schedule_absolute(unsubscribed, [state](const schedulable& scbl) { + schedule_absolute(unsubscribed, [state](const schedulable&) { state->o.unsubscribe(); }); diff --git a/projects/CMake/CMakeLists.txt b/projects/CMake/CMakeLists.txt index ae8dd39..b94247c 100644 --- a/projects/CMake/CMakeLists.txt +++ b/projects/CMake/CMakeLists.txt @@ -7,11 +7,16 @@ MESSAGE( STATUS "CMAKE_CXX_COMPILER_ID: " ${CMAKE_CXX_COMPILER_ID} ) FIND_PACKAGE(Threads) if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - list( APPEND CMAKE_CXX_FLAGS " -std=c++11 -ftemplate-depth=1024 ${CMAKE_CXX_FLAGS}") + add_compile_options( -Wall -Wextra -Werror ) + add_compile_options( -std=c++11 ) + add_compile_options( -ftemplate-depth=1024 ) # sometimes you just do what the compiler tells you elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") - list( APPEND CMAKE_CXX_FLAGS " -std=c++11 ${CMAKE_CXX_FLAGS}") + add_compile_options( -Wall -Wextra -Werror ) + add_compile_options( -std=c++11 ) elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") - list( APPEND CMAKE_CXX_FLAGS " /DUNICODE /D_UNICODE /bigobj ${CMAKE_CXX_FLAGS}") + add_compile_options( /W4 /WX ) + add_compile_options( /wd4503 ) # truncated symbol + add_definitions( /DUNICODE /D_UNICODE ) # it is a new millenium endif() @@ -21,10 +26,8 @@ get_filename_component(RXCPP_DIR "${RXCPP_DIR}" PATH) MESSAGE( STATUS "RXCPP_DIR: " ${RXCPP_DIR} ) - include_directories(${RXCPP_DIR}/ext/catch/include ${RXCPP_DIR}/Ix/CPP/src ${RXCPP_DIR}/Rx/v2/src) - set(TEST_DIR ${RXCPP_DIR}/Rx/v2/test) # define the sources of the self test @@ -38,8 +41,8 @@ set(TEST_SOURCES ${TEST_DIR}/sources/interval.cpp ${TEST_DIR}/sources/scope.cpp ${TEST_DIR}/operators/buffer.cpp - ${TEST_DIR}/operators/combine_latest.1.cpp - ${TEST_DIR}/operators/combine_latest.2.cpp + #${TEST_DIR}/operators/combine_latest.1.cpp + #${TEST_DIR}/operators/combine_latest.2.cpp ${TEST_DIR}/operators/concat.cpp ${TEST_DIR}/operators/concat_map.cpp ${TEST_DIR}/operators/distinct_until_changed.cpp @@ -69,7 +72,7 @@ TARGET_LINK_LIBRARIES(rxcppv2_test ${CMAKE_THREAD_LIBS_INIT}) # define the sources of the self test set(ONE_SOURCES ${TEST_DIR}/test.cpp -# ${TEST_DIR}/operators/subscribe_on.cpp + ${TEST_DIR}/operators/buffer.cpp ) add_executable(one_test ${ONE_SOURCES}) TARGET_LINK_LIBRARIES(one_test ${CMAKE_THREAD_LIBS_INIT}) |