Skip to content

Commit 631c8f7

Browse files
authored
Fix Clang 15 style warnings (#1196)
1 parent 61b054a commit 631c8f7

File tree

12 files changed

+25
-29
lines changed

12 files changed

+25
-29
lines changed

cppwinrt/cmd_reader.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,11 +195,10 @@ namespace cppwinrt
195195
inline std::string get_module_path()
196196
{
197197
std::string path(100, '?');
198-
DWORD actual_size{};
199198

200199
while (true)
201200
{
202-
actual_size = GetModuleFileNameA(nullptr, path.data(), 1 + static_cast<uint32_t>(path.size()));
201+
DWORD actual_size = GetModuleFileNameA(nullptr, path.data(), 1 + static_cast<uint32_t>(path.size()));
203202

204203
if (actual_size < 1 + path.size())
205204
{
@@ -603,7 +602,7 @@ namespace cppwinrt
603602
first_arg = true;
604603
*argument_count = 0;
605604

606-
for (;;)
605+
while (true)
607606
{
608607
if (*p)
609608
{
@@ -621,7 +620,7 @@ namespace cppwinrt
621620
if (*p == '\0')
622621
break;
623622

624-
for (;;)
623+
while (true)
625624
{
626625
copy_character = true;
627626

cppwinrt/code_writers.h

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ namespace cppwinrt
417417

418418
static void write_generic_names(writer& w, std::pair<GenericParam, GenericParam> const& params)
419419
{
420-
bool first{ true };
420+
bool first = true;
421421

422422
for (auto&& param : params)
423423
{
@@ -2011,7 +2011,7 @@ struct __declspec(empty_bases) produce_dispatch_to_overridable<T, D, %>
20112011

20122012
w.write_each<write_interface_override_method>(info.type.MethodList(), name);
20132013
}
2014-
};
2014+
}
20152015
}
20162016

20172017
static void write_class_override_implements(writer& w, get_interfaces_t const& interfaces)
@@ -2035,21 +2035,18 @@ struct __declspec(empty_bases) produce_dispatch_to_overridable<T, D, %>
20352035

20362036
static void write_class_override_requires(writer& w, get_interfaces_t const& interfaces)
20372037
{
2038-
bool found{};
2039-
20402038
for (auto&& [name, info] : interfaces)
20412039
{
20422040
if (!info.overridable)
20432041
{
20442042
w.write(", %", name);
2045-
found = true;
20462043
}
20472044
}
20482045
}
20492046

20502047
static void write_class_override_defaults(writer& w, get_interfaces_t const& interfaces)
20512048
{
2052-
bool first{ true };
2049+
bool first = true;
20532050

20542051
for (auto&& [name, info] : interfaces)
20552052
{
@@ -2769,7 +2766,7 @@ struct __declspec(empty_bases) produce_dispatch_to_overridable<T, D, %>
27692766

27702767
static void write_class_requires(writer& w, TypeDef const& type)
27712768
{
2772-
bool first{ true };
2769+
bool first = true;
27732770

27742771
for (auto&& [interface_name, info] : get_interfaces(w, type))
27752772
{
@@ -2793,7 +2790,7 @@ struct __declspec(empty_bases) produce_dispatch_to_overridable<T, D, %>
27932790

27942791
static void write_fast_class_requires(writer& w, TypeDef const& type)
27952792
{
2796-
bool first{ true };
2793+
bool first = true;
27972794

27982795
for (auto&& [interface_name, info] : get_interfaces(w, type))
27992796
{
@@ -2817,7 +2814,7 @@ struct __declspec(empty_bases) produce_dispatch_to_overridable<T, D, %>
28172814

28182815
static void write_class_base(writer& w, TypeDef const& type)
28192816
{
2820-
bool first{ true };
2817+
bool first = true;
28212818

28222819
for (auto&& base : get_bases(type))
28232820
{

cppwinrt/component_writers.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ namespace cppwinrt
2727
}
2828
}
2929

30-
bool first{ true };
30+
bool first = true;
3131

3232
for (auto&& name : interfaces)
3333
{
@@ -45,7 +45,7 @@ namespace cppwinrt
4545

4646
static void write_component_class_base(writer& w, TypeDef const& type)
4747
{
48-
bool first{ true };
48+
bool first = true;
4949

5050
for (auto&& base : get_bases(type))
5151
{
@@ -289,7 +289,7 @@ catch (...) { return winrt::to_hresult(); }
289289
bind<write_consume_args>(signature));
290290
}
291291

292-
void write_component_static_forwarder(writer& w, MethodDef const& method)
292+
static void write_component_static_forwarder(writer& w, MethodDef const& method)
293293
{
294294
auto format = R"( auto %(%)
295295
{
@@ -643,8 +643,8 @@ catch (...) { return winrt::to_hresult(); }
643643
{
644644
if (!info.base && info.is_default)
645645
{
646-
auto methods = info.type.MethodList();
647-
offset += methods.second - methods.first;
646+
auto [first, second] = info.type.MethodList();
647+
offset += second - first;
648648
break;
649649
}
650650
}

cppwinrt/helpers.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ namespace cppwinrt
127127
struct separator
128128
{
129129
writer& w;
130-
bool first{ true };
130+
bool first = true;
131131

132132
void operator()()
133133
{

cppwinrt/text_writer.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ namespace cppwinrt
461461
{
462462
return [&](auto& writer)
463463
{
464-
bool first{ true };
464+
bool first = true;
465465

466466
for (auto&& item : list)
467467
{
@@ -484,7 +484,7 @@ namespace cppwinrt
484484
{
485485
return [&](auto& writer)
486486
{
487-
bool first{ true };
487+
bool first = true;
488488

489489
for (auto&& item : list)
490490
{

natvis/cppwinrt_visualizer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ void LoadMetadata(DkmProcess* process, WCHAR const* processPath, std::string_vie
9393
{
9494
auto winmd_path = path{ processPath };
9595
auto probe_file = std::string{ typeName };
96-
do
96+
while (true)
9797
{
9898
winmd_path.replace_filename(probe_file + ".winmd");
9999
MetadataDiagnostic(process, L"Looking for ", winmd_path);
@@ -115,7 +115,7 @@ void LoadMetadata(DkmProcess* process, WCHAR const* processPath, std::string_vie
115115
break;
116116
}
117117
probe_file = probe_file.substr(0, pos);
118-
} while (true);
118+
}
119119
}
120120

121121
TypeDef FindType(DkmProcess* process, std::string_view const& typeName)

natvis/object_visualizer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ HRESULT object_visualizer::CreateEvaluationResult(_Deref_out_ DkmEvaluationResul
573573
auto address = pPointerValueHome->Address();
574574

575575
com_ptr<DkmString> pValue;
576-
DkmEvaluationResultFlags_t evalResultFlags = DkmEvaluationResultFlags::ReadOnly | DkmEvaluationResultFlags::Expandable;;
576+
DkmEvaluationResultFlags_t evalResultFlags = DkmEvaluationResultFlags::ReadOnly | DkmEvaluationResultFlags::Expandable;
577577
if (requires_refresh(address, m_pVisualizedExpression->InspectionContext()->EvaluationFlags()))
578578
{
579579
IF_FAIL_RET(DkmString::Create(L"<Refresh to view properties>", pValue.put()));

prebuild/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ namespace cppwinrt::strings {
4949

5050
std::string_view remainder = view;
5151

52-
while (remainder.size())
52+
while (!remainder.empty())
5353
{
5454
auto const size = std::min(size_t{ 16'000 }, remainder.size());
5555
auto const chunk = remainder.substr(0, size);

strings/base_collections_input_vector.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ WINRT_EXPORT namespace winrt::param
8888
private:
8989

9090
interface_type m_interface;
91-
bool m_owned{ true };
91+
bool m_owned = true;
9292
};
9393

9494
template <typename T>

strings/base_coroutine_foundation.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ namespace winrt::impl
149149
Async const& async;
150150
Windows::Foundation::AsyncStatus status = Windows::Foundation::AsyncStatus::Started;
151151
int32_t failure = 0;
152-
std::atomic<bool> suspending{ true };
152+
std::atomic<bool> suspending = true;
153153

154154
void enable_cancellation(cancellable_promise* promise)
155155
{

0 commit comments

Comments
 (0)