Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move from Wren to Flamingo #50

Merged
merged 136 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
136 commits
Select commit Hold shift + click to select a range
8cb1258
wren: Delete all sources
obiwac Oct 4, 2024
01c0fee
flamingo: Add Flamingo sources and script to update them
obiwac Oct 4, 2024
81bba01
base: Not relevant with Flamingo, remove
obiwac Oct 27, 2024
867e1b0
classes: Will all be rewritten for Flamingo, remove
obiwac Oct 27, 2024
a68613d
util: Will factor a lot of this out into an independent library, remo…
obiwac Oct 27, 2024
82ed55a
instr: This will work differently with the handler architecture, remove
obiwac Oct 27, 2024
7dfa42c
build: Fix `intercept-build` on macOS
obiwac Oct 27, 2024
699a3b1
clang-format: Add
obiwac Oct 27, 2024
00a9cae
clang-format: Ignore flamingo stuff
obiwac Oct 27, 2024
5916b7b
formatting: Format logging and common header
obiwac Oct 27, 2024
7c281d6
bsys: Detecting build system
obiwac Oct 27, 2024
091f13e
bsys/bob: Read and run build file
obiwac Oct 29, 2024
48050f4
bsys/bob: Get `Fs.list`
obiwac Oct 29, 2024
306b7b9
bsys/bob: Pull out `Fs.list` into its own class-handling source file
obiwac Oct 29, 2024
a4a4af9
class/fs: Implement `Fs.list`
obiwac Oct 29, 2024
ad6ea27
class: Start work on `CC` class
obiwac Oct 29, 2024
7b4b3dd
bsys/bob: Only call class call function if owner is either the correc…
obiwac Oct 30, 2024
bae12fe
class/cc: Start implementing `CC.compile`
obiwac Oct 30, 2024
bc8c305
class/cc: Return output cookies
obiwac Oct 30, 2024
2239593
cookie: Cookie index must be global
obiwac Oct 30, 2024
0fc4029
CC.compile: Start work on build steps
obiwac Oct 30, 2024
6baa2eb
pool: Task pool
obiwac Oct 30, 2024
b2ce0ca
main: `build` command
obiwac Oct 30, 2024
f2e33b0
class/cc: Wait for pool tasks to finish
obiwac Oct 30, 2024
2203234
task: Fix oversights
obiwac Oct 30, 2024
5a6bb84
build_step: Run build steps
obiwac Oct 30, 2024
e159f16
CC.compile: Start work on validating compilation requirements
obiwac Oct 30, 2024
537fc07
CC.compile: Clear up the comments
obiwac Oct 30, 2024
7f509aa
main: Ensure output directory exists
obiwac Nov 1, 2024
80fda63
bob (bsys): Ensure output directory exists
obiwac Nov 1, 2024
4bee549
cmd: Bring over `exec_args` from old Bob, but with a lick of paint
obiwac Nov 1, 2024
15dce23
class/cc: Actually compile
obiwac Nov 1, 2024
c97c0c0
gitignore: Ignore `.bob` output dir
obiwac Nov 1, 2024
bf2a9b5
logging: Require semicolon endings
obiwac Nov 1, 2024
b6c34c0
task: Clarify comment; stop doesn't necessarily mean error
obiwac Nov 1, 2024
3ced651
cmd: Pipe output
obiwac Nov 2, 2024
df07404
class/cc: Log (with lock)
obiwac Nov 2, 2024
e602dc0
class/cc: Error-handle correctly
obiwac Nov 2, 2024
9759ddf
class/cc: Actually we wanna log even when there's an exec error!!!!
obiwac Nov 2, 2024
7affc00
cmd: Free pipes
obiwac Nov 2, 2024
b07f487
cookie: Use djb2 hash instead of cookie number
obiwac Nov 2, 2024
f2a2fcd
cmd: No more rv for `cmd_create`
obiwac Nov 2, 2024
8dcfe0c
bob.fl: Linker flags
obiwac Nov 2, 2024
5bdeec3
class/linker: `Linker` class (implementing `Linker.link` too)
obiwac Nov 2, 2024
b8cc271
class/{cc,linker}: Use `$CC` if it exists
obiwac Nov 3, 2024
82320ad
class/{cc,linker}: Use flags in command
obiwac Nov 3, 2024
4d62a1a
class/cc: Rename to `Cc`
obiwac Nov 3, 2024
6f809f3
cmd: `cmd_add`
obiwac Nov 3, 2024
7ce35ec
cookie: Include output directory for Bob with cookie (+ extra `ext`
obiwac Nov 3, 2024
f1451aa
linker: Logging
obiwac Nov 3, 2024
aa60800
cc: Logging
obiwac Nov 3, 2024
a56811f
cmd: Bring out `cmd_log` function
obiwac Nov 3, 2024
6d80d7d
cmd: Write out log to file in `cmd_log`
obiwac Nov 3, 2024
b5211d0
{linker,cc}: Log cached output when already done
obiwac Nov 3, 2024
acf37b5
ncpu: Get number of CPU's
obiwac Nov 3, 2024
ec480fb
ncpu: Ability to set max jobs with `-j` flag
obiwac Nov 3, 2024
12a0f81
task: Don't use `pthread_cancel` anymore
obiwac Nov 3, 2024
1c5bdce
logging: Cooler emojis
obiwac Nov 3, 2024
34f156c
cc: Actually error when pool fails
obiwac Nov 3, 2024
bff27a6
task: Return error from `pool_wait` properly
obiwac Nov 3, 2024
343b304
cmd: Fix input pipe being closed twice when freeing command, which wo…
obiwac Nov 3, 2024
0ac685d
pool: Don't start immediately, or workers will be left with nothing t…
obiwac Nov 3, 2024
5b42cf7
pool: Rename workers to businessmen
obiwac Nov 3, 2024
7e8b5ca
pool: Rename source files to pool
obiwac Nov 3, 2024
54340d3
flamingo: Update to fix bug
obiwac Nov 3, 2024
9bd33dd
build.wren: Remove
obiwac Nov 3, 2024
c12ad0a
build.fl: Add
obiwac Nov 3, 2024
30db41f
bsys: Infrastructure for installing
obiwac Nov 3, 2024
66acd00
main: Call `bsys_run` when `run` is ran
obiwac Nov 3, 2024
82484aa
bob.fl: Declare `run` vector
obiwac Nov 3, 2024
0d4fd2d
bob: `install` map validation
obiwac Nov 3, 2024
c35d6dc
bob: Extra `install` map validation
obiwac Nov 3, 2024
ee80634
install: Get absolute path of source
obiwac Nov 3, 2024
a6c554a
install: Ensure destination directory exists
obiwac Nov 3, 2024
6897b11
install: Finish copying over files
obiwac Nov 3, 2024
e19e2b5
bsys: Run build step before installing
obiwac Nov 3, 2024
bb44cc3
fsutil: Return error instead of printing it
obiwac Nov 3, 2024
534b4d6
bsys: Implement running
obiwac Nov 3, 2024
a8104dc
run: Allow not setting default runner
obiwac Nov 3, 2024
97f5ff2
run: Set up environment before running
obiwac Nov 3, 2024
27bcde7
flamingo: Update
obiwac Nov 3, 2024
0a605d1
cc: Recompile if flags change
obiwac Nov 4, 2024
d3bba47
skeletons/c: Replace `build.wren` with `build.fl`
obiwac Nov 4, 2024
6ebbafd
build.sh: Build with more sanitization stuff
obiwac Nov 4, 2024
0e90a14
cc: Move flags check to top
obiwac Nov 4, 2024
8ca475f
linker: Re-link if flags have changed
obiwac Nov 4, 2024
03986bc
linker: Fix memory issue when computing total hash
obiwac Nov 4, 2024
1400de5
frugal: Fix memory issues
obiwac Nov 4, 2024
5d69096
frugal: Move Cc mtime comparison logic here, and genericize
obiwac Nov 4, 2024
7961764
linker: Use `frugal_mtime`
obiwac Nov 4, 2024
4dec221
logging: Be less heavyhanded with colour
obiwac Nov 4, 2024
889e848
install: Frugally install
obiwac Nov 4, 2024
638bcb3
cc: Re-compile when include deps change
obiwac Nov 4, 2024
b77f440
bsys: Installing to system
obiwac Nov 5, 2024
b67c597
fsutil: Set error message correctly and return return value
obiwac Nov 5, 2024
130e47f
clangd: Disable stupid clang-tidy check
obiwac Nov 5, 2024
5cd57be
install: Set owner of build artifacts intelligently if running as root
obiwac Nov 5, 2024
8f7c97b
ci: Check formatting
obiwac Nov 5, 2024
e6c2563
ci: Linter
obiwac Nov 5, 2024
cc58c33
ci/lint: Try fixing getting source files
obiwac Nov 5, 2024
aa006e2
ci/lint: Set up tmate session
obiwac Nov 5, 2024
9a14f8a
ci/lint: Install intercept-build
obiwac Nov 5, 2024
e85f05f
~: Fix some issues with building on Linux
obiwac Nov 5, 2024
af9807c
~: Last missing includes
obiwac Nov 5, 2024
62be83a
class/fs: Actually need feature test macros for `strndup` somehow
obiwac Nov 5, 2024
74076e7
flamingo: Update
obiwac Nov 5, 2024
a8339db
ci/lint: Fix getting source files
obiwac Nov 5, 2024
2ade7d2
tests: Remove old test files
obiwac Nov 5, 2024
b38fc70
skeletons: Remove `aqua` and `rust` skeletons, as they don't really w…
obiwac Nov 5, 2024
4247e4c
ci: Rudimentary tests
obiwac Nov 5, 2024
05ed287
ci/tests: Ignore leaks for now
obiwac Nov 5, 2024
e8b282d
bsys/bob: Set import path to work on other platforms
obiwac Nov 5, 2024
ff963e4
ncpu: Fix bad check
obiwac Nov 5, 2024
e4223b7
build: Link with `-lm`
obiwac Nov 5, 2024
e4cf2d3
pool: Set joined businessmen to 0
obiwac Nov 5, 2024
42e1fbb
ci/cirrus: Update Cirrus CI setup
obiwac Nov 5, 2024
8e3734e
install: Fix use of `dirname` with glibc
obiwac Nov 5, 2024
b3c69cc
ci/tests: Install using sudo
obiwac Nov 5, 2024
79cda4e
ci/tests: Preserve environment when installing
obiwac Nov 5, 2024
6acd0ef
pool: Joining the same thread twice is UB
obiwac Nov 5, 2024
16c663a
ci/cirrus: Cirrus runs as root already
obiwac Nov 5, 2024
14185c0
boostrap: Rename `build.sh` to `bootstrap.sh`
obiwac Nov 5, 2024
c6b5a4a
bootstrap: Use `bootstrap.sh` instead of `build.sh`
obiwac Nov 5, 2024
540eabb
ci/cirrus: Boo!
obiwac Nov 5, 2024
d2f23f8
ci/cirrus: FreeBSD workflow
obiwac Nov 6, 2024
5993e1e
ci/tests: macOS testing matrix (Intel & M1)
obiwac Nov 6, 2024
6470032
ci/tests: Compiler is apparently already set up on macOS runners
obiwac Nov 6, 2024
b7367d4
build: Fix building on FreeBSD
obiwac Nov 6, 2024
be64d96
cmd: Use `posix_spawn()` instead of `fork()`
obiwac Nov 6, 2024
13c158f
cmd: Credit SO answer
obiwac Nov 6, 2024
ef827db
cmd: Pass `environ(7)` to `posix_spawnp`
obiwac Nov 6, 2024
d854b5c
cmd: Better check for if file is executable
obiwac Nov 6, 2024
893caf5
bob.fl: Move to `import`
obiwac Nov 6, 2024
f897557
bsys/bob: Also add `$prefix/flamingo/import` import path
obiwac Nov 6, 2024
6b72799
build: Install `bob.fl` too
obiwac Nov 6, 2024
5e0e740
readme: Update and clean up readme file
obiwac Nov 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 63 additions & 12 deletions .cirrus.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,76 @@
task:
name: Test Bob with GCC on Linux (amd64)
timeout_in: 5m
container:
image: gcc:latest
env:
CLICOLOR_FORCE:
build_script:
- sh build.sh
test_script:
- $(realpath sh-bin/bob) test install
ASAN_OPTIONS: detect_leaks=0
bootstrap_script:
- sh bootstrap.sh
test_build_bob_with_bob_script:
- $(realpath .bootstrap/bob) build
test_run_bob_with_bob_script:
- rm -rf .bob
- $(realpath .bootstrap/bob) run build
test_install_bob_script:
- rm -rf .bob
- $(realpath .bootstrap/bob) install
test_run_installed_bob_script:
- rm -rf .bob
- bob build
amd64_artifacts:
path: "bin/bob"
path: ".bob/prefix/bin/bob"

task:
name: Test Bob with GCC on Linux (arm64)
timeout_in: 5m
arm_container:
image: gcc:latest
env:
CLICOLOR_FORCE:
build_script:
- sh build.sh
test_script:
- $(realpath sh-bin/bob) test install
ASAN_OPTIONS: detect_leaks=0
bootstrap_script:
- sh bootstrap.sh
test_build_bob_with_bob_script:
- $(realpath .bootstrap/bob) build
test_run_bob_with_bob_script:
- rm -rf .bob
- $(realpath .bootstrap/bob) run build
test_install_bob_script:
- rm -rf .bob
- $(realpath .bootstrap/bob) install
test_run_installed_bob_script:
- rm -rf .bob
- bob build
arm64_artifacts:
path: "bin/bob"
path: ".bob/prefix/bin/bob"

compute_engine_instance:
platform: freebsd
image_project: freebsd-org-cloud-dev
image: freebsd-13-2-release-amd64
cpu: 2
memory: 4G

task:
name: Test Bob with Clang on FreeBSD (x86_64)
timeout_in: 30m
env:
ASAN_OPTIONS: detect_leaks=0
setup_script:
- uname -a
- df -h
bootstrap_script:
- sh bootstrap.sh
test_build_bob_with_bob_script:
- $(realpath .bootstrap/bob) build
test_run_bob_with_bob_script:
- rm -rf .bob
- $(realpath .bootstrap/bob) run build
test_install_bob_script:
- rm -rf .bob
- $(realpath .bootstrap/bob) install
test_run_installed_bob_script:
- rm -rf .bob
- bob build
amd64_artifacts:
path: ".bob/prefix/bin/bob"
275 changes: 275 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,275 @@
# Version: 1
# Minimum clang-format version is 18.

# My personal opinion on what a good-ish style for C is, based on at least some amount of reason (sometimes) ;)
# This forgoes a lot of the C++/ObjC-specific stuff, simply because I practically don't ever write C++/ObjC.

BasedOnStyle: WebKit
Language: Cpp # This is also for C.

# Makes numbers look better, especially if there's a unary operand in front.

AlignArrayOfStructures: Right

# For alignment, there's a bit of a tradeoff between readability and diff size.
# For all assignments, I think this would be obnoxious, which is why they're disabled.
# But for switch cases and bitfields, which are rarer and (at least for bitfields) are less likely to provide valuable information in e.g. a blame, I think readability trumps.
# TODO Same argument for enums, but unfortunately, clang-format lumps those in with assignments at the moment, so we have to disable that for now: https://github.com/llvm/llvm-project/issues/52983
# TODO As for alignment after open brackets, this seems to be a bit of a mess: https://github.com/llvm/llvm-project/issues/80049

AlignAfterOpenBracket: BlockIndent
AlignConsecutiveAssignments: false
AlignConsecutiveBitFields: Consecutive
AlignConsecutiveDeclarations: false
AlignConsecutiveMacros: false
AlignEscapedNewlines: Left
AlignConsecutiveShortCaseStatements: # clang-format 17
Enabled: true
AcrossEmptyLines: false
AcrossComments: true
AlignCaseColons: false
SpaceBeforeCaseColon: false

# This is prettier because all terms of a binary expression are aligned this way, including the first one:
# int a = b +
# c;
# vs:
# int a = b
# + c;

AlignOperands: DontAlign
BreakBeforeBinaryOperators: None
BreakBeforeTernaryOperators: true
AlignTrailingComments: Always # clang-format 17

# Better than having them on the same line, because for big argument/parameter lists, it's easier to see what's what, and each argument can be changed individually in the diff.

AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
# clang-format 19: BreakFunctionDefinitionParameters: false

# Never allow this because a block could modify control flow, which is harder to spot when bughunting if it's not on its own line.
# I do allow this for case labels though, because they tend to be shorter than if/while/for which can be arbitrarily long, and because we anyway align them (which makes control-flow modifying operations easier to spot).
# Anyways, you can usually assume there's control-flow modification with a case label if it's on one line, because otherwise it would be on multiple lines with a break at the end.

AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: true
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false

# There's really no need for this, single-line functions are uncommon enough.
# Disallow empty ones too because almost always when a function is empty it's because content is intended later.

AllowShortFunctionsOnASingleLine: None

# I want each enum value to appear clearly in the diff.

AllowShortEnumsOnASingleLine: false

# More readable for long variable declarations, and has the added benefit of making diffs more localized.

AlwaysBreakBeforeMultilineStrings: true

# Allow groupings of arguments when split over multiple lines, e.g.:
# resize(
# ...
# width, height,
# );
# TODO Not sure this does what I think it does.

# BinPackArguments: true
# BinPackParameters: true
BinPackArguments: false
BinPackParameters: false

# Might as well have more spacing, fields aren't generally too long so we can afford it.

BitFieldColonSpacing: Both

# I really don't see the point of brace wrapping (sorry Eric).
# For the Before*'s, I might change my mind on this because technically they don't cause any diff-related problems, but I can't get myself to like no-wrapping aesthetically.

BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: true
BeforeElse: true
BeforeWhile: false
IndentBraces: false # GNU is crazy for this
SplitEmptyFunction: false # redundant with AllowShortFunctionsOnASingleLine I think
SplitEmptyRecord: false
SplitEmptyNamespace: false

BreakAdjacentStringLiterals: false # clang-format 18

# The user probably had a reason for why they wrote it the way they did (e.g. I wouldn't be putting a __printf__ on the same line as the function declaration but I would with __unused__ on a variable declaration).
# There are arguments both ways.

BreakAfterAttributes: Leave # clang-format 16

# Honestly there's a good argument to be made for this.
# In FreeBSD's source, it was really nice to be able to search for function definitions with the ^ character in regex.
# This is the reason for setting IndentWrappedFunctionNames to false.
# But really, I should be depending on the LSP for this rather, and it takes up an extra line for "nothing".

PenaltyReturnTypeOnItsOwnLine: 100
AlwaysBreakAfterDefinitionReturnType: None
# clang-format 19: BreakAfterReturnType: None
IndentWrappedFunctionNames: false

# Usually this is more readable, as this stuff can get very complex.
# Inline ASM is never very extensively used, so I think the complexity is worth the extra breathing room.

BreakBeforeInlineASMColon: Always # clang-format 16

# The user knows this best.

BreakStringLiterals: true

# The user knows this best.
# For comments, I think wrapping is a fine solution.

ColumnLimit: 0
ReflowComments: false

# A bit of a touchy subject here and I get the idea behind right-hand pointers/references, but nowadays this is so much associated to the type that it really makes more sense to me to have it on the left.

DerivePointerAlignment: false
PointerAlignment: Left
ReferenceAlignment: Left
SpaceAroundPointerQualifiers: Default

# TODO Which ones are used in Linux/FreeBSD?

ForEachMacros: ['FOREACH']
IfMacros: []
MacroBlockBegin: ''
MacroBlockEnd: ''
Macros: [] # clang-format 17
SkipMacroDefinitionBody: false # clang-format 18
StatementAttributeLikeMacros: []
StatementMacros: []
TypeNames: [] # clang-format 17
TypenameMacros: []
WhitespaceSensitiveMacros: ["STRINGIZE"]

# I think it's best if different kinds of includes are segregated; it makes them easier to find (though I think I need a bit more configuration for IncludeBlocks: Regroup).
# Sorting them just normalizes things.

# TODO IncludeBlocks: Regroup
IncludeBlocks: Preserve
# TODO IncludeCategories
SortIncludes: true

# In generally I find it best to reduce indentation, and this is especially the case for cases which would otherwise start off with a level of indentation due to the switch statement.
# It also follows the most common convention for labels.
# For labels, I don't have a strong opinion one way or another, so might as well mimic the switch cases.

IndentCaseBlocks: false
IndentCaseLabels: false
IndentExternBlock: false
IndentGotoLabels: false
IndentPPDirectives: AfterHash
PPIndentWidth: 1

# Also a bit of a touchy subject, but one I feel strongly about.
# There is literally no reason I can conceive to use spaces as opposed to tabs.
# And though I've searched far and wide for a good reason to, most people base themselves off of moronic logic or emotional arguments.
# The biggest argument for using tabs for me though is accessibility; someone with visual impairments, who usually code with a larger font size, like to reduce their indentation size sometimes down to 1 or 2 spaces in order to use horizontal space as efficiently as possible.
# If you use spaces, you're forcing them to scroll horizontally or to have a lot of text wrapping, which is uncool.
# As for the indentation width, that's purely a matter of taste with tabs.
# I think 3 is a good compromise between readability and horizontal space usage (I was inspired by Valgrind's source).

UseTab: AlignWithSpaces # I really don't know what the difference between this and ForContinuationAndIndentation is - the documentation is unclear.
IndentWidth: 3
TabWidth: 3
ContinuationIndentWidth: 3
BracedInitializerIndentWidth: 3
ObjCBlockIndentWidth: 3 # Are also sometimes used as an extension in regular C (-fblocks).

# I go back and forth on this one, but a lot of languages anyway force this, it reduces ambiguity, and can prevent the famous Apple goto fail bug (though realistically your compiler should anyway warn you about code like that).

InsertBraces: true

# Anyone who doesn't do this is a monster.
# I have no clue whatsoever why this isn't the default for VSCode and IntelliJ.
# Well, I guess that makes sense for JetBrains, they like doing stuff stupidly.
# Without this, everytime you add a line to the end of a file, you're changing two lines in the diff instead of just one.
# Same argument goes for trailing commas (though the option doesn't do anything for C I believe).

InsertNewlineAtEOF: true # clang-format 16
KeepEmptyLinesAtEOF: false # clang-format 17
InsertTrailingCommas: Wrapped

# In general, I think avoiding empty lines where unnecessary is best, because vertical space is expensive.
# But definition blocks are more readable with spacing between them and are uncommon enough that it's not a big deal.

KeepEmptyLinesAtTheStartOfBlocks: false
MaxEmptyLinesToKeep: 1
SeparateDefinitionBlocks: Always

# Windows is insane.

LineEnding: LF # clang-format 16

# Is much more consistent, because you anyway have to put the qualifier to the right side of the star if you wanna make a pointer itself const.
# So instead of writing const int* const, you just write int const* const.
# Also it removes that ambiguity for newbies about what the const really applies to.

QualifierAlignment: Right

# The user knows this best, and apparently this is a risky option to set.

RemoveParentheses: Leave # clang-format 17

# There's no point to keeping this.

RemoveSemicolon: true # clang-format 16

# Most places in this style have a space after a closing parenthesis, but I don't otherwise feel strongly about this.

SpaceAfterCStyleCast: true

# Unary operators rarely have a space after them, so I don't see why nots should.

SpaceAfterLogicalNot: false

# Personal preference, but I think it shows stronger separation between the LHS and the expression (especially since that LHS has spaces in it if it's a declaration).

SpaceBeforeAssignmentOperators: true

# This is really personal preference, I have no good argument for this.

SpaceBeforeParens: ControlStatementsExceptControlMacros

# Since this is strongly associated to the identifier as it has a high precedence, I think having a space makes it harder to read.

SpaceBeforeSquareBrackets: false

# Don't see the point.

SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesInParens: Never # clang-format 17
SpacesInSquareBrackets: false

# I go back and forth on this one, but not having spaces makes it consistent with argument lists.
# Apparently, this is what's preferred in C++11.

SpacesInContainerLiterals: false
Cpp11BracedListStyle: true

# Comments are in a sense the lowest precedence things, so I think having spacing around them is best.

SpacesBeforeTrailingComments: 1
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: -1
5 changes: 5 additions & 0 deletions .clang-format-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Don't format any generated source files, i.e. those that come from Tree-sitter.

src/flamingo/*
src/flamingo/*/*
src/flamingo/*/*/*
3 changes: 3 additions & 0 deletions .clangd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Diagnostics:
ClangTidy:
Remove: bugprone-sizeof-expression
14 changes: 14 additions & 0 deletions .github/workflows/formatting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Check formatting

on: [push, workflow_dispatch]

jobs:
check_formatting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run clang-format
uses: jidicula/[email protected]
with:
clang-format-version: 18
check-path: .
Loading