From 0a8a4354a9bf89c73a2d745869b4ef943d8108a2 Mon Sep 17 00:00:00 2001 From: Travis Geiselbrecht Date: Sun, 31 Aug 2025 13:09:53 -0700 Subject: [PATCH] [clang-format] first stab at a .clang-format file that matches the existing style Not enabled by default, but if you want to use this one for now while things are stabilized feel free. Going to move off astyle since this seems to be superior now (wasn't always). Also switched scripts/codestyle to use clang-format --- .clang-format | 14 ++++++++++++++ scripts/codestyle | 14 +++----------- 2 files changed, 17 insertions(+), 11 deletions(-) create mode 100644 .clang-format diff --git a/.clang-format b/.clang-format new file mode 100644 index 00000000..b9985ef2 --- /dev/null +++ b/.clang-format @@ -0,0 +1,14 @@ +BasedOnStyle: LLVM +IndentWidth: 4 +UseTab: Never +PointerAlignment: Right +InsertBraces: true +BreakBeforeBraces: Attach +AllowShortIfStatementsOnASingleLine: WithoutElse +AllowShortLoopsOnASingleLine: true +AllowShortFunctionsOnASingleLine: Inline +ColumnLimit: 0 +IndentCaseLabels: true +IndentGotoLabels: false +AlignConsecutiveMacros: + Enabled: true \ No newline at end of file diff --git a/scripts/codestyle b/scripts/codestyle index bbf056f2..728b5b71 100755 --- a/scripts/codestyle +++ b/scripts/codestyle @@ -1,13 +1,5 @@ #!/bin/sh -# formatting script using the astyle tool -# use -A2 (java style braces) -# 4 space indents, convert tabs to spaces -# -# switches documented at http://astyle.sourceforge.net/astyle.html -# -# optional switches to note: -# --add-braces will add { } for every conditional, including one liners - -astyle -A2 --align-pointer=name --indent=spaces=4 --indent-switches \ - --keep-one-line-blocks --pad-header --convert-tabs $@ +# formatting script using clang-format. +# the format is described in .clang-format file at the root of the project. +clang-format --verbose -i $@ \ No newline at end of file