ReviewOS

home-lang/home-os

Add braces to single-line `if (cond) stmt` declarations

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

Context

11 home-os kernel modules use C/Go-style braceless `if`:

```home if (cond) return value // fails to parse — parser expects '{' ```

Home requires braces on `if` bodies. The kernel writers wrote it C-style; this is a kernel-side cleanup.

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

11 files emitting `Expected '{'`. Examples:

  • `kernel/src/idt.home`
  • `kernel/src/drivers/pci.home`
  • `kernel/src/block/io_scheduler.home`

(Full list: pull from `~/Desktop/home-os-kernel-audit-2026-05-04-pm.tsv` filtering on `first_error` containing `Expected '{'`.)

Approach

  • For each affected file, find the offending `if` statements and add braces:
    • From: `if (cond) stmt`
    • To: `if (cond) { stmt }`
  • Check for chained `else if` / `else` — apply same braces if needed
  • Verify with `home-debug ast` that `Expected '{'` is gone
  • Don't touch files that pass through this issue's filter for unrelated reasons — the audit captures only first errors per file, so make sure each fix targets a real braceless `if`
  • Conventional commit, `Closes #17` (this issue)

Why this matters

Mechanical sweep. #4 of 5 ranked follow-ups in the 2026-05-04-pm audit. Worth doing alongside the `attribute` codemod (#16, this repo) — they touch overlapping subsystems but different file sets.

Reference

  • 2026-05-04-pm audit: `~/Desktop/home-os-kernel-audit-2026-05-04-pm.tsv`

Sign in to comment on this issue.