Skip to content

Commit

Permalink
Add formatting infrastructure to the project.
Browse files Browse the repository at this point in the history
Add infrastructure to format c++ files with clang-format.
We require clang-format-18 because some of the clang-format options
we're using have only been released with clang-format 18.
General project llvm version required remains unchanged.
Added:
1. clang-format file matching internal one
2. formatting tool based on python for cross-platform
3. pre-commit and pre-push hooks for formatting validation
4. Lint CI action.
  • Loading branch information
danlapid authored and hoodmane committed Aug 21, 2024
1 parent 72d13e7 commit d916b2a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
3 changes: 1 addition & 2 deletions src/workerd/api/sockets.c++
Original file line number Diff line number Diff line change
Expand Up @@ -425,8 +425,7 @@ void Socket::handleReadableEof(jsg::Lock& js, jsg::Promise<void> onEof) {
KJ_ASSERT(!getAllowHalfOpen(options));
// Listen for EOF on the ReadableStream.
onEof
.then(
js,
.then(js,
JSG_VISITABLE_LAMBDA(
(ref = JSG_THIS), (ref), (jsg::Lock& js) { return ref->maybeCloseWriteSide(js); }))
.markAsHandled(js);
Expand Down
21 changes: 10 additions & 11 deletions src/workerd/tests/bench-tools.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@
// enough to not need ns precision.
#define WD_BENCHMARK(X) BENCHMARK(X)->Unit(benchmark::kMicrosecond)

/* Macro inspired by KJ_TEST() to enable benchmarking without requiring the benchmark::State */ \
/* argument and make it easy to convert tests to benchmarks. */ /* Make sure the linker fails if tests are not in anonymous namespaces. */ \
#define WD_BENCH(description) \
extern int KJ_CONCAT(YouMustWrapTestsInAnonymousNamespace, __COUNTER__) KJ_UNUSED; \
void KJ_UNIQUE_NAME(Bench)(); \
void KJ_UNIQUE_NAME(BenchImpl)(benchmark::State & state) { \
for (auto _: state) { \
KJ_UNIQUE_NAME(Bench)(); \
} \
} \
WD_BENCHMARK(KJ_UNIQUE_NAME(BenchImpl))->Name(description); \
/* Macro inspired by KJ_TEST() to enable benchmarking without requiring the benchmark::State */ /* argument and make it easy to convert tests to benchmarks. */ /* Make sure the linker fails if tests are not in anonymous namespaces. */ \
#define WD_BENCH(description) \
extern int KJ_CONCAT(YouMustWrapTestsInAnonymousNamespace, __COUNTER__) KJ_UNUSED; \
void KJ_UNIQUE_NAME(Bench)(); \
void KJ_UNIQUE_NAME(BenchImpl)(benchmark::State & state) { \
for (auto _: state) { \
KJ_UNIQUE_NAME(Bench)(); \
} \
} \
WD_BENCHMARK(KJ_UNIQUE_NAME(BenchImpl))->Name(description); \
void KJ_UNIQUE_NAME(Bench)()
Empty file modified tools/unix/apply-big-move.sh
100644 → 100755
Empty file.

0 comments on commit d916b2a

Please sign in to comment.