mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-04 03:11:43 +00:00
[build] Upgrade CI to clang-format 10.0 (#1961)
MacOS no longer ships 6.0, and Arch Linux's mesa GPU drivers are no longer compatible with LLVM 6.0.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2017-2019 FIRST. All Rights Reserved. */
|
||||
/* Copyright (c) 2017-2020 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -107,8 +107,7 @@ std::unique_ptr<NetworkStream> TCPConnector::connect_parallel(
|
||||
}
|
||||
++result->count;
|
||||
result->cv.notify_all();
|
||||
})
|
||||
.detach();
|
||||
}).detach();
|
||||
}
|
||||
|
||||
// wait for a result, timeout, or all finished
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2018 FIRST. All Rights Reserved. */
|
||||
/* Copyright (c) 2018-2020 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -19,17 +19,18 @@ GetNameInfoReq::GetNameInfoReq() {
|
||||
|
||||
void GetNameInfo(Loop& loop, const std::shared_ptr<GetNameInfoReq>& req,
|
||||
const sockaddr& addr, int flags) {
|
||||
int err = uv_getnameinfo(loop.GetRaw(), req->GetRaw(),
|
||||
[](uv_getnameinfo_t* req, int status,
|
||||
const char* hostname, const char* service) {
|
||||
auto& h = *static_cast<GetNameInfoReq*>(req->data);
|
||||
if (status < 0)
|
||||
h.ReportError(status);
|
||||
else
|
||||
h.resolved(hostname, service);
|
||||
h.Release(); // this is always a one-shot
|
||||
},
|
||||
&addr, flags);
|
||||
int err = uv_getnameinfo(
|
||||
loop.GetRaw(), req->GetRaw(),
|
||||
[](uv_getnameinfo_t* req, int status, const char* hostname,
|
||||
const char* service) {
|
||||
auto& h = *static_cast<GetNameInfoReq*>(req->data);
|
||||
if (status < 0)
|
||||
h.ReportError(status);
|
||||
else
|
||||
h.resolved(hostname, service);
|
||||
h.Release(); // this is always a one-shot
|
||||
},
|
||||
&addr, flags);
|
||||
if (err < 0)
|
||||
loop.ReportError(err);
|
||||
else
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2018 FIRST. All Rights Reserved. */
|
||||
/* Copyright (c) 2018-2020 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -49,13 +49,14 @@ void Loop::Close() {
|
||||
}
|
||||
|
||||
void Loop::Walk(std::function<void(Handle&)> callback) {
|
||||
uv_walk(m_loop,
|
||||
[](uv_handle_t* handle, void* func) {
|
||||
auto& h = *static_cast<Handle*>(handle->data);
|
||||
auto& f = *static_cast<std::function<void(Handle&)>*>(func);
|
||||
f(h);
|
||||
},
|
||||
&callback);
|
||||
uv_walk(
|
||||
m_loop,
|
||||
[](uv_handle_t* handle, void* func) {
|
||||
auto& h = *static_cast<Handle*>(handle->data);
|
||||
auto& f = *static_cast<std::function<void(Handle&)>*>(func);
|
||||
f(h);
|
||||
},
|
||||
&callback);
|
||||
}
|
||||
|
||||
void Loop::Fork() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2018 FIRST. All Rights Reserved. */
|
||||
/* Copyright (c) 2018-2020 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -24,12 +24,13 @@ std::shared_ptr<Signal> Signal::Create(Loop& loop) {
|
||||
}
|
||||
|
||||
void Signal::Start(int signum) {
|
||||
Invoke(&uv_signal_start, GetRaw(),
|
||||
[](uv_signal_t* handle, int signum) {
|
||||
Signal& h = *static_cast<Signal*>(handle->data);
|
||||
h.signal(signum);
|
||||
},
|
||||
signum);
|
||||
Invoke(
|
||||
&uv_signal_start, GetRaw(),
|
||||
[](uv_signal_t* handle, int signum) {
|
||||
Signal& h = *static_cast<Signal*>(handle->data);
|
||||
h.signal(signum);
|
||||
},
|
||||
signum);
|
||||
}
|
||||
|
||||
} // namespace uv
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2018-2019 FIRST. All Rights Reserved. */
|
||||
/* Copyright (c) 2018-2020 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -34,12 +34,13 @@ void Timer::SingleShot(Loop& loop, Time timeout, std::function<void()> func) {
|
||||
}
|
||||
|
||||
void Timer::Start(Time timeout, Time repeat) {
|
||||
Invoke(&uv_timer_start, GetRaw(),
|
||||
[](uv_timer_t* handle) {
|
||||
Timer& h = *static_cast<Timer*>(handle->data);
|
||||
h.timeout();
|
||||
},
|
||||
timeout.count(), repeat.count());
|
||||
Invoke(
|
||||
&uv_timer_start, GetRaw(),
|
||||
[](uv_timer_t* handle) {
|
||||
Timer& h = *static_cast<Timer*>(handle->data);
|
||||
h.timeout();
|
||||
},
|
||||
timeout.count(), repeat.count());
|
||||
}
|
||||
|
||||
} // namespace uv
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2018 FIRST. All Rights Reserved. */
|
||||
/* Copyright (c) 2018-2020 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -17,19 +17,20 @@ WorkReq::WorkReq() {
|
||||
}
|
||||
|
||||
void QueueWork(Loop& loop, const std::shared_ptr<WorkReq>& req) {
|
||||
int err = uv_queue_work(loop.GetRaw(), req->GetRaw(),
|
||||
[](uv_work_t* req) {
|
||||
auto& h = *static_cast<WorkReq*>(req->data);
|
||||
h.work();
|
||||
},
|
||||
[](uv_work_t* req, int status) {
|
||||
auto& h = *static_cast<WorkReq*>(req->data);
|
||||
if (status < 0)
|
||||
h.ReportError(status);
|
||||
else
|
||||
h.afterWork();
|
||||
h.Release(); // this is always a one-shot
|
||||
});
|
||||
int err = uv_queue_work(
|
||||
loop.GetRaw(), req->GetRaw(),
|
||||
[](uv_work_t* req) {
|
||||
auto& h = *static_cast<WorkReq*>(req->data);
|
||||
h.work();
|
||||
},
|
||||
[](uv_work_t* req, int status) {
|
||||
auto& h = *static_cast<WorkReq*>(req->data);
|
||||
if (status < 0)
|
||||
h.ReportError(status);
|
||||
else
|
||||
h.afterWork();
|
||||
h.Release(); // this is always a one-shot
|
||||
});
|
||||
if (err < 0)
|
||||
loop.ReportError(err);
|
||||
else
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2018 FIRST. All Rights Reserved. */
|
||||
/* Copyright (c) 2018-2020 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -46,7 +46,8 @@ TEST(UvGetAddrInfo, BothNull) {
|
||||
fail_cb_called++;
|
||||
});
|
||||
|
||||
GetAddrInfo(loop, [](const addrinfo&) { FAIL(); }, Twine::createNull());
|
||||
GetAddrInfo(
|
||||
loop, [](const addrinfo&) { FAIL(); }, Twine::createNull());
|
||||
loop->Run();
|
||||
ASSERT_EQ(fail_cb_called, 1);
|
||||
}
|
||||
@@ -62,7 +63,8 @@ TEST(UvGetAddrInfo, FailedLookup) {
|
||||
});
|
||||
|
||||
// Use a FQDN by ending in a period
|
||||
GetAddrInfo(loop, [](const addrinfo&) { FAIL(); }, "xyzzy.xyzzy.xyzzy.");
|
||||
GetAddrInfo(
|
||||
loop, [](const addrinfo&) { FAIL(); }, "xyzzy.xyzzy.xyzzy.");
|
||||
loop->Run();
|
||||
ASSERT_EQ(fail_cb_called, 1);
|
||||
}
|
||||
@@ -73,7 +75,8 @@ TEST(UvGetAddrInfo, Basic) {
|
||||
auto loop = Loop::Create();
|
||||
loop->error.connect([](Error) { FAIL(); });
|
||||
|
||||
GetAddrInfo(loop, [&](const addrinfo&) { getaddrinfo_cbs++; }, "localhost");
|
||||
GetAddrInfo(
|
||||
loop, [&](const addrinfo&) { getaddrinfo_cbs++; }, "localhost");
|
||||
|
||||
loop->Run();
|
||||
|
||||
@@ -90,12 +93,13 @@ TEST(UvGetAddrInfo, Concurrent) {
|
||||
|
||||
for (int i = 0; i < CONCURRENT_COUNT; i++) {
|
||||
callback_counts[i] = 0;
|
||||
GetAddrInfo(loop,
|
||||
[i, &callback_counts, &getaddrinfo_cbs](const addrinfo&) {
|
||||
callback_counts[i]++;
|
||||
getaddrinfo_cbs++;
|
||||
},
|
||||
"localhost");
|
||||
GetAddrInfo(
|
||||
loop,
|
||||
[i, &callback_counts, &getaddrinfo_cbs](const addrinfo&) {
|
||||
callback_counts[i]++;
|
||||
getaddrinfo_cbs++;
|
||||
},
|
||||
"localhost");
|
||||
}
|
||||
|
||||
loop->Run();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2018 FIRST. All Rights Reserved. */
|
||||
/* Copyright (c) 2018-2020 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -41,13 +41,14 @@ TEST(UvGetNameInfo, BasicIp4) {
|
||||
auto loop = Loop::Create();
|
||||
loop->error.connect([](Error) { FAIL(); });
|
||||
|
||||
GetNameInfo4(loop,
|
||||
[&](const char* hostname, const char* service) {
|
||||
ASSERT_NE(hostname, nullptr);
|
||||
ASSERT_NE(service, nullptr);
|
||||
getnameinfo_cbs++;
|
||||
},
|
||||
"127.0.0.1", 80);
|
||||
GetNameInfo4(
|
||||
loop,
|
||||
[&](const char* hostname, const char* service) {
|
||||
ASSERT_NE(hostname, nullptr);
|
||||
ASSERT_NE(service, nullptr);
|
||||
getnameinfo_cbs++;
|
||||
},
|
||||
"127.0.0.1", 80);
|
||||
|
||||
loop->Run();
|
||||
|
||||
@@ -60,13 +61,14 @@ TEST(UvGetNameInfo, BasicIp6) {
|
||||
auto loop = Loop::Create();
|
||||
loop->error.connect([](Error) { FAIL(); });
|
||||
|
||||
GetNameInfo6(loop,
|
||||
[&](const char* hostname, const char* service) {
|
||||
ASSERT_NE(hostname, nullptr);
|
||||
ASSERT_NE(service, nullptr);
|
||||
getnameinfo_cbs++;
|
||||
},
|
||||
"::1", 80);
|
||||
GetNameInfo6(
|
||||
loop,
|
||||
[&](const char* hostname, const char* service) {
|
||||
ASSERT_NE(hostname, nullptr);
|
||||
ASSERT_NE(service, nullptr);
|
||||
getnameinfo_cbs++;
|
||||
},
|
||||
"::1", 80);
|
||||
|
||||
loop->Run();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user