Skip to content

Commit b2686ca

Browse files
committed
Fix a bunch of additional warnings that only show up one at a time. Probably not all fo them
1 parent 0a1c269 commit b2686ca

File tree

13 files changed

+58
-18
lines changed

13 files changed

+58
-18
lines changed

cppwinrt/component_writers.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,7 @@ catch (...) { return winrt::to_hresult(); }
754754
using implements_type = typename %_base::implements_type;
755755
using implements_type::implements_type;
756756
%%
757-
hstring GetRuntimeClassName() const
757+
hstring GetRuntimeClassName() const override
758758
{
759759
return L"%.%";
760760
}

strings/base_fast_forward.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ namespace winrt::impl
6363
std::atomic<uint32_t> m_references{ 1 };
6464

6565
fast_abi_forwarder(void* owner, guid const& iid, std::size_t offset) noexcept :
66-
m_vfptr(s_vtable), m_owner(static_cast<inspectable*>(owner)), m_iid(iid), m_offset(offset)
66+
m_vfptr(s_vtable), m_owner(static_cast<inspectable*>(owner)), m_offset(offset), m_iid(iid)
6767
{
6868
m_owner->AddRef();
6969
}
@@ -116,6 +116,11 @@ namespace winrt::impl
116116
return self->m_owner->GetTrustLevel(level);
117117
}
118118

119+
120+
#ifdef __clang__
121+
#pragma clang diagnostic push
122+
#pragma clang diagnostic ignored "-Wmicrosoft-cast"
123+
#endif
119124
static inline void* const s_vtable[] =
120125
{
121126
QueryInterface,
@@ -125,6 +130,9 @@ namespace winrt::impl
125130
GetRuntimeClassName,
126131
GetTrustLevel,
127132
% };
133+
#ifdef __clang__
134+
#pragma clang diagnostic pop
135+
#endif
128136
};
129137

130138
// Enforce assumptions made by thunk asm code

strings/base_string.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -574,8 +574,8 @@ namespace winrt::impl
574574
// when non-const (e.g. ranges::filter_view) so taking a const reference
575575
// as parameter wouldn't work for all scenarios.
576576
auto const size = std::formatted_size(args...);
577-
WINRT_ASSERT(size < UINT_MAX);
578-
auto const size32 = static_cast<uint32_t>(size);
577+
WINRT_ASSERT(size < INT_MAX);
578+
auto const size32 = static_cast<int32_t>(size);
579579

580580
hstring_builder builder(size32);
581581
WINRT_VERIFY_(size32, std::format_to_n(builder.data(), size32, args...).size);

test/old_tests/Composable/Base.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ namespace winrt::Composable::implementation
4343

4444
int32_t Base::ProtectedMethod()
4545
{
46-
return 0xDEADBEEF;
46+
return static_cast<int32_t>(0xDEADBEEF);
4747
}
4848

4949
hstring Base::Name() const

test/old_tests/UnitTests/Boxing2.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,19 @@ namespace
4141
REQUIRE(unbox_value_or<T>(wrong_type, v2) == v2);
4242
}
4343

44-
REQUIRE(object.as<T>() == v1);
45-
REQUIRE(object.try_as<T>() == v1);
46-
REQUIRE(nothing.try_as<T>() == std::nullopt);
44+
REQUIRE(object.template as<T>() == v1);
45+
REQUIRE(object.template try_as<T>() == v1);
46+
REQUIRE(nothing.template try_as<T>() == std::nullopt);
4747
REQUIRE(wrong_type.try_as<T>() == std::nullopt);
4848

4949
T result{ v2 };
50-
object.as<T>(result);
50+
object.template as<T>(result);
5151
REQUIRE(result == v1);
5252

5353
result = v1;
5454
REQUIRE(v1 != empty<T>()); // Test must pass a v1 that is not equal to the empty value.
5555

56-
REQUIRE(!nothing.try_as<T>(result));
56+
REQUIRE(!nothing.template try_as<T>(result));
5757
REQUIRE(result == empty<T>()); // try_as explicitly empties the result on failure
5858

5959
result = v1;

test/old_tests/UnitTests/Composable.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace
1414
constexpr auto Base_OverridableMethod{ L"Base::OverridableMethod"sv };
1515
constexpr auto Base_OverridableVirtualMethod{ L"Base::OverridableVirtualMethod"sv };
1616
constexpr auto Base_OverridableNoexceptMethod{ 42 };
17-
constexpr auto Base_ProtectedMethod{ 0xDEADBEEF };
17+
constexpr auto Base_ProtectedMethod{ static_cast<int32_t>(0xDEADBEEF) };
1818

1919
constexpr auto Derived_VirtualMethod{ L"Derived::VirtualMethod"sv };
2020
constexpr auto Derived_OverridableVirtualMethod{ L"Derived::OverridableVirtualMethod"sv };

test/old_tests/UnitTests/IInspectable_GetRuntimeClassName.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,17 @@ struct Test_GetRuntimeClassName_NoOverride : implements<Test_GetRuntimeClassName
1818

1919
struct Test_GetRuntimeClassName_Override : implements<Test_GetRuntimeClassName_Override, Windows::Foundation::IInspectable>
2020
{
21+
#ifdef __clang__
22+
#pragma clang diagnostic push
23+
#pragma clang diagnostic ignored "-Woverloaded-virtual"
24+
#endif
2125
hstring GetRuntimeClassName()
2226
{
2327
return L"GetRuntimeClassName";
2428
}
29+
#ifdef __clang__
30+
#pragma clang diagnostic pop
31+
#endif
2532
};
2633

2734
TEST_CASE("Test_GetRuntimeClassName_NoOverride")

test/old_tests/UnitTests/array.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ using namespace Windows::Security::Cryptography::Certificates;
1717
//
1818
// This is a helper to create a data reader for use in testing arrays.
1919
//
20-
static IAsyncOperation<IDataReader> CreateDataReader(std::initializer_list<byte> values)
20+
static IAsyncOperation<IDataReader> CreateDataReader(std::initializer_list<byte> /*values*/)
2121
{
2222
InMemoryRandomAccessStream stream;
2323
DataWriter writer(stream);

test/old_tests/UnitTests/produce.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,17 @@ struct produce_IInspectable_No_RuntimeClassName : implements<produce_IInspectabl
124124

125125
struct produce_IInspectable_RuntimeClassName : implements<produce_IInspectable_RuntimeClassName, Windows::Foundation::IInspectable>
126126
{
127+
#ifdef __clang__
128+
#pragma clang diagnostic push
129+
#pragma clang diagnostic ignored "-Woverloaded-virtual"
130+
#endif
127131
hstring GetRuntimeClassName()
128132
{
129133
return L"produce_IInspectable_RuntimeClassName";
130134
}
135+
#ifdef __clang__
136+
#pragma clang diagnostic pop
137+
#endif
131138
};
132139

133140
TEST_CASE("produce_IInspectable_RuntimeClassName")

test/old_tests/UnitTests/smart_pointers.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ using namespace Windows::Foundation;
77
using namespace Windows::Foundation::Collections;
88
using namespace Component;
99

10+
11+
#ifdef __clang__
12+
#pragma clang diagnostic ignored "-Wself-assign-overloaded"
13+
#pragma clang diagnostic ignored "-Wself-move"
14+
#endif
15+
1016
namespace
1117
{
1218
struct Type : implements<Type, IStringable>

0 commit comments

Comments
 (0)