Skip to content

Commit 6b7ebeb

Browse files
committed
Reformat
1 parent 0fb4373 commit 6b7ebeb

105 files changed

Lines changed: 11537 additions & 10472 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.clang-format

Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
# clang-format config for cforge itself.
2+
# Project-only — does not propagate to user projects that consume cforge.
3+
# Targets clang-format >= 18 (LLVM 18+). Anything older silently falls back
4+
# to defaults on unknown keys.
5+
#
6+
# Design goals (in order):
7+
# 1. Maximum readability — alignment ON wherever it doesn't fight reality.
8+
# 2. Matches the style the codebase already converged on: 2-space, attached
9+
# braces, right-aligned pointers, no namespace indent, C++17.
10+
# 3. Stable diffs — line breaks driven by structure, not by character count
11+
# shifting around.
12+
#
13+
# Apply with: cforge fmt
14+
# Verify with: cforge fmt --check
15+
16+
---
17+
Language: Cpp
18+
BasedOnStyle: LLVM
19+
Standard: c++17
20+
21+
# ── Layout ────────────────────────────────────────────────────────────────
22+
ColumnLimit: 100
23+
IndentWidth: 2
24+
TabWidth: 2
25+
UseTab: Never
26+
ContinuationIndentWidth: 4
27+
ConstructorInitializerIndentWidth: 4
28+
AccessModifierOffset: -2
29+
NamespaceIndentation: None
30+
FixNamespaceComments: true
31+
ShortNamespaceLines: 0
32+
IndentCaseLabels: true
33+
IndentExternBlock: NoIndent
34+
IndentPPDirectives: None # leave #include at col 0 even inside
35+
# #ifdef __cplusplus / extern "C" blocks
36+
LambdaBodyIndentation: Signature
37+
PPIndentWidth: -1
38+
39+
# ── Braces ────────────────────────────────────────────────────────────────
40+
# Attached braces (Stroustrup with one-liners disabled). Matches existing code.
41+
BreakBeforeBraces: Attach
42+
Cpp11BracedListStyle: true
43+
InsertBraces: true # forces {} around single-statement ifs
44+
RemoveBracesLLVM: false # ...but never strips them
45+
46+
# ── Short-form lines ──────────────────────────────────────────────────────
47+
# Single-line if/for/while hurt grep-ability and step-through debugging.
48+
# Only collapse the genuinely trivial: empty blocks and inline accessors.
49+
AllowShortBlocksOnASingleLine: Empty
50+
AllowShortCaseLabelsOnASingleLine: false
51+
AllowShortEnumsOnASingleLine: false
52+
AllowShortFunctionsOnASingleLine: InlineOnly
53+
AllowShortIfStatementsOnASingleLine: Never
54+
AllowShortLambdasOnASingleLine: Inline
55+
AllowShortLoopsOnASingleLine: false
56+
CompactNamespaces: false
57+
58+
# ── Line breaking ─────────────────────────────────────────────────────────
59+
AllowAllArgumentsOnNextLine: true
60+
AllowAllParametersOfDeclarationOnNextLine: true
61+
AlwaysBreakAfterReturnType: None
62+
AlwaysBreakBeforeMultilineStrings: false
63+
AlwaysBreakTemplateDeclarations: Yes
64+
BinPackArguments: false # each arg its own line when wrapped
65+
BinPackParameters: false # each param its own line when wrapped
66+
BreakAfterAttributes: Leave
67+
BreakBeforeBinaryOperators: NonAssignment
68+
BreakBeforeConceptDeclarations: Always
69+
BreakBeforeTernaryOperators: true
70+
BreakConstructorInitializers: BeforeColon
71+
BreakInheritanceList: BeforeColon
72+
BreakStringLiterals: true
73+
ExperimentalAutoDetectBinPacking: false
74+
PackConstructorInitializers: NextLine
75+
76+
# ── Alignment (this is where readability lives) ───────────────────────────
77+
AlignAfterOpenBracket: Align
78+
AlignArrayOfStructures: Left
79+
AlignConsecutiveAssignments:
80+
Enabled: true
81+
AcrossEmptyLines: false
82+
AcrossComments: false
83+
AlignCompound: true
84+
PadOperators: true
85+
AlignConsecutiveBitFields:
86+
Enabled: true
87+
AcrossEmptyLines: false
88+
AcrossComments: false
89+
AlignConsecutiveDeclarations:
90+
Enabled: false # OFF: turning this on makes filesystem::path & co.
91+
# push other names off the right margin badly.
92+
AlignConsecutiveMacros:
93+
Enabled: true
94+
AcrossEmptyLines: false
95+
AcrossComments: false
96+
AlignEscapedNewlines: Left
97+
AlignOperands: AlignAfterOperator
98+
AlignTrailingComments:
99+
Kind: Always
100+
OverEmptyLines: 0
101+
DerivePointerAlignment: false
102+
PointerAlignment: Right
103+
ReferenceAlignment: Pointer
104+
QualifierAlignment: Leave
105+
106+
# ── Spacing ───────────────────────────────────────────────────────────────
107+
SpaceAfterCStyleCast: false
108+
SpaceAfterLogicalNot: false
109+
SpaceAfterTemplateKeyword: true
110+
SpaceAroundPointerQualifiers: Default
111+
SpaceBeforeAssignmentOperators: true
112+
SpaceBeforeCaseColon: false
113+
SpaceBeforeCpp11BracedList: false
114+
SpaceBeforeCtorInitializerColon: true
115+
SpaceBeforeInheritanceColon: true
116+
SpaceBeforeParens: ControlStatements
117+
SpaceBeforeRangeBasedForLoopColon: true
118+
SpaceBeforeSquareBrackets: false
119+
SpaceInEmptyBlock: false
120+
SpaceInEmptyParentheses: false
121+
SpacesBeforeTrailingComments: 2
122+
SpacesInAngles: Never
123+
SpacesInCStyleCastParentheses: false
124+
SpacesInConditionalStatement: false
125+
SpacesInContainerLiterals: false
126+
SpacesInLineCommentPrefix:
127+
Minimum: 1
128+
Maximum: -1
129+
SpacesInParentheses: false
130+
SpacesInSquareBrackets: false
131+
BitFieldColonSpacing: Both
132+
133+
# ── Blank lines / vertical density ────────────────────────────────────────
134+
KeepEmptyLinesAtTheStartOfBlocks: false
135+
MaxEmptyLinesToKeep: 1
136+
SeparateDefinitionBlocks: Always
137+
EmptyLineAfterAccessModifier: Never
138+
EmptyLineBeforeAccessModifier: LogicalBlock
139+
140+
# ── Comments / strings ────────────────────────────────────────────────────
141+
ReflowComments: true
142+
143+
# ── #include handling ─────────────────────────────────────────────────────
144+
# Group order: matching .hpp (Priority 0), then cforge public, then cforge
145+
# internal, then 3rd-party (fmt, toml++), then C++ std, then C std. Regroup
146+
# rewrites the blocks; SortIncludes keeps each block alphabetical.
147+
SortIncludes: CaseSensitive
148+
IncludeBlocks: Regroup
149+
IncludeCategories:
150+
- Regex: '^"cforge/[^"]+"' # public API headers
151+
Priority: 2
152+
SortPriority: 2
153+
- Regex: '^"core/[^"]+"' # internal headers
154+
Priority: 3
155+
SortPriority: 3
156+
- Regex: '^<(fmt|toml\+\+|tomlplusplus)/[^>]+>'
157+
Priority: 4
158+
SortPriority: 4
159+
- Regex: '^<[a-z_]+>' # C++ std (no extension)
160+
Priority: 5
161+
SortPriority: 5
162+
- Regex: '^<.*\.h>' # C std / system
163+
Priority: 6
164+
SortPriority: 6
165+
- Regex: '.*'
166+
Priority: 7
167+
SortPriority: 7
168+
IncludeIsMainRegex: '(_test|_bench)?$'
169+
170+
# ── Other ─────────────────────────────────────────────────────────────────
171+
SortUsingDeclarations: true
172+
StatementMacros:
173+
- CF_SELECTANY # COMDAT-folding helper from test_runner
174+
- CF_MAYBE_UNUSED
175+
- TEST # cforge builtin test framework macro
176+
- BENCH # cforge builtin bench framework macro
177+
TypenameMacros: []
178+
WhitespaceSensitiveMacros:
179+
- STRINGIZE
180+
- PP_STRINGIZE
181+
- BOOST_PP_STRINGIZE
182+
183+
# ── Penalties (tune for stable, sensible wraps) ───────────────────────────
184+
PenaltyBreakAssignment: 25
185+
PenaltyBreakBeforeFirstCallParameter: 50
186+
PenaltyBreakComment: 300
187+
PenaltyBreakFirstLessLess: 120
188+
PenaltyBreakOpenParenthesis: 0
189+
PenaltyBreakString: 1000
190+
PenaltyBreakTemplateDeclaration: 10
191+
PenaltyExcessCharacter: 1000000
192+
PenaltyIndentedWhitespace: 0
193+
PenaltyReturnTypeOnItsOwnLine: 200

cforge.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ resolved = "v3.4.0"
1616

1717
[buildcache]
1818
# Auto-generated. Tracks change detection for incremental builds.
19-
generated = "2026-05-20T19:05:23Z"
19+
generated = "2026-05-20T20:22:56Z"
2020
config_hash = "6d9155dfd7d48095"
2121

include/cforge/cforge_hot.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ typedef struct cforge_hot_ctx cforge_hot_ctx;
3939
* <library_parent>/../.cforge/hot_reload_signal (i.e. one level above the
4040
* build/lib/ directory that contains the .dll/.so).
4141
*
42-
* @param library_path Path to the compiled shared library (.dll / .so / .dylib).
42+
* @param library_path Path to the compiled shared library (.dll / .so /
43+
* .dylib).
4344
* @return Pointer to a newly allocated cforge_hot_ctx, or NULL on failure.
4445
* Call cforge_hot_last_error() for a human-readable error string.
4546
*/
@@ -66,7 +67,8 @@ int cforge_hot_reload(cforge_hot_ctx *ctx);
6667
* pointer address changes when the library is swapped.
6768
*
6869
* @param ctx Context returned by cforge_hot_load().
69-
* @param symbol_name Name of the exported symbol (use extern "C" in the module).
70+
* @param symbol_name Name of the exported symbol (use extern "C" in the
71+
* module).
7072
* @return Pointer to the symbol, or NULL if not found.
7173
*/
7274
void *cforge_hot_get_symbol(cforge_hot_ctx *ctx, const char *symbol_name);
@@ -87,7 +89,8 @@ int cforge_hot_get_version(cforge_hot_ctx *ctx);
8789
* defined by CFORGE_HOT_POLLING_MS (default 50 ms).
8890
*
8991
* @param ctx Context returned by cforge_hot_load().
90-
* @param on_reload Callback invoked after each successful reload (may be NULL).
92+
* @param on_reload Callback invoked after each successful reload (may be
93+
* NULL).
9194
*/
9295
void cforge_hot_watch(cforge_hot_ctx *ctx, void (*on_reload)(cforge_hot_ctx *));
9396

0 commit comments

Comments
 (0)