ReviewOS

home-lang/home-os

Replace C-style `__attribute__((aligned(N)))` with Home `align(N)` syntax

#16
Closed glennmichael123 opened this 9 days ago ·
9 days ago

Context

A subset of home-os kernel modules use C-style `attribute((aligned(N)))` annotations on declarations:

```home var attribute((aligned(64))) buffer: [64]u8 = undefined // C-ism, fails to parse ```

Home doesn't have `attribute` syntax. As of home-lang/home #18, `align(N)` suffix is supported on declarations:

```home var buffer: [64]u8 align(64) = undefined // canonical Home form ```

These are leftovers from C-influenced kernel code that needs converting.

Affected files (from 2026-05-04-pm audit)

A subset of the 22 files emitting `Expected semicolon or newline between statements`. Pull from `~/Desktop/home-os-kernel-audit-2026-05-04-pm.tsv` and grep for `attribute`:

```bash grep -rln "attribute" kernel/src --include="*.home" ```

Approach

  • `grep -rn "attribute" kernel/src --include='*.home'` — find all uses
  • For each: rewrite `attribute((aligned(N)))` after `var`/`let` keyword to `align(N)` after the type annotation. Pattern:
    • From: `var attribute((aligned(N))) name: T = expr`
    • To: `var name: T align(N) = expr`
  • Other `attribute` forms (e.g. `packed`, `section`, `weak`) may not have direct Home equivalents — leave those, file separately if needed
  • Verify with `home-debug ast <file>` that the parse error is gone (other errors may remain — out of scope)
  • Conventional commit, `Closes #16` (this issue)

Why this matters

Mostly mechanical sweep. #3 of 5 ranked follow-ups in the 2026-05-04-pm audit. Per the audit's own note: "Likely better as a home-os cleanup than a compiler change" since `attribute` is a C-ism not a Home language feature.

Reference

  • 2026-05-04-pm audit: `~/Desktop/home-os-kernel-audit-2026-05-04-pm.tsv`
  • home #18 added `align(N)` declaration suffix

Sign in to comment on this issue.