Skip to content

Follow-up to D6: one-shot clang-format reformat of the six C++ repos #49

Description

@balbasty

Follow-up to #18 item D6. The .clang-format + lint gate PRs
(fastfields-lib#48 and its five siblings) deliberately did not reformat
any existing source, so their clang-format CI check is scoped to the lines a
PR touches. This issue tracks the one-shot whole-tree reformat that would let
the check be widened to clang-format --dry-run --Werror over everything.

Why it was split out

Applying the committed .clang-format to the current trees rewrites
essentially the whole codebase:

repochanged linesfiles differing
fastfields-kernels24 72747 / 54
fastfields-cpu-impl7 52812 / 12
fastfields-cuda-impl9 94812 / 12
fastfields-cpu-lib11 51732 / 32
fastfields-cuda-lib6 85218 / 18
fastfields-lib3 18120 / 20

(Measured with the committed config. Stock LLVM and Google styles are both
worse, ≈89 k changed lines each, which is why the config was derived from the
existing code instead — 4-space indent, 80 columns, T * p / T & r middle
alignment, Stroustrup braces.)

That is not residual sloppiness that a better config could absorb. Most of it
is deliberate hand column alignment that clang-format cannot reproduce by
design:

voidsym_matvec(
DLTensor & out ,
const DLTensor & hessian ,
const DLTensor & inp ,
int stream )

and the backslash-aligned dispatch macro blocks in the *-lib layers. So the
reformat is a real judgement call, not a mechanical one.

What needs deciding

  1. Is it wanted at all? The aligned parameter lists and macro tables are
    readable and consistent; clang-format's output is not obviously better. A
    permanent // clang-format off around the macro blocks is a middle option.
  2. When. A whole-tree reformat invalidates every open PR's diff and makes
    git blame noisy across the layers where the math lives. Best done when few
    branches are in flight, and worth pairing with .git-blame-ignore-revs.
  3. Scope. Possibly the *-lib dispatch layers only, or kernels only,
    rather than all six at once.

Not blocking anything

The gate that landed already prevents new drift, so this can sit until
someone wants it. Deliberately not doing it as part of the tooling PRs, per
CONTRIBUTING's "never bundle".

Workstream: claude-jitfields-to-fastfields


🤖 Generated with Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions