From 5586a71f42b047c2542425a6a296a557d7593e6b Mon Sep 17 00:00:00 2001 From: Stuart Dootson Date: Mon, 14 Oct 2019 13:23:50 +0100 Subject: [PATCH 001/202] 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 002/202] 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 003/202] 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 004/202] 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 005/202] 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 006/202] 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 007/202] 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 008/202] 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 009/202] 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 010/202] 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 011/202] 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 012/202] 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