From d637ca0e2dbc001b54e9358d62ee99875570f3e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Billeter?= Date: Sun, 10 Feb 2019 06:49:11 +0100 Subject: [PATCH 001/227] configure.ac: Set `foreign` option to fix build Without the `foreign` option, automake requires a README file, which no longer exists. Makefile.am: error: required file './README' not found Fixes: 8a0cb176 ("README: Rename to README.md and reformat as markdown") --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 42254a16..78eea522 100644 --- a/configure.ac +++ b/configure.ac @@ -25,7 +25,7 @@ AC_CONFIG_AUX_DIR([build]) AC_CONFIG_MACRO_DIR([build]) AC_CONFIG_HEADERS([config.h sigc++config.h]) -AM_INIT_AUTOMAKE([1.9 -Wno-portability check-news no-dist-gzip dist-xz tar-ustar no-define nostdinc]) +AM_INIT_AUTOMAKE([1.9 -Wno-portability check-news no-dist-gzip dist-xz tar-ustar no-define nostdinc foreign]) # Support silent build rules. # Disable by either passing --disable-silent-rules to configure or passing V=1 to make. m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) From 1a60bb7fe3055a7787b0c9b5c397908cb727dd25 Mon Sep 17 00:00:00 2001 From: Kjell Ahlstedt Date: Wed, 13 Feb 2019 13:12:33 +0100 Subject: [PATCH 002/227] Makefile.am: Distribute README.md --- Makefile.am | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 7a8ef5ca..1e4fc38f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -35,7 +35,12 @@ dist_noinst_SCRIPTS = autogen.sh include $(srcdir)/MSVC_NMake/filelist.am -dist_noinst_DATA = $(addprefix MSVC_NMake/,$(msvc_nmake_data)) CMakeLists.txt sigc++config.h.cmake cmake_uninstall.cmake.in +dist_noinst_DATA = \ + $(addprefix MSVC_NMake/,$(msvc_nmake_data)) \ + CMakeLists.txt \ + sigc++config.h.cmake \ + cmake_uninstall.cmake.in \ + README.md DISTCLEANFILES = MSVC_NMake/sigc++config.h From cf391a112bb2dc1c1798335b0a456e980d58af06 Mon Sep 17 00:00:00 2001 From: Kjell Ahlstedt Date: Sun, 17 Feb 2019 15:33:32 +0100 Subject: [PATCH 003/227] sigc::tuple_transform_each: std::result_of -> std::invoke_result std::result_of is deprecated in C++17 and will be removed in C++20. Fixes issue #19 --- sigc++/tuple-utils/tuple_transform_each.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sigc++/tuple-utils/tuple_transform_each.h b/sigc++/tuple-utils/tuple_transform_each.h index 7649e7f5..46c4271b 100644 --- a/sigc++/tuple-utils/tuple_transform_each.h +++ b/sigc++/tuple-utils/tuple_transform_each.h @@ -45,8 +45,8 @@ struct tuple_transform_each_impl { static_assert(index >= 0, "unexpected index."); using from_element_type = typename std::tuple_element>::type; - using to_element_type = typename std::result_of::transform)(from_element_type&)>::type; + using to_element_type = typename std::invoke_result::transform), from_element_type&>::type; const auto t_element = std::tuple(T_transformer::transform(std::get(t_original))); From 6447d24e00adff4b1a6922df2fe09933a742fe20 Mon Sep 17 00:00:00 2001 From: Kjell Ahlstedt Date: Thu, 21 Mar 2019 15:21:51 +0100 Subject: [PATCH 004/227] Doxyfile.in: Remove obsolete preprocessor macros The removed macros are not used anywhere in libsigc++ 3.0. --- docs/docs/reference/Doxyfile.in | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/docs/docs/reference/Doxyfile.in b/docs/docs/reference/Doxyfile.in index c94b485d..8e9cb102 100644 --- a/docs/docs/reference/Doxyfile.in +++ b/docs/docs/reference/Doxyfile.in @@ -283,12 +283,8 @@ INCLUDE_FILE_PATTERNS = *.h PREDEFINED = __cplusplus \ DOXYGEN_SHOULD_SKIP_THIS \ "SIGC_API=" \ - SIGC_CONFIGURE \ - SIGC_GCC_TEMPLATE_SPECIALIZATION_OPERATOR_OVERLOAD \ - SIGC_MSVC_TEMPLATE_SPECIALIZATION_OPERATOR_OVERLOAD \ - SIGC_TEMPLATE_SPECIALIZATION_OPERATOR_OVERLOAD -EXPAND_AS_DEFINED = SIGC_WORKAROUND_OPERATOR_PARENTHESES \ - SIGCXX_MAJOR_VERSION \ + SIGC_CONFIGURE +EXPAND_AS_DEFINED = SIGCXX_MAJOR_VERSION \ SIGCXX_MINOR_VERSION \ SIGCXX_MICRO_VERSION SKIP_FUNCTION_MACROS = YES From ec1b7ca2494dfafe3098d1665a09a2dd0dc65f5e Mon Sep 17 00:00:00 2001 From: Jeff Trull Date: Fri, 31 May 2019 12:25:55 -0700 Subject: [PATCH 005/227] CMake: supply SIGC_BUILD and use CMAKE_CXX_STANDARD, for MSVC --- CMakeLists.txt | 2 +- sigc++/CMakeLists.txt | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bd037692..9ec2b4a0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,7 +28,7 @@ option (SIGCXX_DISABLE_DEPRECATED "Disable deprecated" OFF) project (sigc++) -set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17") +set( CMAKE_CXX_STANDARD 17 ) set (PROJECT_SOURCE_DIR "${sigc++_SOURCE_DIR}/sigc++") diff --git a/sigc++/CMakeLists.txt b/sigc++/CMakeLists.txt index c06d8299..fa5a91a9 100644 --- a/sigc++/CMakeLists.txt +++ b/sigc++/CMakeLists.txt @@ -27,6 +27,7 @@ add_library(${SIGCPP_LIB_NAME} SHARED ${SOURCE_FILES}) set_property (TARGET ${SIGCPP_LIB_NAME} PROPERTY VERSION ${PACKAGE_VERSION}) set_property(TARGET ${SIGCPP_LIB_NAME} PROPERTY SOVERSION ${LIBSIGCPP_SOVERSION}) +target_compile_definitions( ${SIGCPP_LIB_NAME} PRIVATE -DSIGC_BUILD ) set (INCLUDE_INSTALL_DIR "include/${PROJECT_NAME}-${SIGCXX_API_VERSION}") From b8c604ce24182b1c6014714b3909136997328921 Mon Sep 17 00:00:00 2001 From: Kjell Ahlstedt Date: Wed, 12 Jun 2019 18:25:07 +0200 Subject: [PATCH 006/227] 2.99.13 --- NEWS | 24 ++++++++++++++++++++++++ configure.ac | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index bb621c70..7b21c6af 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,27 @@ +2.99.13: (unstable) + +* Replace the deprecated std::result_of with std::invoke_result + (Kjell Ahlstedt) Issue #19 + +Build: +* CMake: Supply SIGC_BUILD and use CMAKE_CXX_STANDARD + (Jeff Trull) Issue #23, pull request #24 + +Documentation: +* Remove some obsolete documentation + (Murray Cumming) Issue #12 (Jeremy Bicha) +* Rename README to README.md and update it + (Murray Cumming) Issue #18 (Traumschule) + (Jürg Billeter) Pull request #20 +* Reference docs generated by Doxygen 1.8.11. + Hopefully it will show up at + https://developer.gnome.org/libsigc++/unstable/ + +Tests: +* Add some necessary #include directives + (Lennard Berger) Pull Request #15 + + 2.99.12: (unstable) * Avoid compiler warnings from function pointer conversions diff --git a/configure.ac b/configure.ac index 78eea522..eaec676f 100644 --- a/configure.ac +++ b/configure.ac @@ -15,7 +15,7 @@ ## You should have received a copy of the GNU Lesser General Public License ## along with this library. If not, see . -AC_INIT([libsigc++], [2.99.12], +AC_INIT([libsigc++], [2.99.13], [https://github.com/libsigcplusplus/libsigcplusplus/issues/], [libsigc++], [https://libsigcplusplus.github.io/libsigcplusplus/]) AC_PREREQ([2.59]) From a486793ce877d990d4000298f83e7712fedf68b9 Mon Sep 17 00:00:00 2001 From: Kjell Ahlstedt Date: Wed, 3 Jul 2019 17:30:13 +0200 Subject: [PATCH 007/227] tests/test_track_obj: Fix for clang++ clang++ complains if private members are unused, so make them protected. error: private field 'bar_' is not used [-Werror,-Wunused-private-field] --- tests/test_track_obj.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/test_track_obj.cc b/tests/test_track_obj.cc index 1c93b698..06805082 100644 --- a/tests/test_track_obj.cc +++ b/tests/test_track_obj.cc @@ -21,8 +21,8 @@ // - Show that a slot with a C++11 lambda expression can be automatically // disconnected when an object derived from sigc::trackable is deleted, // provided sigc::track_obj() is used. -// It's shown here as a preparation for deprecating and eventually -// deleting the libsigc++ lambda expressions. +// It shows that C++11 lambda expressions can replace the libsigc++ lambda +// expressions, which have been removed. // See https://bugzilla.gnome.org/show_bug.cgi?id=672555 // - Test the code example in the documentation in sigc++/adaptors/track_obj.h. // @@ -63,7 +63,8 @@ class Functor1 std::string operator()(int i) { return (i < 0) ? "negative" : ((i > 0) ? "positive" : "zero"); } -private: +protected: + // Don't make it private. clang++ does not like unused private data. const bar_group4& bar_; }; @@ -82,8 +83,10 @@ class Functor2 return result; } -private: +protected: + // Don't make it private. clang++ does not like unused private data. const bar_group4& bar_; +private: const book& aBook_; }; From 4a691a1ecfd9b255807eabfb2f07da720f364217 Mon Sep 17 00:00:00 2001 From: Kjell Ahlstedt Date: Thu, 29 Aug 2019 17:07:44 +0200 Subject: [PATCH 008/227] bind(), track_obj() documentation: Remove obsolete restrictions The number of objects and arguments are not restricted to max 7 now that variadic templates have replaced the .m4 files in libsigc++-2 that generated 7 copies. --- sigc++/adaptors/bind.h | 2 -- sigc++/adaptors/track_obj.h | 1 - 2 files changed, 3 deletions(-) diff --git a/sigc++/adaptors/bind.h b/sigc++/adaptors/bind.h index bd19b321..7088c9f6 100644 --- a/sigc++/adaptors/bind.h +++ b/sigc++/adaptors/bind.h @@ -28,13 +28,11 @@ #include #include - namespace sigc { /** @defgroup bind bind(), bind_return() * sigc::bind() alters an arbitrary functor by fixing arguments to certain values. - * Up to 7 arguments can be bound at a time. * For single argument binding, overloads of sigc::bind() are provided that let you * specify the zero-based position of the argument to fix with the first template parameter. * (A value of @p -1 fixes the last argument so sigc::bind<-1>() gives the same result as diff --git a/sigc++/adaptors/track_obj.h b/sigc++/adaptors/track_obj.h index c7e75e59..d894781a 100644 --- a/sigc++/adaptors/track_obj.h +++ b/sigc++/adaptors/track_obj.h @@ -35,7 +35,6 @@ namespace sigc * * The functor returned by sigc::track_obj() is formally an adaptor, but it does * not alter the signature, return type or behaviour of the supplied functor. - * Up to 7 objects can be tracked. operator()() can have up to 7 arguments. * * @par Example: * @code From 959beb1cefcb4283bf124223e32f5b6247d2ceb3 Mon Sep 17 00:00:00 2001 From: Kjell Ahlstedt Date: Thu, 29 Aug 2019 17:08:48 +0200 Subject: [PATCH 009/227] tests/test_track_obj.cc: Remove obsolete comments --- tests/test_track_obj.cc | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/tests/test_track_obj.cc b/tests/test_track_obj.cc index 06805082..594d9cff 100644 --- a/tests/test_track_obj.cc +++ b/tests/test_track_obj.cc @@ -26,11 +26,6 @@ // See https://bugzilla.gnome.org/show_bug.cgi?id=672555 // - Test the code example in the documentation in sigc++/adaptors/track_obj.h. // -// To test the C++11 lambda expressions with gcc 4.6.3 (and probably some later -// versions of gcc; gcc 4.7.x also understands -std=c++11): -// make CXXFLAGS='-g -O2 -std=c++0x' test_track_obj -// ./test_track_obj -// echo $? // If test_track_obj writes nothing and the return code is 0, the test has passed. #include "testutilities.h" @@ -191,18 +186,16 @@ main(int argc, char* argv[]) sl20(); util->check_result(result_stream, ""); - // Code example in the documentation sigc++/adaptors/macros/track_obj.h.m4 - // ----------------------------------------------------------------------- + // Code example in the documentation sigc++/adaptors/track_obj.h. + // -------------------------------------------------------------- { // struct bar : public sigc::trackable {} some_bar; sigc::signal some_signal; { bar_group4 some_bar; - // some_signal.connect(sigc::group(&foo, std::ref(some_bar))); - // disconnected automatically if some_bar goes out of scope // some_signal.connect([&some_bar](){ foo_group4(some_bar); }); // no auto-disconnect - // some_signal.connect(sigc::bind(&foo_group4, std::ref(some_bar))); // auto-disconnects, but - // we prefer C++11 lambda + // some_signal.connect(sigc::bind(&foo_group4, std::ref(some_bar))); // auto-disconnects, + // but we prefer C++11 lambda some_signal.connect(sigc::track_obj([&some_bar]() { foo_group4(some_bar); }, some_bar)); some_signal.emit(); util->check_result(result_stream, "foo_group4(bar_group4&)"); From b2559b72ac42a90e5a1f4ee78a038d1552fc8888 Mon Sep 17 00:00:00 2001 From: Murray Cumming Date: Sun, 1 Sep 2019 20:42:04 +0200 Subject: [PATCH 010/227] tests: Remove an unnecessary semicolon --- tests/benchmark.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/benchmark.cc b/tests/benchmark.cc index 19aa9dd7..b640d3bd 100644 --- a/tests/benchmark.cc +++ b/tests/benchmark.cc @@ -72,7 +72,7 @@ void test_connected_multiple_signal_emit() emitter.connect(mem_fun(foobar5, &foo::bar)); std::cout << "elapsed time for " << COUNT << " emissions (5 slots):" << std::endl; - boost::timer::auto_cpu_timer timer;; + boost::timer::auto_cpu_timer timer; for (int i=0; i < COUNT; ++i) emitter(i); From c47ec07fbb4930f456174008b15e64e2b8a6ea59 Mon Sep 17 00:00:00 2001 From: Murray Cumming Date: Sun, 1 Sep 2019 20:44:18 +0200 Subject: [PATCH 011/227] tests: Don't call static method via instance --- tests/test_hide.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_hide.cc b/tests/test_hide.cc index 2a2ec210..c0a99111 100644 --- a/tests/test_hide.cc +++ b/tests/test_hide.cc @@ -42,7 +42,7 @@ main(int argc, char* argv[]) auto util = TestUtilities::get_instance(); if (!util->check_command_args(argc, argv)) - return util->get_result_and_delete_instance() ? EXIT_SUCCESS : EXIT_FAILURE; + return TestUtilities::get_result_and_delete_instance() ? EXIT_SUCCESS : EXIT_FAILURE; result_stream << sigc::hide<0>(foo())(1, 2); util->check_result(result_stream, "foo(int 2) 3"); @@ -59,5 +59,5 @@ main(int argc, char* argv[]) sigc::hide(foo_void())(1); // void test util->check_result(result_stream, "foo_void()"); - return util->get_result_and_delete_instance() ? EXIT_SUCCESS : EXIT_FAILURE; + return TestUtilities::get_result_and_delete_instance() ? EXIT_SUCCESS : EXIT_FAILURE; } From 8453a701af8b7f3daa0667306bcf54613470cd34 Mon Sep 17 00:00:00 2001 From: Kjell Ahlstedt Date: Mon, 2 Sep 2019 10:20:32 +0200 Subject: [PATCH 012/227] tuple_transform_each(): Fix for libc++ Tuples which are input data to std::tuple_cat() are not declared const. Some versions of libc++ has a bug in std::tuple_cat(): All output elements coming from a const tuple become const. It can break 'make check' when using clang++ and -stdlib=libc++. Fixes issue #25 --- sigc++/tuple-utils/tuple_transform_each.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/sigc++/tuple-utils/tuple_transform_each.h b/sigc++/tuple-utils/tuple_transform_each.h index 46c4271b..023cdbd0 100644 --- a/sigc++/tuple-utils/tuple_transform_each.h +++ b/sigc++/tuple-utils/tuple_transform_each.h @@ -18,7 +18,6 @@ #ifndef SIGC_TUPLE_UTILS_TUPLE_TRANSFORM_EACH_H #define SIGC_TUPLE_UTILS_TUPLE_TRANSFORM_EACH_H -// #include #include #include #include @@ -47,14 +46,18 @@ struct tuple_transform_each_impl { using from_element_type = typename std::tuple_element>::type; using to_element_type = typename std::invoke_result::transform), from_element_type&>::type; - const auto t_element = + // Tuples which are input data to std::tuple_cat() should not be declared const. + // Some versions of libc++ has a bug in std::tuple_cat(): All output elements + // coming from a const tuple become const. + // https://github.com/libsigcplusplus/libsigcplusplus/issues/25 + auto t_element = std::tuple(T_transformer::transform(std::get(t_original))); if constexpr(size_from_index == 1) { - const auto tuple_rest = tuple_start(std::forward(t)); + auto tuple_rest = tuple_start(std::forward(t)); return std::tuple_cat(tuple_rest, t_element); } else { - const auto t_start = tuple_start(std::forward(t)); + auto t_start = tuple_start(std::forward(t)); // t_end's elements will be copies of the elements in t, so this method's // caller won't see the changes made in the subsequent call of @@ -62,7 +65,7 @@ struct tuple_transform_each_impl { // through too, so we can modify that directly. // the const version (tuple_transform_each_const()) doesn't have to worry // about this, though avoiding copying would be more efficient. - const auto t_end = tuple_end(t); + auto t_end = tuple_end(t); auto t_with_transformed_element = std::tuple_cat(t_start, t_element, t_end); return tuple_transform_each_impl Date: Thu, 5 Sep 2019 09:37:31 +0200 Subject: [PATCH 013/227] README_build: Refer MSVC users to MSVC_NMake/README.txt --- README_build | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README_build b/README_build index 0c1bbf29..0af40bea 100644 --- a/README_build +++ b/README_build @@ -34,5 +34,4 @@ You can run the tests like so: ## Microsoft Visual C++ -We provide MSVC++ projects. They might work. -Pleaes report specific bugs if they don't. +See MSVC_NMake/README.txt. From 299d98ade5a460d2e81b3a29e0111c548107ebd7 Mon Sep 17 00:00:00 2001 From: Kjell Ahlstedt Date: Thu, 5 Sep 2019 10:16:57 +0200 Subject: [PATCH 014/227] 3.0.0 --- NEWS | 20 ++++++++++++++++++++ configure.ac | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 7b21c6af..cf581e80 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,23 @@ +3.0.0 (stable) + +This is the first stable release of sigc++-3.0, installable in +parallel with sigc++-2.0. +Changes compared to the latest unstable release: + +* Fix tuple_transform_each() for libc++ + (Kjell Ahlstedt) Issue #25 (Jeff Trull) + +Documentation: +* Remove some obsolete documentation + (Kjell Ahlstedt) + +Tests: +* Make test_track_obj.cc compile with clang++ + (Kjell Ahlstedt) +* Don't call static method via instance + (Murray Cumming) + + 2.99.13: (unstable) * Replace the deprecated std::result_of with std::invoke_result diff --git a/configure.ac b/configure.ac index eaec676f..d88205fb 100644 --- a/configure.ac +++ b/configure.ac @@ -15,7 +15,7 @@ ## You should have received a copy of the GNU Lesser General Public License ## along with this library. If not, see . -AC_INIT([libsigc++], [2.99.13], +AC_INIT([libsigc++], [3.0.0], [https://github.com/libsigcplusplus/libsigcplusplus/issues/], [libsigc++], [https://libsigcplusplus.github.io/libsigcplusplus/]) AC_PREREQ([2.59]) From 138510d4002a0ee866016f462e6687454757b4e8 Mon Sep 17 00:00:00 2001 From: AIGRIND Date: Wed, 25 Sep 2019 11:29:45 +0200 Subject: [PATCH 015/227] Empty connections can be safely copied now Copy constructor and `operator=` could fail if `src` was empty. ``` sigc::connection con1; sigc::connection con2(con1); // failed ``` ``` sigc::connection con3; sigc::connection con4; con3 = con4; // failed ``` --- sigc++/weak_raw_ptr.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sigc++/weak_raw_ptr.h b/sigc++/weak_raw_ptr.h index ccae1b04..816981cd 100644 --- a/sigc++/weak_raw_ptr.h +++ b/sigc++/weak_raw_ptr.h @@ -50,7 +50,8 @@ struct weak_raw_ptr : public sigc::notifiable inline weak_raw_ptr(const weak_raw_ptr& src) noexcept : p_(src.p_) { - p_->add_destroy_notify_callback(this, ¬ify_object_invalidated); + if (p_) + p_->add_destroy_notify_callback(this, ¬ify_object_invalidated); } inline weak_raw_ptr& operator=(const weak_raw_ptr& src) noexcept @@ -60,7 +61,9 @@ struct weak_raw_ptr : public sigc::notifiable } p_ = src.p_; - p_->add_destroy_notify_callback(this, ¬ify_object_invalidated); + + if (p_) + p_->add_destroy_notify_callback(this, ¬ify_object_invalidated); return *this; } From 0136f43a7ad513e533853403ea169988e9c7e434 Mon Sep 17 00:00:00 2001 From: Murray Cumming Date: Thu, 26 Sep 2019 11:56:21 +0200 Subject: [PATCH 016/227] tests: Add test_connection, to check copying For now, this just confirms that we can now copy empty sigc::connection instances. (See the previous commit.) --- tests/.gitignore | 1 + tests/CMakeLists.txt | 1 + tests/Makefile.am | 2 ++ tests/memleakcheck.sh | 2 +- tests/test_connection.cc | 45 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 tests/test_connection.cc diff --git a/tests/.gitignore b/tests/.gitignore index ca60f86d..276abe2f 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -8,6 +8,7 @@ /test_bind_refptr /test_bind_return /test_compose +/test_connection /test_copy_invalid_slot /test_cpp11_lambda /test_custom diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index ab089ebd..feb4eef8 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -25,6 +25,7 @@ set (TEST_SOURCE_FILES test_bind_refptr.cc test_bind_return.cc test_compose.cc + test_connection.cc test_copy_invalid_slot.cc test_cpp11_lambda.cc test_custom.cc diff --git a/tests/Makefile.am b/tests/Makefile.am index 114789f2..735d76b1 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -32,6 +32,7 @@ check_PROGRAMS = \ test_bind_refptr \ test_bind_return \ test_compose \ + test_connection \ test_copy_invalid_slot \ test_cpp11_lambda \ test_custom \ @@ -75,6 +76,7 @@ test_bind_ref_SOURCES = test_bind_ref.cc $(sigc_test_util) test_bind_refptr_SOURCES = test_bind_refptr.cc $(sigc_test_util) test_bind_return_SOURCES = test_bind_return.cc $(sigc_test_util) test_compose_SOURCES = test_compose.cc $(sigc_test_util) +test_connection_SOURCES = test_connection.cc $(sigc_test_util) test_copy_invalid_slot_SOURCES = test_copy_invalid_slot.cc $(sigc_test_util) test_cpp11_lambda_SOURCES = test_cpp11_lambda.cc $(sigc_test_util) test_custom_SOURCES = test_custom.cc $(sigc_test_util) diff --git a/tests/memleakcheck.sh b/tests/memleakcheck.sh index 07a7311e..4c8f4cd9 100755 --- a/tests/memleakcheck.sh +++ b/tests/memleakcheck.sh @@ -5,7 +5,7 @@ # valgrind --leak-check=full .libs/lt-test_* for testprog in test_accum_iter test_accumulated test_bind test_bind_as_slot \ - test_bind_ref test_bind_refptr test_bind_return test_compose \ + test_bind_ref test_bind_refptr test_bind_return test_compose test_connection \ test_copy_invalid_slot test_cpp11_lambda test_custom test_disconnect \ test_disconnect_during_emit test_exception_catch test_hide \ test_limit_reference test_member_method_trait test_mem_fun test_ptr_fun \ diff --git a/tests/test_connection.cc b/tests/test_connection.cc new file mode 100644 index 00000000..ec12765b --- /dev/null +++ b/tests/test_connection.cc @@ -0,0 +1,45 @@ +/* Copyright 2019, The libsigc++ Development Team + * Assigned to public domain. Use as you wish without restriction. + */ + +#include "testutilities.h" +#include +#include +#include + +namespace +{ + +TestUtilities* util = nullptr; +std::ostringstream result_stream; + +void +test_connection_copy_empty() +{ + sigc::connection con1; + + // Try to prevent the compiler from optimising away the copy. + std::cout << &con1 << std::endl; + + sigc::connection con2(con1); + + // Try to prevent the compiler from optimising away the copy. + std::cout << &con2 << std::endl; +} + +} // end anonymous namespace + +int +main(int argc, char* argv[]) +{ + util = TestUtilities::get_instance(); + + if (!util->check_command_args(argc, argv)) + return util->get_result_and_delete_instance() ? EXIT_SUCCESS : EXIT_FAILURE; + + test_connection_copy_empty(); + + // See also test_disconnection.cc + + return util->get_result_and_delete_instance() ? EXIT_SUCCESS : EXIT_FAILURE; +} From ffe6534c7261b0d428ba47b063658cfe93596893 Mon Sep 17 00:00:00 2001 From: Murray Cumming Date: Fri, 27 Sep 2019 14:34:20 +0200 Subject: [PATCH 017/227] Add GitHub Actions build workflow (autotools build) --- .github/workflows/autotools.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .github/workflows/autotools.yml diff --git a/.github/workflows/autotools.yml b/.github/workflows/autotools.yml new file mode 100644 index 00000000..2e38ce3f --- /dev/null +++ b/.github/workflows/autotools.yml @@ -0,0 +1,19 @@ +name: CI + +on: [push] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + - name: Build + run: | + sudo apt install mm-common + ./autogen.sh; ./configure; make + - name: Test + run: make check + - name: Distcheck + run: make distcheck From c283bd545cae0237962d41ee29027369a92fd57d Mon Sep 17 00:00:00 2001 From: Murray Cumming Date: Fri, 27 Sep 2019 14:46:33 +0200 Subject: [PATCH 018/227] Add GitHub Actions build workflow (cmake build) --- .github/workflows/cmake.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/workflows/cmake.yml diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml new file mode 100644 index 00000000..d8dba49d --- /dev/null +++ b/.github/workflows/cmake.yml @@ -0,0 +1,17 @@ +name: CI + +on: [push] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + - name: Build + run: | + cmake . + make + - name: Test + run: make test From a98df23dca5747ecc44a6347044811808a71ce6f Mon Sep 17 00:00:00 2001 From: Murray Cumming Date: Sat, 28 Sep 2019 12:53:30 +0200 Subject: [PATCH 019/227] GitHub Actions: Better workflow names --- .github/workflows/autotools.yml | 2 +- .github/workflows/cmake.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/autotools.yml b/.github/workflows/autotools.yml index 2e38ce3f..22f960ff 100644 --- a/.github/workflows/autotools.yml +++ b/.github/workflows/autotools.yml @@ -1,4 +1,4 @@ -name: CI +name: "CI: autotools" on: [push] diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index d8dba49d..13f3729d 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -1,4 +1,4 @@ -name: CI +name: "CI: cmake" on: [push] From 781ce35097e67c080cc6c86a13c1bd5f5312574b Mon Sep 17 00:00:00 2001 From: Murray Cumming Date: Sat, 28 Sep 2019 12:54:23 +0200 Subject: [PATCH 020/227] GitHub Actions: Use specific compiler versions We only try compiler versions that are known to have C++17 support. There is no point in trying older compiler versions. --- .github/workflows/autotools-clang-5.yml | 23 +++++++++++++++++++++++ .github/workflows/autotools-clang-6.yml | 23 +++++++++++++++++++++++ .github/workflows/autotools-clang-7.yml | 23 +++++++++++++++++++++++ .github/workflows/autotools-gcc-7.yml | 23 +++++++++++++++++++++++ .github/workflows/autotools-gcc-8.yml | 23 +++++++++++++++++++++++ .github/workflows/autotools.yml | 19 ------------------- 6 files changed, 115 insertions(+), 19 deletions(-) create mode 100644 .github/workflows/autotools-clang-5.yml create mode 100644 .github/workflows/autotools-clang-6.yml create mode 100644 .github/workflows/autotools-clang-7.yml create mode 100644 .github/workflows/autotools-gcc-7.yml create mode 100644 .github/workflows/autotools-gcc-8.yml delete mode 100644 .github/workflows/autotools.yml diff --git a/.github/workflows/autotools-clang-5.yml b/.github/workflows/autotools-clang-5.yml new file mode 100644 index 00000000..fee25153 --- /dev/null +++ b/.github/workflows/autotools-clang-5.yml @@ -0,0 +1,23 @@ +name: "CI: autotools: clang 5" + +on: [push] + +jobs: + build: + + runs-on: ubuntu-18.04 + + steps: + - uses: actions/checkout@v1 + - name: Build + run: | + sudo apt update + sudo apt install mm-common clang-5.0 + export CXX=clang++-5.0 + ./autogen.sh + ./configure + make + - name: Test + run: make check + - name: Distcheck + run: make distcheck diff --git a/.github/workflows/autotools-clang-6.yml b/.github/workflows/autotools-clang-6.yml new file mode 100644 index 00000000..fc62db4a --- /dev/null +++ b/.github/workflows/autotools-clang-6.yml @@ -0,0 +1,23 @@ +name: "CI: autotools: clang 6" + +on: [push] + +jobs: + build: + + runs-on: ubuntu-18.04 + + steps: + - uses: actions/checkout@v1 + - name: Build + run: | + sudo apt update + sudo apt install mm-common clang-6.0 + export CXX=clang++-6.0 + ./autogen.sh + ./configure + make + - name: Test + run: make check + - name: Distcheck + run: make distcheck diff --git a/.github/workflows/autotools-clang-7.yml b/.github/workflows/autotools-clang-7.yml new file mode 100644 index 00000000..59148fc2 --- /dev/null +++ b/.github/workflows/autotools-clang-7.yml @@ -0,0 +1,23 @@ +name: "CI: autotools: clang 7" + +on: [push] + +jobs: + build: + + runs-on: ubuntu-18.04 + + steps: + - uses: actions/checkout@v1 + - name: Build + run: | + sudo apt update + sudo apt install mm-common clang-7 + export CXX=clang++-7 + ./autogen.sh + ./configure + make + - name: Test + run: make check + - name: Distcheck + run: make distcheck diff --git a/.github/workflows/autotools-gcc-7.yml b/.github/workflows/autotools-gcc-7.yml new file mode 100644 index 00000000..baf49f8f --- /dev/null +++ b/.github/workflows/autotools-gcc-7.yml @@ -0,0 +1,23 @@ +name: "CI: autotools: gcc 7" + +on: [push] + +jobs: + build: + + runs-on: ubuntu-18.04 + + steps: + - uses: actions/checkout@v1 + - name: Build + run: | + sudo apt update + sudo apt install mm-common g++-7 + export CXX=g++-7 + ./autogen.sh + ./configure + make + - name: Test + run: make check + - name: Distcheck + run: make distcheck diff --git a/.github/workflows/autotools-gcc-8.yml b/.github/workflows/autotools-gcc-8.yml new file mode 100644 index 00000000..e4313181 --- /dev/null +++ b/.github/workflows/autotools-gcc-8.yml @@ -0,0 +1,23 @@ +name: "CI: autotools: gcc 8" + +on: [push] + +jobs: + build: + + runs-on: ubuntu-18.04 + + steps: + - uses: actions/checkout@v1 + - name: Build + run: | + sudo apt update + sudo apt install mm-common g++-8 + export CXX=g++-8 + ./autogen.sh + ./configure + make + - name: Test + run: make check + - name: Distcheck + run: make distcheck diff --git a/.github/workflows/autotools.yml b/.github/workflows/autotools.yml deleted file mode 100644 index 22f960ff..00000000 --- a/.github/workflows/autotools.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: "CI: autotools" - -on: [push] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v1 - - name: Build - run: | - sudo apt install mm-common - ./autogen.sh; ./configure; make - - name: Test - run: make check - - name: Distcheck - run: make distcheck From 0a149f292e726c6a6b18d99391ac3a4887005b37 Mon Sep 17 00:00:00 2001 From: Murray Cumming Date: Sat, 28 Sep 2019 13:40:47 +0200 Subject: [PATCH 021/227] GitHub Actions: Add workflow for gcc 9 Using Ubuntu 19.10 (Eoan) instead of Ubuntu 18.04. --- .github/workflows/autotools-gcc-9.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/autotools-gcc-9.yml diff --git a/.github/workflows/autotools-gcc-9.yml b/.github/workflows/autotools-gcc-9.yml new file mode 100644 index 00000000..165fc000 --- /dev/null +++ b/.github/workflows/autotools-gcc-9.yml @@ -0,0 +1,24 @@ +name: "CI: autotools: gcc 9" + +on: [push] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + - uses: docker://ubuntu:19.10 + - name: Build + run: | + sudo apt update + sudo apt install mm-common g++-9 + export CXX=g++-9 + ./autogen.sh + ./configure + make + - name: Test + run: make check + - name: Distcheck + run: make distcheck From e98bd15529cb64c6bb01793f36d1f03f2dd65713 Mon Sep 17 00:00:00 2001 From: Murray Cumming Date: Sat, 28 Sep 2019 13:54:16 +0200 Subject: [PATCH 022/227] GitHub Actions: Add workflow for clang 8 Using Ubuntu 19.10 (Eoan) instead of Ubuntu 18.04. --- .github/workflows/autotools-clang-8.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/autotools-clang-8.yml diff --git a/.github/workflows/autotools-clang-8.yml b/.github/workflows/autotools-clang-8.yml new file mode 100644 index 00000000..5d9d0a5f --- /dev/null +++ b/.github/workflows/autotools-clang-8.yml @@ -0,0 +1,24 @@ +name: "CI: autotools: clang 8" + +on: [push] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + - uses: docker://ubuntu:19.10 + - name: Build + run: | + sudo apt update + sudo apt install mm-common clang-8 + export CXX=clang++-8 + ./autogen.sh + ./configure + make + - name: Test + run: make check + - name: Distcheck + run: make distcheck From 6750902e4e5ee948e4f96386cad767e609949f7a Mon Sep 17 00:00:00 2001 From: Murray Cumming Date: Fri, 11 Oct 2019 10:20:49 +0200 Subject: [PATCH 023/227] Github Actions: Use --enable-warnings=fatal This enables more warnings and makes the build fail if they happen. --- .github/workflows/autotools-clang-5.yml | 2 +- .github/workflows/autotools-clang-6.yml | 2 +- .github/workflows/autotools-clang-7.yml | 2 +- .github/workflows/autotools-clang-8.yml | 2 +- .github/workflows/autotools-gcc-7.yml | 2 +- .github/workflows/autotools-gcc-8.yml | 2 +- .github/workflows/autotools-gcc-9.yml | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/autotools-clang-5.yml b/.github/workflows/autotools-clang-5.yml index fee25153..69fa1403 100644 --- a/.github/workflows/autotools-clang-5.yml +++ b/.github/workflows/autotools-clang-5.yml @@ -14,7 +14,7 @@ jobs: sudo apt update sudo apt install mm-common clang-5.0 export CXX=clang++-5.0 - ./autogen.sh + ./autogen.sh --enable-warnings=fatal ./configure make - name: Test diff --git a/.github/workflows/autotools-clang-6.yml b/.github/workflows/autotools-clang-6.yml index fc62db4a..a2643db0 100644 --- a/.github/workflows/autotools-clang-6.yml +++ b/.github/workflows/autotools-clang-6.yml @@ -14,7 +14,7 @@ jobs: sudo apt update sudo apt install mm-common clang-6.0 export CXX=clang++-6.0 - ./autogen.sh + ./autogen.sh --enable-warnings=fatal ./configure make - name: Test diff --git a/.github/workflows/autotools-clang-7.yml b/.github/workflows/autotools-clang-7.yml index 59148fc2..4aefe089 100644 --- a/.github/workflows/autotools-clang-7.yml +++ b/.github/workflows/autotools-clang-7.yml @@ -14,7 +14,7 @@ jobs: sudo apt update sudo apt install mm-common clang-7 export CXX=clang++-7 - ./autogen.sh + ./autogen.sh --enable-warnings=fatal ./configure make - name: Test diff --git a/.github/workflows/autotools-clang-8.yml b/.github/workflows/autotools-clang-8.yml index 5d9d0a5f..69416f3f 100644 --- a/.github/workflows/autotools-clang-8.yml +++ b/.github/workflows/autotools-clang-8.yml @@ -15,7 +15,7 @@ jobs: sudo apt update sudo apt install mm-common clang-8 export CXX=clang++-8 - ./autogen.sh + ./autogen.sh --enable-warnings=fatal ./configure make - name: Test diff --git a/.github/workflows/autotools-gcc-7.yml b/.github/workflows/autotools-gcc-7.yml index baf49f8f..31918c18 100644 --- a/.github/workflows/autotools-gcc-7.yml +++ b/.github/workflows/autotools-gcc-7.yml @@ -14,7 +14,7 @@ jobs: sudo apt update sudo apt install mm-common g++-7 export CXX=g++-7 - ./autogen.sh + ./autogen.sh --enable-warnings=fatal ./configure make - name: Test diff --git a/.github/workflows/autotools-gcc-8.yml b/.github/workflows/autotools-gcc-8.yml index e4313181..08e9b132 100644 --- a/.github/workflows/autotools-gcc-8.yml +++ b/.github/workflows/autotools-gcc-8.yml @@ -14,7 +14,7 @@ jobs: sudo apt update sudo apt install mm-common g++-8 export CXX=g++-8 - ./autogen.sh + ./autogen.sh --enable-warnings=fatal ./configure make - name: Test diff --git a/.github/workflows/autotools-gcc-9.yml b/.github/workflows/autotools-gcc-9.yml index 165fc000..9f4c1261 100644 --- a/.github/workflows/autotools-gcc-9.yml +++ b/.github/workflows/autotools-gcc-9.yml @@ -15,7 +15,7 @@ jobs: sudo apt update sudo apt install mm-common g++-9 export CXX=g++-9 - ./autogen.sh + ./autogen.sh --enable-warnings=fatal ./configure make - name: Test From 3864871d3acd652402198b889cfad35bb8802aac Mon Sep 17 00:00:00 2001 From: Murray Cumming Date: Wed, 2 Oct 2019 08:16:09 +0200 Subject: [PATCH 024/227] GitHub Actions: Add workflow on Windows (MSVC compiler) --- .github/workflows/cmake-msvc.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/cmake-msvc.yml diff --git a/.github/workflows/cmake-msvc.yml b/.github/workflows/cmake-msvc.yml new file mode 100644 index 00000000..50078471 --- /dev/null +++ b/.github/workflows/cmake-msvc.yml @@ -0,0 +1,18 @@ +name: "CI: cmake: msvc 2019" + +on: [push] + +jobs: + build: + + runs-on: windows-2019 + + steps: + - uses: actions/checkout@v1 + - uses: warrenbuckley/Setup-MSBuild@v1 + - name: Build + run: | + cmake . + msbuild ALL_BUILD.vcxproj + - name: Test + run: msbuild RUN_TESTS.vcxproj From 36f3c78d543495bd951e86e7b11e8462f303a227 Mon Sep 17 00:00:00 2001 From: Stuart Dootson Date: Mon, 7 Oct 2019 09:43:10 +0200 Subject: [PATCH 025/227] CMake Build: tests: Let MSVC find the library Use 'cmake -E env ... ' to execute the test executable. The '-E env' option allows the environment to be altered for the executed test. Use generator expressions to retrieve the build directory/file for the sigc++ & test targets --- tests/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index feb4eef8..a9e56704 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -61,7 +61,9 @@ function (add_sigcpp_test TEST_SOURCE_FILE) get_filename_component (test_name ${TEST_SOURCE_FILE} NAME_WE) add_executable (${test_name} ${TEST_SOURCE_FILE} testutilities.cc) target_link_libraries (${test_name} sigc-${SIGCXX_API_VERSION}) - add_test (${test_name} ${CMAKE_CURRENT_BINARY_DIR}/${test_name}) + add_test (NAME ${test_name} + # Help MSVC to find the library that the tests should link against. + COMMAND ${CMAKE_COMMAND} -E env "PATH=$;$ENV{PATH}" $) endfunction (add_sigcpp_test) foreach (test_file ${TEST_SOURCE_FILES}) From 5586a71f42b047c2542425a6a296a557d7593e6b Mon Sep 17 00:00:00 2001 From: Stuart Dootson Date: Mon, 14 Oct 2019 13:23:50 +0100 Subject: [PATCH 026/227] Add default warning flags --- CMakeLists.txt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9ec2b4a0..473d2576 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,6 +30,23 @@ project (sigc++) set( CMAKE_CXX_STANDARD 17 ) +# Turn on warnings for MSVC +if (MSVC) + # Remove the CMake default of /W3 because when you add /W4, MSVC will complain + # about two warning level flags + string(REGEX REPLACE "(^|[ \t])/W[0-9]($|[ \t])" "\\1\\2" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") + string(REGEX REPLACE "(^|[ \t])/W[0-9]($|[ \t])" "\\1\\2" CMAKE_CXX_FLAGS + "${CMAKE_CXX_FLAGS}") +elseif(CXX_COMPILER_ID) +endif() + +# Add compiler warning flags & turn warnings into errors +add_compile_options( + "$<$,$>:/W4;/WX>" + "$<$,$>:-pedantic;-Wall;-Wextra;-Wsuggest-override;-Wshadow;-Wzero-as-null-pointer-constant;-Wformat-security>" + "$<$,$,$,$>:-pedantic;-Wall;-Wextra;-Wshadow;-Wzero-as-null-pointer-constant;-Wformat-security>" +) + set (PROJECT_SOURCE_DIR "${sigc++_SOURCE_DIR}/sigc++") include_directories (${sigc++_SOURCE_DIR}) From b74406a54b844f41ec1dc5c535c4fa07336fc77d Mon Sep 17 00:00:00 2001 From: Stuart Dootson Date: Mon, 14 Oct 2019 14:14:45 +0100 Subject: [PATCH 027/227] MSVC build: Fix 'C4127: conditional expression is constant' warning --- sigc++/tuple-utils/tuple_for_each.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/sigc++/tuple-utils/tuple_for_each.h b/sigc++/tuple-utils/tuple_for_each.h index 15e8a20d..e179ffea 100644 --- a/sigc++/tuple-utils/tuple_for_each.h +++ b/sigc++/tuple-utils/tuple_for_each.h @@ -99,13 +99,11 @@ tuple_for_each(T&& t, T_extras&&... extras) // We use std::decay_t<> because tuple_size is not defined for references. constexpr auto size = std::tuple_size>::value; - if (size == 0) + if constexpr (size != 0) { - return; + detail::tuple_for_each_impl::tuple_for_each( + std::forward(t), std::forward(extras)...); } - - detail::tuple_for_each_impl::tuple_for_each( - std::forward(t), std::forward(extras)...); } } // namespace internal From e7d6878da2af809078cd867ff37e29448e507960 Mon Sep 17 00:00:00 2001 From: Stuart Dootson Date: Mon, 14 Oct 2019 14:30:06 +0100 Subject: [PATCH 028/227] MSVC build: Disable C4244 (conversion, possible loss of data) for relevant tests --- tests/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index a9e56704..36e728b1 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -64,6 +64,10 @@ function (add_sigcpp_test TEST_SOURCE_FILE) add_test (NAME ${test_name} # Help MSVC to find the library that the tests should link against. COMMAND ${CMAKE_COMMAND} -E env "PATH=$;$ENV{PATH}" $) + + if (MSVC AND test_name MATCHES "^(test_retype_return|test_signal)$") + target_compile_options(${test_name} PRIVATE "/wd4244") + endif() endfunction (add_sigcpp_test) foreach (test_file ${TEST_SOURCE_FILES}) From e82f0d341b5671ba81734591cc60b7179bc0a3d9 Mon Sep 17 00:00:00 2001 From: Stuart Dootson Date: Mon, 14 Oct 2019 15:09:48 +0100 Subject: [PATCH 029/227] MSVC build: Silence 'C4100: unreferenced formal parameter' warnings Added 'static_cast(parameter-name)' in all paths where the parameter isn't used --- sigc++/tuple-utils/tuple_end.h | 1 + sigc++/tuple-utils/tuple_for_each.h | 2 ++ sigc++/tuple-utils/tuple_transform_each.h | 1 + sigc++/visit_each.h | 2 ++ 4 files changed, 6 insertions(+) diff --git a/sigc++/tuple-utils/tuple_end.h b/sigc++/tuple-utils/tuple_end.h index 2f3572e6..72526aa4 100644 --- a/sigc++/tuple-utils/tuple_end.h +++ b/sigc++/tuple-utils/tuple_end.h @@ -56,6 +56,7 @@ tuple_end(T&& t) { static_assert(len <= size, "The tuple size must be less than or equal to the length."); if constexpr(len == 0) { + static_cast(t); // Recursive calls to tuple_cdr() would result in this eventually, // but this avoids the extra work: return std::tuple<>(); diff --git a/sigc++/tuple-utils/tuple_for_each.h b/sigc++/tuple-utils/tuple_for_each.h index e179ffea..8659d658 100644 --- a/sigc++/tuple-utils/tuple_for_each.h +++ b/sigc++/tuple-utils/tuple_for_each.h @@ -103,6 +103,8 @@ tuple_for_each(T&& t, T_extras&&... extras) { detail::tuple_for_each_impl::tuple_for_each( std::forward(t), std::forward(extras)...); + } else { + static_cast(t); } } diff --git a/sigc++/tuple-utils/tuple_transform_each.h b/sigc++/tuple-utils/tuple_transform_each.h index 023cdbd0..8d73764a 100644 --- a/sigc++/tuple-utils/tuple_transform_each.h +++ b/sigc++/tuple-utils/tuple_transform_each.h @@ -35,6 +35,7 @@ struct tuple_transform_each_impl { static decltype(auto) tuple_transform_each(T_current&& t, T_original& t_original) { if constexpr(size_from_index == 0) { + static_cast(t_original); //Do nothing because the tuple has no elements. return std::forward(t); } else { //TODO: Should this compile without using else to contain the alternative code? diff --git a/sigc++/visit_each.h b/sigc++/visit_each.h index 46a05049..5f92120b 100644 --- a/sigc++/visit_each.h +++ b/sigc++/visit_each.h @@ -47,6 +47,8 @@ struct limit_trackable_target //Only call action_() if T_Type derives from trackable. if constexpr(is_base_of_or_same_v) { std::invoke(action_, type); + } else { + static_cast(type); } } From 858e3daca271162ae1e77fff23693de9f7a0422d Mon Sep 17 00:00:00 2001 From: Stuart Dootson Date: Thu, 24 Oct 2019 10:10:24 +0100 Subject: [PATCH 030/227] MSVC build: Add code comments --- sigc++/tuple-utils/tuple_end.h | 1 + sigc++/tuple-utils/tuple_for_each.h | 1 + sigc++/tuple-utils/tuple_transform_each.h | 2 ++ sigc++/visit_each.h | 1 + 4 files changed, 5 insertions(+) diff --git a/sigc++/tuple-utils/tuple_end.h b/sigc++/tuple-utils/tuple_end.h index 72526aa4..6c47a345 100644 --- a/sigc++/tuple-utils/tuple_end.h +++ b/sigc++/tuple-utils/tuple_end.h @@ -56,6 +56,7 @@ tuple_end(T&& t) { static_assert(len <= size, "The tuple size must be less than or equal to the length."); if constexpr(len == 0) { + // Prevent 'unreferenced formal parameter' warning from MSVC by 'using' t static_cast(t); // Recursive calls to tuple_cdr() would result in this eventually, // but this avoids the extra work: diff --git a/sigc++/tuple-utils/tuple_for_each.h b/sigc++/tuple-utils/tuple_for_each.h index 8659d658..5296b703 100644 --- a/sigc++/tuple-utils/tuple_for_each.h +++ b/sigc++/tuple-utils/tuple_for_each.h @@ -104,6 +104,7 @@ tuple_for_each(T&& t, T_extras&&... extras) detail::tuple_for_each_impl::tuple_for_each( std::forward(t), std::forward(extras)...); } else { + // Prevent 'unreferenced formal parameter' warning from MSVC by 'using' t static_cast(t); } } diff --git a/sigc++/tuple-utils/tuple_transform_each.h b/sigc++/tuple-utils/tuple_transform_each.h index 8d73764a..fa1f7a8f 100644 --- a/sigc++/tuple-utils/tuple_transform_each.h +++ b/sigc++/tuple-utils/tuple_transform_each.h @@ -35,6 +35,8 @@ struct tuple_transform_each_impl { static decltype(auto) tuple_transform_each(T_current&& t, T_original& t_original) { if constexpr(size_from_index == 0) { + // Prevent 'unreferenced formal parameter' warning from MSVC by 'using' + // t_original static_cast(t_original); //Do nothing because the tuple has no elements. return std::forward(t); diff --git a/sigc++/visit_each.h b/sigc++/visit_each.h index 5f92120b..032068ad 100644 --- a/sigc++/visit_each.h +++ b/sigc++/visit_each.h @@ -48,6 +48,7 @@ struct limit_trackable_target if constexpr(is_base_of_or_same_v) { std::invoke(action_, type); } else { + // Prevent 'unreferenced formal parameter' warning from MSVC by 'using' type static_cast(type); } } From f0dd3d4523ac87dc2858e585e4f7d3f4603cd97d Mon Sep 17 00:00:00 2001 From: Stuart Dootson Date: Thu, 24 Oct 2019 10:11:34 +0100 Subject: [PATCH 031/227] MSVC build: Add version check to MSVC warning removal CMake 3.15 removes /W3 as a default flag for MSVC, so we no longer need to remove it. --- CMakeLists.txt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 473d2576..2e7f383a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,14 +30,15 @@ project (sigc++) set( CMAKE_CXX_STANDARD 17 ) -# Turn on warnings for MSVC -if (MSVC) - # Remove the CMake default of /W3 because when you add /W4, MSVC will complain - # about two warning level flags +# Turn on warnings for MSVC. Remove the CMake default of /W3 because when you +# add /W4, MSVC will complain about two warning level flags. This default +# changed at CMake 3.15 (see +# https://cmake.org/cmake/help/v3.15/policy/CMP0092.html#policy:CMP0092 for +# more details) + if (MSVC AND CMAKE_VERSION VERSION_LESS "13.15") string(REGEX REPLACE "(^|[ \t])/W[0-9]($|[ \t])" "\\1\\2" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") string(REGEX REPLACE "(^|[ \t])/W[0-9]($|[ \t])" "\\1\\2" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") -elseif(CXX_COMPILER_ID) endif() # Add compiler warning flags & turn warnings into errors From 051d1cab888a55d3565024041f32ba046f0fb3e3 Mon Sep 17 00:00:00 2001 From: Kjell Ahlstedt Date: Sun, 27 Oct 2019 12:09:22 +0100 Subject: [PATCH 032/227] sigc++/adaptors/bind.h: Make bind_functor::bound_ public It's used by sigc::visitor::do_visit_each(). Add a test case in tests/test_bind.cc. Fixes #26 --- sigc++/adaptors/bind.h | 3 ++- tests/test_bind.cc | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/sigc++/adaptors/bind.h b/sigc++/adaptors/bind.h index 7088c9f6..7c187d1f 100644 --- a/sigc++/adaptors/bind.h +++ b/sigc++/adaptors/bind.h @@ -161,7 +161,7 @@ struct bind_functor : public adapts { } -private: + // public to avoid template friend declarations (used by visitor::do_visit_each()) /// The arguments bound to the functor. std::tuple...> bound_; }; @@ -202,6 +202,7 @@ struct bind_functor<-1, T_functor, T_type...> : public adapts { } + // public to avoid template friend declarations (used by visitor::do_visit_each()) /// The argument bound to the functor. std::tuple...> bound_; }; diff --git a/tests/test_bind.cc b/tests/test_bind.cc index 7d4a3546..80dc9ea1 100644 --- a/tests/test_bind.cc +++ b/tests/test_bind.cc @@ -146,11 +146,19 @@ main(int argc, char* argv[]) sigc::slot sl; { + // Test without a positional template argument to std::bind(). book guest_book("karl"); sl = sigc::bind(&egon, std::ref(guest_book)); sl(); result_stream << " " << static_cast(guest_book); util->check_result(result_stream, "egon(string 'karl') egon was here"); + + // Test with a positional template argument to std::bind<>(). + guest_book.get_name() = "ove"; + sl = sigc::bind<0>(&egon, std::ref(guest_book)); + sl(); + result_stream << " " << static_cast(guest_book); + util->check_result(result_stream, "egon(string 'ove') egon was here"); } // auto-disconnect sl(); From a87f57feca7aded51f7eb99f3cdba3925aeb8267 Mon Sep 17 00:00:00 2001 From: Murray Cumming Date: Sun, 27 Oct 2019 21:49:45 +0100 Subject: [PATCH 033/227] GitHub Actions CI: autotools-clang-8: Don't try to use Ubuntu 19.10 The uses: line was actually a separate step that didn't influence the following step. Ubuntu 18.04 (what GitHub actions uses for "ubuntu-latest") actually has clang-8 anyway. --- .github/workflows/autotools-clang-8.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/autotools-clang-8.yml b/.github/workflows/autotools-clang-8.yml index 69416f3f..8e2e4234 100644 --- a/.github/workflows/autotools-clang-8.yml +++ b/.github/workflows/autotools-clang-8.yml @@ -9,7 +9,6 @@ jobs: steps: - uses: actions/checkout@v1 - - uses: docker://ubuntu:19.10 - name: Build run: | sudo apt update From b486a13e14cd2596532e97bd089b85742dcba8e3 Mon Sep 17 00:00:00 2001 From: Murray Cumming Date: Sun, 27 Oct 2019 21:27:13 +0100 Subject: [PATCH 034/227] GitHub Actions CI: Add a clang++ 9 build This uses a newer Ubuntu version by specifying a different docker image. Because of that, we no longer need to use sudo with apt. --- .github/workflows/autotools-clang-9.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/autotools-clang-9.yml diff --git a/.github/workflows/autotools-clang-9.yml b/.github/workflows/autotools-clang-9.yml new file mode 100644 index 00000000..b2f9af65 --- /dev/null +++ b/.github/workflows/autotools-clang-9.yml @@ -0,0 +1,24 @@ +name: "CI: autotools: clang 9" + +on: [push] + +jobs: + build: + + runs-on: ubuntu-latest + container: ubuntu:19.10 + + steps: + - uses: actions/checkout@v1 + - name: Build + run: | + apt update + apt install mm-common clang-9 --yes + export CXX=clang++-9 + ./autogen.sh --enable-warnings=fatal + ./configure + make + - name: Test + run: make check + - name: Distcheck + run: make distcheck From 94f2fe5e8c62c001da9cbbbd14e5efa6a0302df6 Mon Sep 17 00:00:00 2001 From: Murray Cumming Date: Sun, 27 Oct 2019 22:21:51 +0100 Subject: [PATCH 035/227] GitHub Actions CI: Specify CXX before make distcheck As in the build step. Otherwise, the distcheck's configure run will just pick up the default compiler again. --- .github/workflows/autotools-clang-5.yml | 5 ++++- .github/workflows/autotools-clang-6.yml | 5 ++++- .github/workflows/autotools-clang-7.yml | 5 ++++- .github/workflows/autotools-clang-8.yml | 5 ++++- .github/workflows/autotools-clang-9.yml | 5 ++++- .github/workflows/autotools-gcc-7.yml | 5 ++++- .github/workflows/autotools-gcc-8.yml | 5 ++++- .github/workflows/autotools-gcc-9.yml | 5 ++++- 8 files changed, 32 insertions(+), 8 deletions(-) diff --git a/.github/workflows/autotools-clang-5.yml b/.github/workflows/autotools-clang-5.yml index 69fa1403..84b3a464 100644 --- a/.github/workflows/autotools-clang-5.yml +++ b/.github/workflows/autotools-clang-5.yml @@ -20,4 +20,7 @@ jobs: - name: Test run: make check - name: Distcheck - run: make distcheck + run: | + # distcheck runs configure again so we need to specify CXX again. + export CXX=clang++-5.0 + make distcheck diff --git a/.github/workflows/autotools-clang-6.yml b/.github/workflows/autotools-clang-6.yml index a2643db0..61697ae0 100644 --- a/.github/workflows/autotools-clang-6.yml +++ b/.github/workflows/autotools-clang-6.yml @@ -20,4 +20,7 @@ jobs: - name: Test run: make check - name: Distcheck - run: make distcheck + run: | + # distcheck runs configure again so we need to specify CXX again. + export CXX=clang++-6.0 + make distcheck diff --git a/.github/workflows/autotools-clang-7.yml b/.github/workflows/autotools-clang-7.yml index 4aefe089..bd5da679 100644 --- a/.github/workflows/autotools-clang-7.yml +++ b/.github/workflows/autotools-clang-7.yml @@ -20,4 +20,7 @@ jobs: - name: Test run: make check - name: Distcheck - run: make distcheck + run: | + # distcheck runs configure again so we need to specify CXX again. + export CXX=clang++-7 + make distcheck diff --git a/.github/workflows/autotools-clang-8.yml b/.github/workflows/autotools-clang-8.yml index 8e2e4234..2344588b 100644 --- a/.github/workflows/autotools-clang-8.yml +++ b/.github/workflows/autotools-clang-8.yml @@ -20,4 +20,7 @@ jobs: - name: Test run: make check - name: Distcheck - run: make distcheck + run: | + # distcheck runs configure again so we need to specify CXX again. + export CXX=clang++-8 + make distcheck diff --git a/.github/workflows/autotools-clang-9.yml b/.github/workflows/autotools-clang-9.yml index b2f9af65..cde6e749 100644 --- a/.github/workflows/autotools-clang-9.yml +++ b/.github/workflows/autotools-clang-9.yml @@ -21,4 +21,7 @@ jobs: - name: Test run: make check - name: Distcheck - run: make distcheck + run: | + # distcheck runs configure again so we need to specify CXX again. + export CXX=clang++-9 + make distcheck diff --git a/.github/workflows/autotools-gcc-7.yml b/.github/workflows/autotools-gcc-7.yml index 31918c18..7996cdff 100644 --- a/.github/workflows/autotools-gcc-7.yml +++ b/.github/workflows/autotools-gcc-7.yml @@ -20,4 +20,7 @@ jobs: - name: Test run: make check - name: Distcheck - run: make distcheck + run: | + # distcheck runs configure again so we need to specify CXX again. + export CXX=g++-7 + make distcheck diff --git a/.github/workflows/autotools-gcc-8.yml b/.github/workflows/autotools-gcc-8.yml index 08e9b132..9b7279d6 100644 --- a/.github/workflows/autotools-gcc-8.yml +++ b/.github/workflows/autotools-gcc-8.yml @@ -20,4 +20,7 @@ jobs: - name: Test run: make check - name: Distcheck - run: make distcheck + run: | + # distcheck runs configure again so we need to specify CXX again. + export CXX=g++-8 + make distcheck diff --git a/.github/workflows/autotools-gcc-9.yml b/.github/workflows/autotools-gcc-9.yml index 9f4c1261..cdfb3ea9 100644 --- a/.github/workflows/autotools-gcc-9.yml +++ b/.github/workflows/autotools-gcc-9.yml @@ -21,4 +21,7 @@ jobs: - name: Test run: make check - name: Distcheck - run: make distcheck + run: | + # distcheck runs configure again so we need to specify CXX again. + export CXX=g++-9 + make distcheck From 8d747d775ae9da0a7703d28333dc326d81b36120 Mon Sep 17 00:00:00 2001 From: Murray Cumming Date: Mon, 28 Oct 2019 11:23:30 +0100 Subject: [PATCH 036/227] Build: Add target to format code with clang-format This lets us do "make format" to reformat the code. --- Makefile.am | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Makefile.am b/Makefile.am index 1e4fc38f..a431b2b0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -46,3 +46,9 @@ DISTCLEANFILES = MSVC_NMake/sigc++config.h # Optional: auto-generate the ChangeLog file from the git log on make dist include $(top_srcdir)/build/dist-changelog.am + +# Run clang-format over all the files, to reformat them. +# (We don't use xargs here because that wouldn't let us specify different +# clang-format versions via a bash alias.) +format: + clang-format -i `find . -name "*.h" -or -name "*.cc"` From 294ce7177c5315e2ada29acd184900dcda4289c8 Mon Sep 17 00:00:00 2001 From: Murray Cumming Date: Mon, 28 Oct 2019 12:16:22 +0100 Subject: [PATCH 037/227] Reformat code with make format --- sigc++/adaptors/adaptor_trait.h | 17 +++--- sigc++/adaptors/adapts.h | 2 +- sigc++/adaptors/bind.h | 30 +++++----- sigc++/adaptors/bind_return.h | 19 +++--- sigc++/adaptors/bound_argument.h | 20 +++---- sigc++/adaptors/compose.h | 31 +++++----- sigc++/adaptors/exception_catch.h | 10 ++-- sigc++/adaptors/hide.h | 16 ++--- sigc++/adaptors/retype.h | 24 ++++---- sigc++/adaptors/retype_return.h | 23 ++++---- sigc++/adaptors/track_obj.h | 16 ++--- sigc++/adaptors/tuple_visitor_visit_each.h | 4 +- sigc++/connection.cc | 19 ++---- sigc++/functors/functor_trait.h | 8 +-- sigc++/functors/mem_fun.h | 52 ++++++++-------- sigc++/functors/ptr_fun.h | 11 ++-- sigc++/functors/slot.h | 39 ++++++------ sigc++/functors/slot_base.cc | 8 +-- sigc++/functors/slot_base.h | 9 +-- sigc++/limit_reference.h | 8 +-- sigc++/member_method_trait.h | 40 ++++++------- sigc++/reference_wrapper.h | 10 ++-- sigc++/signal.h | 39 ++++++------ sigc++/signal_base.cc | 20 +++---- sigc++/signal_base.h | 11 +--- sigc++/trackable.cc | 11 +--- sigc++/tuple-utils/tuple_cdr.h | 27 +++++---- sigc++/tuple-utils/tuple_end.h | 53 ++++++++++------- sigc++/tuple-utils/tuple_for_each.h | 18 +++--- sigc++/tuple-utils/tuple_start.h | 48 ++++++++------- sigc++/tuple-utils/tuple_transform_each.h | 69 ++++++++++++---------- sigc++/type_traits.h | 14 ++--- sigc++/visit_each.h | 29 +++++---- sigc++/weak_raw_ptr.h | 36 +++++------ tests/benchmark.cc | 39 +++++++----- tests/test_accum_iter.cc | 7 +-- tests/test_accumulated.cc | 6 +- tests/test_bind.cc | 4 +- tests/test_bind_refptr.cc | 66 ++++++++++----------- tests/test_cpp11_lambda.cc | 24 ++++---- tests/test_disconnect.cc | 2 +- tests/test_limit_reference.cc | 4 +- tests/test_mem_fun.cc | 40 +++++++------ tests/test_signal.cc | 5 +- tests/test_size.cc | 37 ++++++------ tests/test_track_obj.cc | 1 + tests/test_trackable_move.cc | 4 +- tests/test_tuple_for_each.cc | 20 +++---- tests/test_tuple_transform_each.cc | 22 +++---- tests/test_visit_each.cc | 22 ++++--- tests/test_visit_each_trackable.cc | 14 +++-- tests/test_weak_raw_ptr.cc | 27 ++++----- tests/testutilities.cc | 4 +- 53 files changed, 566 insertions(+), 573 deletions(-) diff --git a/sigc++/adaptors/adaptor_trait.h b/sigc++/adaptors/adaptor_trait.h index fe7f3e79..34ef4010 100644 --- a/sigc++/adaptors/adaptor_trait.h +++ b/sigc++/adaptors/adaptor_trait.h @@ -82,7 +82,7 @@ namespace sigc * * @ingroup adaptors */ -template +template struct adaptor_functor : public adaptor_base { /** Invokes the wrapped functor passing on the arguments. @@ -94,7 +94,7 @@ struct adaptor_functor : public adaptor_base * @param arg Arguments to be passed on to the functor. * @return The return value of the functor invocation. */ - template + template decltype(auto) operator()(T_arg&&... arg) const { return std::invoke(functor_, std::forward(arg)...); @@ -112,7 +112,7 @@ struct adaptor_functor : public adaptor_base * function pointer. * @param type Pointer to function or class method to invoke from operator()(). */ - template + template explicit adaptor_functor(const T_type& type) : functor_(type) { } @@ -129,10 +129,10 @@ struct adaptor_functor : public adaptor_base * * @ingroup adaptors */ -template +template struct visitor> { - template + template static void do_visit_each(const T_action& action, const adaptor_functor& target) { sigc::visit_each(action, target.functor_); @@ -149,15 +149,14 @@ struct visitor> * * @ingroup adaptors */ -template ::value> +template::value> struct adaptor_trait; - /** Trait that specifies the adaptor version of a functor type. * This template specialization is used for types that inherit from adaptor_base. * adaptor_type is equal to @p T_functor in this case. */ -template +template struct adaptor_trait { using adaptor_type = T_functor; @@ -169,7 +168,7 @@ struct adaptor_trait * The latter are converted into @p pointer_functor or @p mem_functor types. * adaptor_type is equal to @p adaptor_functor. */ -template +template struct adaptor_trait { private: diff --git a/sigc++/adaptors/adapts.h b/sigc++/adaptors/adapts.h index 959f1521..08ae0025 100644 --- a/sigc++/adaptors/adapts.h +++ b/sigc++/adaptors/adapts.h @@ -91,7 +91,7 @@ namespace sigc * * @ingroup adaptors */ -template +template struct adapts : public adaptor_base { private: diff --git a/sigc++/adaptors/bind.h b/sigc++/adaptors/bind.h index 7c187d1f..1d89ba0c 100644 --- a/sigc++/adaptors/bind.h +++ b/sigc++/adaptors/bind.h @@ -102,7 +102,7 @@ namespace sigc namespace internal { -template +template struct TransformEachInvoker { // We take T_element as non-const because invoke() is not const. @@ -122,7 +122,7 @@ struct TransformEachInvoker * * @ingroup bind */ -template +template struct bind_functor : public adapts { /** Invokes the wrapped functor passing on the arguments. @@ -130,7 +130,7 @@ struct bind_functor : public adapts * @param arg Arguments to be passed on to the functor. * @return The return value of the functor invocation. */ - template + template decltype(auto) operator()(T_arg&&... arg) { // For instance, if I_location is 1, and arg has 4 arguments, @@ -171,7 +171,7 @@ struct bind_functor : public adapts * * @ingroup bind */ -template +template struct bind_functor<-1, T_functor, T_type...> : public adapts { public: @@ -180,7 +180,7 @@ struct bind_functor<-1, T_functor, T_type...> : public adapts * @param arg Arguments to be passed on to the functor. * @return The return value of the functor invocation. */ - template + template decltype(auto) operator()(T_arg&&... arg) { // For instance, if arg has 4 arguments, @@ -215,12 +215,12 @@ struct bind_functor<-1, T_functor, T_type...> : public adapts * * @ingroup bind */ -template +template struct visitor> { - template - static void do_visit_each( - const T_action& action, const bind_functor& target) + template + static void do_visit_each(const T_action& action, + const bind_functor& target) { sigc::visit_each(action, target.functor_); sigc::visit_each(action, std::get<0>(target.bound_)); @@ -234,12 +234,12 @@ struct visitor> * * @ingroup bind */ -template +template struct visitor> { - template - static void do_visit_each( - const T_action& action, const bind_functor<-1, T_functor, T_type...>& target) + template + static void do_visit_each(const T_action& action, + const bind_functor<-1, T_functor, T_type...>& target) { sigc::visit_each(action, target.functor_); @@ -260,7 +260,7 @@ struct visitor> * * @ingroup bind */ -template +template inline decltype(auto) bind(const T_functor& func, T_bound... b) { @@ -277,7 +277,7 @@ bind(const T_functor& func, T_bound... b) * * @ingroup bind */ -template +template inline decltype(auto) bind(const T_functor& func, T_type... b) { diff --git a/sigc++/adaptors/bind_return.h b/sigc++/adaptors/bind_return.h index cb5a26a6..b02f9367 100644 --- a/sigc++/adaptors/bind_return.h +++ b/sigc++/adaptors/bind_return.h @@ -34,7 +34,7 @@ namespace sigc * * @ingroup bind */ -template +template struct bind_return_functor : public adapts { /** Invokes the wrapped functor dropping its return value. @@ -46,7 +46,7 @@ struct bind_return_functor : public adapts * @param a Arguments to be passed on to the functor. * @return The fixed return value. */ - template + template inline typename unwrap_reference::type operator()(T_arg... a) { std::invoke(this->functor_, a...); @@ -57,8 +57,7 @@ struct bind_return_functor : public adapts * @param functor Functor to invoke from operator()(). * @param ret_value Value to return from operator()(). */ - bind_return_functor( - type_trait_take_t functor, type_trait_take_t ret_value) + bind_return_functor(type_trait_take_t functor, type_trait_take_t ret_value) : adapts(functor), ret_value_(ret_value) { } @@ -67,7 +66,7 @@ struct bind_return_functor : public adapts bound_argument ret_value_; // public, so that visit_each() can access it }; -template +template typename unwrap_reference::type bind_return_functor::operator()() { @@ -83,12 +82,12 @@ bind_return_functor::operator()() * * @ingroup bind */ -template +template struct visitor> { - template - static void do_visit_each( - const T_action& action, const bind_return_functor& target) + template + static void do_visit_each(const T_action& action, + const bind_return_functor& target) { sigc::visit_each(action, target.ret_value_); sigc::visit_each(action, target.functor_); @@ -105,7 +104,7 @@ struct visitor> * * @ingroup bind */ -template +template inline bind_return_functor bind_return(const T_functor& functor, T_return ret_value) { diff --git a/sigc++/adaptors/bound_argument.h b/sigc++/adaptors/bound_argument.h index a0ca6da3..c9899dfd 100644 --- a/sigc++/adaptors/bound_argument.h +++ b/sigc++/adaptors/bound_argument.h @@ -46,7 +46,7 @@ namespace sigc * The general template implementation is used for parameters that are passed by value. * @e T_type The type of the bound argument. */ -template +template class bound_argument { public: @@ -76,17 +76,14 @@ class bound_argument * returned by bind_return() by reference, specialized for std::reference_wrapper<> types. * @e T_wrapped The type of the bound argument. */ -template +template class bound_argument> { public: /** Constructor. * @param arg The argument to bind. */ - bound_argument(const std::reference_wrapper& arg) - : visited_(unwrap(arg)) - { - } + bound_argument(const std::reference_wrapper& arg) : visited_(unwrap(arg)) {} /** Retrieve the entity to visit in visit_each(). * @return The limited_reference to the bound argument. @@ -108,17 +105,14 @@ class bound_argument> * returned by bind_return() by const reference, specialized for const reference_wrapper<> types. * - @e T_wrapped The type of the bound argument. */ -template +template class bound_argument> { public: /** Constructor. * @param arg The argument to bind. */ - bound_argument(const std::reference_wrapper& arg) - : visited_(unwrap(arg)) - { - } + bound_argument(const std::reference_wrapper& arg) : visited_(unwrap(arg)) {} /** Retrieve the entity to visit in visit_each(). * @return The const_limited_reference to the bound argument. @@ -145,10 +139,10 @@ class bound_argument> * @param action The functor to invoke. * @param arg The visited instance. */ -template +template struct visitor> { - template + template static void do_visit_each(const T_action& action, const bound_argument& arg) { sigc::visit_each(action, arg.visit()); diff --git a/sigc++/adaptors/compose.h b/sigc++/adaptors/compose.h index 5a3616f1..3fadcebe 100644 --- a/sigc++/adaptors/compose.h +++ b/sigc++/adaptors/compose.h @@ -59,10 +59,10 @@ namespace sigc * * @ingroup compose */ -template +template struct compose1_functor : public adapts { - template + template decltype(auto) operator()(T_arg&&... a) { return std::invoke(this->functor_, get_(std::forward(a)...)); @@ -91,10 +91,10 @@ struct compose1_functor : public adapts * * @ingroup compose */ -template +template struct compose2_functor : public adapts { - template + template decltype(auto) operator()(T_arg... a) { return std::invoke(this->functor_, get1_(a...), get2_(a...)); @@ -106,8 +106,7 @@ struct compose2_functor : public adapts * @param getter1 Functor to invoke from operator()(). * @param getter2 Functor to invoke from operator()(). */ - compose2_functor( - const T_setter& setter, const T_getter1& getter1, const T_getter2& getter2) + compose2_functor(const T_setter& setter, const T_getter1& getter1, const T_getter2& getter2) : adapts(setter), get1_(getter1), get2_(getter2) { } @@ -124,12 +123,12 @@ struct compose2_functor : public adapts * * @ingroup compose */ -template +template struct visitor> { - template - static void do_visit_each( - const T_action& action, const compose1_functor& target) + template + static void do_visit_each(const T_action& action, + const compose1_functor& target) { sigc::visit_each(action, target.functor_); sigc::visit_each(action, target.get_); @@ -143,12 +142,12 @@ struct visitor> * * @ingroup compose */ -template +template struct visitor> { - template - static void do_visit_each( - const T_action& action, const compose2_functor& target) + template + static void do_visit_each(const T_action& action, + const compose2_functor& target) { sigc::visit_each(action, target.functor_); sigc::visit_each(action, target.get1_); @@ -166,7 +165,7 @@ struct visitor> * * @ingroup compose */ -template +template inline compose1_functor compose(const T_setter& setter, const T_getter& getter) { @@ -184,7 +183,7 @@ compose(const T_setter& setter, const T_getter& getter) * * @ingroup compose */ -template +template inline compose2_functor compose(const T_setter& setter, const T_getter1& getter1, const T_getter2& getter2) { diff --git a/sigc++/adaptors/exception_catch.h b/sigc++/adaptors/exception_catch.h index ed60d0c5..a7ccf9aa 100644 --- a/sigc++/adaptors/exception_catch.h +++ b/sigc++/adaptors/exception_catch.h @@ -73,7 +73,7 @@ namespace sigc * @ingroup adaptors */ -template +template struct exception_catch_functor : public adapts { decltype(auto) operator()() @@ -88,7 +88,7 @@ struct exception_catch_functor : public adapts } } - template + template decltype(auto) operator()(T_arg... a) { try @@ -111,10 +111,10 @@ struct exception_catch_functor : public adapts #ifndef DOXYGEN_SHOULD_SKIP_THIS // template specialization of visitor<>::do_visit_each<>(action, functor): -template +template struct visitor> { - template + template static void do_visit_each(const T_action& action, const exception_catch_functor& target) { @@ -124,7 +124,7 @@ struct visitor> }; #endif // DOXYGEN_SHOULD_SKIP_THIS -template +template inline decltype(auto) exception_catch(const T_functor& func, const T_catcher& catcher) { diff --git a/sigc++/adaptors/hide.h b/sigc++/adaptors/hide.h index 8d9d1455..ac8a1a0c 100644 --- a/sigc++/adaptors/hide.h +++ b/sigc++/adaptors/hide.h @@ -84,14 +84,14 @@ namespace sigc * * @ingroup hide */ -template +template struct hide_functor : public adapts { /** Invokes the wrapped functor, ignoring the argument at index @e I_location (0-indexed). * @param a Arguments to be passed on to the functor, apart from the ignored argument. * @return The return value of the functor invocation. */ - template + template decltype(auto) operator()(T_arg&&... a) { constexpr auto size = sizeof...(T_arg); @@ -119,12 +119,12 @@ struct hide_functor : public adapts * * @ingroup hide */ -template +template struct visitor> { - template - static void do_visit_each( - const T_action& action, const hide_functor& target) + template + static void do_visit_each(const T_action& action, + const hide_functor& target) { sigc::visit_each(action, target.functor_); } @@ -141,7 +141,7 @@ struct visitor> * * @ingroup hide */ -template +template inline decltype(auto) hide(const T_functor& func) { @@ -157,7 +157,7 @@ hide(const T_functor& func) * * @ingroup hide */ -template +template inline decltype(auto) hide(const T_functor& func) { diff --git a/sigc++/adaptors/retype.h b/sigc++/adaptors/retype.h index a628f95f..948fe5cf 100644 --- a/sigc++/adaptors/retype.h +++ b/sigc++/adaptors/retype.h @@ -76,10 +76,10 @@ namespace sigc * * @ingroup retype */ -template +template struct retype_functor : public adapts { - template + template decltype(auto) operator()(T_arg... a) { return std::invoke(this->functor_, static_cast(a)...); @@ -89,9 +89,7 @@ struct retype_functor : public adapts * the functor. * @param functor Functor to invoke from operator()(). */ - explicit retype_functor(type_trait_take_t functor) : adapts(functor) - { - } + explicit retype_functor(type_trait_take_t functor) : adapts(functor) {} }; #ifndef DOXYGEN_SHOULD_SKIP_THIS @@ -102,12 +100,12 @@ struct retype_functor : public adapts * * @ingroup retype */ -template +template struct visitor> { - template - static void do_visit_each( - const T_action& action, const retype_functor& target) + template + static void do_visit_each(const T_action& action, + const retype_functor& target) { sigc::visit_each(action, target.functor_); } @@ -123,7 +121,9 @@ struct visitor> * * @ingroup retype */ -template