Skip to content

Commit e82f0d3

Browse files
Stuart Dootsonmurraycu
authored andcommitted
MSVC build: Silence 'C4100: unreferenced formal parameter' warnings
Added 'static_cast<void>(parameter-name)' in all paths where the parameter isn't used
1 parent e7d6878 commit e82f0d3

File tree

4 files changed

+6
-0
lines changed

4 files changed

+6
-0
lines changed

sigc++/tuple-utils/tuple_end.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ tuple_end(T&& t) {
5656
static_assert(len <= size, "The tuple size must be less than or equal to the length.");
5757

5858
if constexpr(len == 0) {
59+
static_cast<void>(t);
5960
// Recursive calls to tuple_cdr() would result in this eventually,
6061
// but this avoids the extra work:
6162
return std::tuple<>();

sigc++/tuple-utils/tuple_for_each.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ tuple_for_each(T&& t, T_extras&&... extras)
103103
{
104104
detail::tuple_for_each_impl<T_visitor, size, T_extras...>::tuple_for_each(
105105
std::forward<T>(t), std::forward<T_extras>(extras)...);
106+
} else {
107+
static_cast<void>(t);
106108
}
107109
}
108110

sigc++/tuple-utils/tuple_transform_each.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ struct tuple_transform_each_impl {
3535
static decltype(auto)
3636
tuple_transform_each(T_current&& t, T_original& t_original) {
3737
if constexpr(size_from_index == 0) {
38+
static_cast<void>(t_original);
3839
//Do nothing because the tuple has no elements.
3940
return std::forward<T_current>(t);
4041
} else { //TODO: Should this compile without using else to contain the alternative code?

sigc++/visit_each.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ struct limit_trackable_target
4747
//Only call action_() if T_Type derives from trackable.
4848
if constexpr(is_base_of_or_same_v<sigc::trackable, T_type>) {
4949
std::invoke(action_, type);
50+
} else {
51+
static_cast<void>(type);
5052
}
5153
}
5254

0 commit comments

Comments
 (0)