Skip to content

Commit 0a1c269

Browse files
committed
Fix more warnings caught by CI build
1 parent bf6f3fe commit 0a1c269

File tree

8 files changed

+22
-18
lines changed

8 files changed

+22
-18
lines changed

test/test/disconnected.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ struct non_agile_abandoned_action : implements<non_agile_abandoned_action, IAsyn
148148
{
149149
non_agile_abandoned_action(delegate<> disconnect) : m_disconnect(disconnect) {}
150150

151-
static fire_and_forget final_release(std::unique_ptr<non_agile_abandoned_action> self)
151+
static fire_and_forget final_release(std::unique_ptr<non_agile_abandoned_action> /*self*/)
152152
{
153153
// The C++/WinRT m_handler is agile but not context-aware,
154154
// so we need to make sure to release it from the context it

test/test/event_deferral.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ namespace
3838
// This exercises the short-circuit logic in deferrable_event_args.
3939
auto NoDeferralHandler()
4040
{
41-
return [=](Class const& sender, DeferrableEventArgs const& args)
41+
return [=, this](Class const& sender, DeferrableEventArgs const& args)
4242
{
4343
REQUIRE(sender == c);
4444
args.IncrementCounter();
@@ -50,7 +50,7 @@ namespace
5050
// deferrable_event_args.
5151
auto PointlessDeferralHandler()
5252
{
53-
return [=](Class const& sender, DeferrableEventArgs const& args)
53+
return [=, this](Class const& sender, DeferrableEventArgs const& args)
5454
{
5555
REQUIRE(sender == c);
5656
auto deferral = args.GetDeferral();
@@ -61,7 +61,7 @@ namespace
6161

6262
auto TakeDeferralHandler(int startState, int finishState)
6363
{
64-
return [=](Class sender, DeferrableEventArgs args) -> fire_and_forget
64+
return [=, this](Class sender, DeferrableEventArgs args) -> fire_and_forget
6565
{
6666
REQUIRE(sender == c);
6767
auto deferral = args.GetDeferral();

test/test/inspectable_interop.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,18 @@ namespace
4141
#ifdef __GNUC__
4242
#pragma GCC diagnostic push
4343
#pragma GCC diagnostic ignored "-Woverloaded-virtual"
44+
#endif
45+
#ifdef __clang__
46+
#pragma clang diagnostic push
47+
#pragma clang diagnostic ignored "-Woverloaded-virtual"
4448
#endif
4549
Windows::Foundation::TrustLevel GetTrustLevel() const noexcept
4650
{
4751
return Windows::Foundation::TrustLevel::PartialTrust;
4852
}
53+
#ifdef __clang__
54+
#pragma clang diagnostic pop
55+
#endif
4956
#ifdef __GNUC__
5057
#pragma GCC diagnostic pop
5158
#endif

test/test/multi_threaded_map.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ namespace
9090
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
9191
using node_type = typename inner::node_type;
9292

93-
mapped_type& operator[](const key_type& key)
93+
mapped_type& operator[](const key_type& /*key*/)
9494
{
9595
auto guard = concurrency_guard::lock_nonconst();
9696
concurrency_guard::call_hook(collection_action::at);

test/test/out_params.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ TEST_CASE("out_params")
134134
REQUIRE(value[3] == nullptr);
135135
}
136136
{
137-
std::array<Struct, 3> value{ {L"First", L"Second"} };
137+
std::array<Struct, 3> value{ { { L"First" }, { L"Second"} } };
138138
object.RefStructArray(value);
139139
REQUIRE(value[0].First == L"1");
140140
REQUIRE(value[0].Second == L"2");
@@ -260,7 +260,7 @@ TEST_CASE("out_params")
260260
REQUIRE(value[3] == nullptr);
261261
}
262262
{
263-
std::array<Struct, 3> value{ {L"First", L"Second"} };
263+
std::array<Struct, 3> value{ { { L"First" }, { L"Second"} } };
264264
REQUIRE_THROWS_AS(object.RefStructArray(value), hresult_invalid_argument);
265265
REQUIRE(value[0].First == L"");
266266
REQUIRE(value[0].Second == L"");

test/test/return_params_abi.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,6 @@ namespace winrt
1010

1111
using namespace winrt;
1212

13-
namespace
14-
{
15-
hstring to_hstring(::IInspectable* raw)
16-
{
17-
winrt::IInspectable object;
18-
copy_from_abi(object, raw);
19-
return object.as<IStringable>().ToString();
20-
}
21-
}
22-
2313
TEST_CASE("return_params_abi")
2414
{
2515
Class object;

test/test/struct_delegate.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#include "pch.h"
2-
#include "winrt/test_component.delegates.h"
2+
#include "winrt/test_component.Delegates.h"
33

44
using namespace winrt;
55
using namespace test_component;

test/test_component/Class.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,14 @@ namespace winrt::test_component::implementation
519519

520520
namespace
521521
{
522+
#ifdef __clang__
523+
#pragma clang diagnostic push
524+
#pragma clang diagnostic ignored "-Wunused-function"
525+
#endif
522526
void ValidateStaticEventAutoRevoke() {
523527
auto x = winrt::test_component::Simple::StaticEvent(winrt::auto_revoke, [](auto&&, auto&&) {});
524528
}
529+
#ifdef __clang__
530+
#pragma clang diagnostic pop
531+
#endif
525532
}

0 commit comments

Comments
 (0)