Go to file
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
.github
ci
cmake
doc make @boolToInt always return a u1 2023-05-24 00:01:48 +00:00
lib Prevent analysis of functions only referenced at comptime 2023-05-29 23:06:08 +01:00
src Prevent analysis of functions only referenced at comptime 2023-05-29 23:06:08 +01:00
stage1 rename omit_pkg_fetching_code to only_core_functionality 2023-05-17 16:00:24 -07:00
test Prevent analysis of functions only referenced at comptime 2023-05-29 23:06:08 +01:00
tools std.fs.file: Rename File.Kind enum values to snake case 2023-05-25 20:17:07 +01:00
.gitattributes
.gitignore
build.zig rename omit_pkg_fetching_code to only_core_functionality 2023-05-17 16:00:24 -07:00
CMakeLists.txt CMakeLists.txt and build.zig: remove deprecated options 2023-05-14 23:02:01 -07:00
LICENSE
README.md

ZIG

A general-purpose programming language and toolchain for maintaining robust, optimal, and reusable software.

Resources

Installation

License

The ultimate goal of the Zig project is to serve users. As a first-order effect, this means users of the compiler, helping programmers to write better software. Even more important, however, are the end-users.

Zig is intended to be used to help end-users accomplish their goals. Zig should be used to empower end-users, never to exploit them financially, or to limit their freedom to interact with hardware or software in any way.

However, such problems are best solved with social norms, not with software licenses. Any attempt to complicate the software license of Zig would risk compromising the value Zig provides.

Therefore, Zig is available under the MIT (Expat) License, and comes with a humble request: use it to make software better serve the needs of end-users.

This project redistributes code from other projects, some of which have other licenses besides MIT. Such licenses are generally similar to the MIT license for practical purposes. See the subdirectories and files inside lib/ for more details.