diff options
author | Stuart Dootson <u404261@methods.local> | 2019-10-14 15:09:48 +0100 |
---|---|---|
committer | Murray Cumming <murrayc@murrayc.com> | 2019-10-25 12:57:31 +0200 |
commit | e82f0d341b5671ba81734591cc60b7179bc0a3d9 (patch) | |
tree | b2137c511f172e8a0e6cca9d35250c6fc15f6cb7 | |
parent | e7d6878da2af809078cd867ff37e29448e507960 (diff) | |
download | sigc++-e82f0d341b5671ba81734591cc60b7179bc0a3d9.tar.gz |
MSVC build: Silence 'C4100: unreferenced formal parameter' warnings
Added 'static_cast<void>(parameter-name)' in all paths where the parameter isn't used
-rw-r--r-- | sigc++/tuple-utils/tuple_end.h | 1 | ||||
-rw-r--r-- | sigc++/tuple-utils/tuple_for_each.h | 2 | ||||
-rw-r--r-- | sigc++/tuple-utils/tuple_transform_each.h | 1 | ||||
-rw-r--r-- | sigc++/visit_each.h | 2 |
4 files changed, 6 insertions, 0 deletions
diff --git a/sigc++/tuple-utils/tuple_end.h b/sigc++/tuple-utils/tuple_end.h index 2f3572e..72526aa 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<void>(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 e179ffe..8659d65 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<T_visitor, size, T_extras...>::tuple_for_each( std::forward<T>(t), std::forward<T_extras>(extras)...); + } else { + static_cast<void>(t); } } diff --git a/sigc++/tuple-utils/tuple_transform_each.h b/sigc++/tuple-utils/tuple_transform_each.h index 023cdbd..8d73764 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<void>(t_original); //Do nothing because the tuple has no elements. return std::forward<T_current>(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 46a0504..5f92120 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<sigc::trackable, T_type>) { std::invoke(action_, type); + } else { + static_cast<void>(type); } } |