zig/lib/std/os
mlugg 4976b58ab1
Prevent analysis of functions only referenced at comptime
The idea here is that there are two ways we can reference a function at runtime:

* Through a direct call, i.e. where the function is comptime-known
* Through a function pointer

This means we can easily perform a form of rudimentary escape analysis
on functions. If we ever see a `decl_ref` or `ref` of a function, we
have a function pointer, which could "leak" into runtime code, so we
emit the function; but for a plain `decl_val`, there's no need to.

This change means that `comptime { _ = f; }` no longer forces a function
to be emitted, which was used for some things (mainly tests). These use
sites have been replaced with `_ = &f;`, which still triggers analysis
of the function body, since you're taking a pointer to the function.

Resolves: #6256
Resolves: #15353
2023-05-29 23:06:08 +01:00
..
linux fix incorrect use of mutable pointers to temporary values 2023-05-11 17:23:06 +03:00
plan9 plan9: more syscalls 2021-11-09 07:08:27 -05:00
uefi std: update to use @memcpy directly 2023-04-28 13:24:43 -07:00
windows Revert "Windows: Support UNC, rooted, drive relative, and namespaced/device paths" 2023-05-29 15:01:24 -07:00
linux.zig std.Target adjustments 2023-05-26 21:42:19 -07:00
plan9.zig remove 'builtin.stage2_arch', Sema is smart enough now 2022-08-07 16:07:08 -07:00
test.zig Prevent analysis of functions only referenced at comptime 2023-05-29 23:06:08 +01:00
uefi.zig Make invalidFmtError public and use in place of compileErrors for bad format strings (#13526) 2022-11-12 21:03:24 +02:00
wasi.zig std: fix WASI regressions 2022-12-06 12:15:05 -07:00
windows.zig Revert "Windows: Support UNC, rooted, drive relative, and namespaced/device paths" 2023-05-29 15:01:24 -07:00