code wiki / (root) / nx_option_enforce_ok.nx

nx_option_enforce_ok.nx

buildroot/runtime/nx_option_enforce_ok.nx

3861 B107 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_option_enforce_ok.nx -- LN2 POSITIVE CONTROL: every narrowing idiom the mode recognises, in one program that must compile under `--optenforce` AND run to exit 0 under both modes. A deny mode that refuses everything fails HERE, and a mode that missed one idiom would refuse real code. I1 `if p == 0 { return }` early exit -> p non-null for the rest of the block I2 `if p != 0 { ... }` -> non-null inside the then-block I3 `if (p as i64) == 0 { return }` -> the cast-shaped early exit I4 `while q != (0 as *OkNode) { ... }` -> non-null inside the body I5 `if p == 0 { } else { ... }` -> non-null inside the else-block I6 nx_assert_ptr(p as *u8, "...") -> non-null for the rest of the block I7 `let s = &local` -> bound non-null, no guard needed I8 a `var` pointer re-checked after reassignment I9 the write legs: `p.f = v`, `*p = v` after a guard license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_assert.nx nx_option_enforce_ok.nx

imports: nx_syscalls.nxnx_assert.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main i1_early_exit ok_maybe ok_make sys_mmap nxa_die sys_write sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable nxa_dump_sizes i2_then_block ok_maybe ↻ i3_cast_exit ok_maybe ↻ i4_while_walk ok_make ↻ i5_else_block ok_maybe ↻ i6_assert ok_maybe ↻ nx_assert_ptr sys_write ↻ nx_puts_err sys_write ↻ i7_addr_of i8_var_recheck ok_maybe ↻ i9_writes ok_maybe ↻

structs

17struct OkNode

consts

none

functions

22func ok_make(v: i64, nxt: *OkNode) -> *OkNode
called by 2: ok_maybei4_while_walk calls 1: sys_mmap
28func ok_maybe(k: i64) -> *OkNode
33func i1_early_exit(k: i64) -> i64
called by 1: main calls 1: ok_maybe
38func i2_then_block(k: i64) -> i64
called by 1: main calls 1: ok_maybe
44func i3_cast_exit(k: i64) -> i64
called by 1: main calls 1: ok_maybe
49func i4_while_walk(k: i64) -> i64
called by 1: main calls 1: ok_make
59func i5_else_block(k: i64) -> i64
called by 1: main calls 1: ok_maybe
65func i6_assert(k: i64) -> i64
called by 1: main calls 2: ok_maybenx_assert_ptr
70func i7_addr_of() -> i64
called by 1: main
75func i8_var_recheck(k: i64) -> i64
called by 1: main calls 1: ok_maybe
83func i9_writes(k: i64) -> i64
called by 1: main calls 1: ok_maybe
93func main(argc: i64, argv: *i64) -> i64