Apply clang-format across the whole tree
Run clang-format (the repo's .clang-format: LLVM base, 120 cols, tabs, Allman functions) over every source file so the tree is formatter-clean. Whitespace only -- no behavior change; full x64 + x86 suites pass. Also set SortIncludes: false in .clang-format. Windows include order is load-bearing (windows.h must precede tlhelp32.h / mmreg.h / xinput.h / dinput.h; winsock2.h must precede windows.h), and the default alphabetical sort reorders tlhelp32.h ahead of windows.h -- a build break. Leaving order alone keeps the manual, correct grouping.
This commit is contained in:
@@ -16,14 +16,12 @@
|
||||
using namespace coop;
|
||||
using coop::hook::IpcClient;
|
||||
|
||||
namespace
|
||||
{
|
||||
namespace {
|
||||
int g_failures = 0;
|
||||
void check(bool ok, const char* what)
|
||||
{
|
||||
std::printf("%s %s\n", ok ? " ok:" : "FAIL:", what);
|
||||
if (!ok)
|
||||
{
|
||||
if (!ok) {
|
||||
++g_failures;
|
||||
}
|
||||
}
|
||||
@@ -43,11 +41,9 @@ int main()
|
||||
// generations, so the slots' packet values would disagree.
|
||||
std::thread writer([&] {
|
||||
std::uint32_t gen = 1;
|
||||
while (!stop.load(std::memory_order_relaxed))
|
||||
{
|
||||
while (!stop.load(std::memory_order_relaxed)) {
|
||||
CoopPadState pads[kMaxPads];
|
||||
for (auto& p : pads)
|
||||
{
|
||||
for (auto& p : pads) {
|
||||
p = CoopPadState{};
|
||||
p.connected = 1;
|
||||
p.packet = gen;
|
||||
@@ -57,17 +53,13 @@ int main()
|
||||
}
|
||||
});
|
||||
std::thread reader([&] {
|
||||
while (!stop.load(std::memory_order_relaxed))
|
||||
{
|
||||
while (!stop.load(std::memory_order_relaxed)) {
|
||||
CoopPadState out[kMaxPads];
|
||||
std::uint32_t count = 0;
|
||||
if (read_pads(block, out, count))
|
||||
{
|
||||
if (read_pads(block, out, count)) {
|
||||
reads.fetch_add(1, std::memory_order_relaxed);
|
||||
for (std::uint32_t i = 1; i < kMaxPads; ++i)
|
||||
{
|
||||
if (out[i].packet != out[0].packet)
|
||||
{
|
||||
for (std::uint32_t i = 1; i < kMaxPads; ++i) {
|
||||
if (out[i].packet != out[0].packet) {
|
||||
torn.fetch_add(1, std::memory_order_relaxed);
|
||||
break;
|
||||
}
|
||||
@@ -90,7 +82,8 @@ int main()
|
||||
block.sequence.store(1, std::memory_order_relaxed); // odd = write in progress, never completed
|
||||
CoopPadState out[kMaxPads];
|
||||
std::uint32_t count = 0;
|
||||
check(!read_pads(block, out, count), "seqlock: read_pads returns false when stuck mid-write (bounded, no hang)");
|
||||
check(!read_pads(block, out, count),
|
||||
"seqlock: read_pads returns false when stuck mid-write (bounded, no hang)");
|
||||
}
|
||||
|
||||
// --- Handshake: IpcClient::connect rejects a wrong magic / version ----------------------------
|
||||
|
||||
Reference in New Issue
Block a user