Skip to content

reorganize headers#6

Merged
Electr0Gunner merged 1 commit into
LawnProject:mainfrom
Pistonight:fix/header_order
Jun 15, 2026
Merged

reorganize headers#6
Electr0Gunner merged 1 commit into
LawnProject:mainfrom
Pistonight:fix/header_order

Conversation

@Pistonight

@Pistonight Pistonight commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

I tried clang-formatting all the code and suddenly got a wall of errors because the includes were sorted, so I figured it should be solved once for all

Generally headers/includes should be:

  • self-contained: the header will work by including just the header, not have to include some other header before it
  • minimal: the header should not include any file that the header doesn't directly need because it will force everyone who include it to also include those files.
  • direct: for example if your header needs <cstdint>, then you should just include that instead of some other Foo.h that happens to include <cstdint>

Following these will make it less likely that when you change some header and something seemingly completed unrelated start breaking up, and builds will be faster because when you change some header there will be less stuff that needs recompiled

I did this manually with clangd's unused-include diagnostic and tested build works (and works when ported to my mod)

Another issue that exists is the include paths are kind of messy right now, for example SexyAppFramework headers can be included either like "Foo.h" or "SexyAppFramework/Foo.h" (since the include paths for sub-projects needs to be PUBLIC they just leak everywhere), and there are a bunch of "../../" includes. Ideally we only expose src in include paths and everyone should include like <Lawn/XXX.h> or <SexyAppFramework/XXX.h>

@Electr0Gunner Electr0Gunner merged commit 755eca8 into LawnProject:main Jun 15, 2026
4 checks passed
@Pistonight Pistonight deleted the fix/header_order branch June 16, 2026 04:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants