Skip to content

Commit

Permalink
Silence clang-tidy warnings (#1438)
Browse files Browse the repository at this point in the history
  • Loading branch information
dunhor authored Oct 2, 2024
1 parent c5e0aae commit f9ec198
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 28 deletions.
44 changes: 22 additions & 22 deletions strings/base_collections_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ WINRT_EXPORT namespace winrt
auto First()
{
// NOTE: iterator's constructor requires shared access
auto guard = static_cast<D&>(*this).acquire_shared();
[[maybe_unused]] auto guard = static_cast<D&>(*this).acquire_shared();
return make<iterator>(static_cast<D*>(this));
}

Expand Down Expand Up @@ -161,7 +161,7 @@ WINRT_EXPORT namespace winrt

T Current() const
{
auto guard = m_owner->acquire_shared();
[[maybe_unused]] auto guard = m_owner->acquire_shared();
this->check_version(*m_owner);

if (m_current == m_end)
Expand All @@ -174,14 +174,14 @@ WINRT_EXPORT namespace winrt

bool HasCurrent() const
{
auto guard = m_owner->acquire_shared();
[[maybe_unused]] auto guard = m_owner->acquire_shared();
this->check_version(*m_owner);
return m_current != m_end;
}

bool MoveNext()
{
auto guard = m_owner->acquire_exclusive();
[[maybe_unused]] auto guard = m_owner->acquire_exclusive();
this->check_version(*m_owner);
if (m_current != m_end)
{
Expand All @@ -193,7 +193,7 @@ WINRT_EXPORT namespace winrt

uint32_t GetMany(array_view<T> values)
{
auto guard = m_owner->acquire_exclusive();
[[maybe_unused]] auto guard = m_owner->acquire_exclusive();
this->check_version(*m_owner);
return GetMany(values, typename std::iterator_traits<iterator_type>::iterator_category());
}
Expand Down Expand Up @@ -248,7 +248,7 @@ WINRT_EXPORT namespace winrt
{
T GetAt(uint32_t const index) const
{
auto guard = static_cast<D const&>(*this).acquire_shared();
[[maybe_unused]] auto guard = static_cast<D const&>(*this).acquire_shared();
if (index >= container_size())
{
throw hresult_out_of_bounds();
Expand All @@ -259,13 +259,13 @@ WINRT_EXPORT namespace winrt

uint32_t Size() const noexcept
{
auto guard = static_cast<D const&>(*this).acquire_shared();
[[maybe_unused]] auto guard = static_cast<D const&>(*this).acquire_shared();
return container_size();
}

bool IndexOf(T const& value, uint32_t& index) const noexcept
{
auto guard = static_cast<D const&>(*this).acquire_shared();
[[maybe_unused]] auto guard = static_cast<D const&>(*this).acquire_shared();
auto first = std::find_if(static_cast<D const&>(*this).get_container().begin(), static_cast<D const&>(*this).get_container().end(), [&](auto&& match)
{
return value == static_cast<D const&>(*this).unwrap_value(match);
Expand All @@ -277,7 +277,7 @@ WINRT_EXPORT namespace winrt

uint32_t GetMany(uint32_t const startIndex, array_view<T> values) const
{
auto guard = static_cast<D const&>(*this).acquire_shared();
[[maybe_unused]] auto guard = static_cast<D const&>(*this).acquire_shared();
if (startIndex >= container_size())
{
return 0;
Expand Down Expand Up @@ -308,7 +308,7 @@ WINRT_EXPORT namespace winrt
{
impl::removed_value<typename impl::container_type_t<D>::value_type> oldValue;

auto guard = static_cast<D&>(*this).acquire_exclusive();
[[maybe_unused]] auto guard = static_cast<D&>(*this).acquire_exclusive();
if (index >= static_cast<D const&>(*this).get_container().size())
{
throw hresult_out_of_bounds();
Expand All @@ -322,7 +322,7 @@ WINRT_EXPORT namespace winrt

void InsertAt(uint32_t const index, T const& value)
{
auto guard = static_cast<D&>(*this).acquire_exclusive();
[[maybe_unused]] auto guard = static_cast<D&>(*this).acquire_exclusive();
if (index > static_cast<D const&>(*this).get_container().size())
{
throw hresult_out_of_bounds();
Expand All @@ -336,7 +336,7 @@ WINRT_EXPORT namespace winrt
{
impl::removed_value<typename impl::container_type_t<D>::value_type> removedValue;

auto guard = static_cast<D&>(*this).acquire_exclusive();
[[maybe_unused]] auto guard = static_cast<D&>(*this).acquire_exclusive();
if (index >= static_cast<D const&>(*this).get_container().size())
{
throw hresult_out_of_bounds();
Expand All @@ -350,7 +350,7 @@ WINRT_EXPORT namespace winrt

void Append(T const& value)
{
auto guard = static_cast<D&>(*this).acquire_exclusive();
[[maybe_unused]] auto guard = static_cast<D&>(*this).acquire_exclusive();
this->increment_version();
static_cast<D&>(*this).get_container().push_back(static_cast<D const&>(*this).wrap_value(value));
}
Expand All @@ -359,7 +359,7 @@ WINRT_EXPORT namespace winrt
{
impl::removed_value<typename impl::container_type_t<D>::value_type> removedValue;

auto guard = static_cast<D&>(*this).acquire_exclusive();
[[maybe_unused]] auto guard = static_cast<D&>(*this).acquire_exclusive();
if (static_cast<D const&>(*this).get_container().empty())
{
throw hresult_out_of_bounds();
Expand All @@ -374,7 +374,7 @@ WINRT_EXPORT namespace winrt
{
impl::removed_values<D> oldContainer;

auto guard = static_cast<D&>(*this).acquire_exclusive();
[[maybe_unused]] auto guard = static_cast<D&>(*this).acquire_exclusive();
this->increment_version();
oldContainer.assign(static_cast<D&>(*this).get_container());
}
Expand All @@ -383,7 +383,7 @@ WINRT_EXPORT namespace winrt
{
impl::removed_values<D> oldContainer;

auto guard = static_cast<D&>(*this).acquire_exclusive();
[[maybe_unused]] auto guard = static_cast<D&>(*this).acquire_exclusive();
this->increment_version();
oldContainer.assign(static_cast<D&>(*this).get_container());
assign(value.begin(), value.end());
Expand Down Expand Up @@ -508,7 +508,7 @@ WINRT_EXPORT namespace winrt
{
V Lookup(K const& key) const
{
auto guard = static_cast<D const&>(*this).acquire_shared();
[[maybe_unused]] auto guard = static_cast<D const&>(*this).acquire_shared();
auto pair = static_cast<D const&>(*this).get_container().find(static_cast<D const&>(*this).wrap_value(key));

if (pair == static_cast<D const&>(*this).get_container().end())
Expand All @@ -521,13 +521,13 @@ WINRT_EXPORT namespace winrt

uint32_t Size() const noexcept
{
auto guard = static_cast<D const&>(*this).acquire_shared();
[[maybe_unused]] auto guard = static_cast<D const&>(*this).acquire_shared();
return static_cast<uint32_t>(static_cast<D const&>(*this).get_container().size());
}

bool HasKey(K const& key) const noexcept
{
auto guard = static_cast<D const&>(*this).acquire_shared();
[[maybe_unused]] auto guard = static_cast<D const&>(*this).acquire_shared();
return static_cast<D const&>(*this).get_container().find(static_cast<D const&>(*this).wrap_value(key)) != static_cast<D const&>(*this).get_container().end();
}

Expand All @@ -550,7 +550,7 @@ WINRT_EXPORT namespace winrt
{
impl::removed_value<typename impl::container_type_t<D>::mapped_type> oldValue;

auto guard = static_cast<D&>(*this).acquire_exclusive();
[[maybe_unused]] auto guard = static_cast<D&>(*this).acquire_exclusive();
this->increment_version();
auto [itr, added] = static_cast<D&>(*this).get_container().emplace(static_cast<D const&>(*this).wrap_value(key), static_cast<D const&>(*this).wrap_value(value));
if (!added)
Expand All @@ -566,7 +566,7 @@ WINRT_EXPORT namespace winrt
{
typename impl::container_type_t<D>::node_type removedNode;

auto guard = static_cast<D&>(*this).acquire_exclusive();
[[maybe_unused]] auto guard = static_cast<D&>(*this).acquire_exclusive();
auto& container = static_cast<D&>(*this).get_container();
auto found = container.find(static_cast<D const&>(*this).wrap_value(key));
if (found == container.end())
Expand All @@ -581,7 +581,7 @@ WINRT_EXPORT namespace winrt
{
impl::removed_values<D> oldContainer;

auto guard = static_cast<D&>(*this).acquire_exclusive();
[[maybe_unused]] auto guard = static_cast<D&>(*this).acquire_exclusive();
this->increment_version();
oldContainer.assign(static_cast<D&>(*this).get_container());
}
Expand Down
12 changes: 6 additions & 6 deletions strings/base_collections_vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ namespace winrt::impl

operator wfc::IIterator<Windows::Foundation::IInspectable>()
{
auto guard = container->acquire_shared();
[[maybe_unused]] auto guard = container->acquire_shared();
return make<iterator>(container);
}
};
Expand Down Expand Up @@ -141,7 +141,7 @@ namespace winrt::impl

uint32_t GetMany(uint32_t const startIndex, array_view<Windows::Foundation::IInspectable> values) const
{
auto guard = this->acquire_shared();
[[maybe_unused]] auto guard = this->acquire_shared();
if (startIndex >= m_values.size())
{
return 0;
Expand Down Expand Up @@ -239,7 +239,7 @@ namespace winrt::impl

Windows::Foundation::IInspectable Current() const
{
auto guard = m_owner->acquire_shared();
[[maybe_unused]] auto guard = m_owner->acquire_shared();
check_version(*m_owner);
if (m_current == m_end)
{
Expand All @@ -251,14 +251,14 @@ namespace winrt::impl

bool HasCurrent() const
{
auto guard = m_owner->acquire_shared();
[[maybe_unused]] auto guard = m_owner->acquire_shared();
check_version(*m_owner);
return m_current != m_end;
}

bool MoveNext()
{
auto guard = m_owner->acquire_exclusive();
[[maybe_unused]] auto guard = m_owner->acquire_exclusive();
check_version(*m_owner);
if (m_current != m_end)
{
Expand All @@ -270,7 +270,7 @@ namespace winrt::impl

uint32_t GetMany(array_view<Windows::Foundation::IInspectable> values)
{
auto guard = m_owner->acquire_exclusive();
[[maybe_unused]] auto guard = m_owner->acquire_exclusive();
check_version(*m_owner);
uint32_t const actual = (std::min)(static_cast<uint32_t>(std::distance(m_current, m_end)), values.size());

Expand Down

0 comments on commit f9ec198

Please sign in to comment.