Go to file
Andrew Kelley 9501ea688f stage2: --autofix proof-of-concept
* Introduce the `--autofix` CLI flag when building an executable,
   object, or library.
 * Refactor std.zig.render to use a struct parameter to make it easier
   to add/remove fields from the struct.
 * Introduce a "Fixups" concept to std.zig.render which can perform
   edits while rendering code, while leaving the Ast read-only.
 * Add a fixup for adding a discard after a variable declaration.
 * Update the Module code to check for fixable errors after AstGen
   lowering.

Improvements that need to be made before this can be merged:

 * Introduce an error for "pointless discard" and a fixup for it so that
   --autofix can undo the effects of itself when a variable becomes
   used.
 * Support local variables as well as local constants.
 * Support captures in addition to local variables and constants.
 * Integrate properly with incremental compilation.
 * Integrate with the Zig build system.
 * Distinguish between AstGen errors that can be autofixed and those
   that cannot.
 * Remove std.debug.print statements.
 * Only perform fixups when all errors are autofixable errors. However,
   suppress all autofixable errors when reporting errors with --autofix.

The purpose of this feature is to satisfy two use cases that
traditionally have been at odds:

 * Some people want the guarantee that all Zig code they read has the
   property that there are no unused locals.
 * Some people find no value from such errors and want to not have to
   deal with them.

The problem with an `--allow-unused` flag is that people from the second
group will use it, and then some projects will fail to compile without
the flag enabled.

I like to think of Zig as having "inline warnings". The warnings are
there, inside your source code, next to the relevant lines, ready to be
noticed by diffs, code reviews, and when refactoring.

`--autofix` is a way for Zig to automatically insert inline warnings for
those who wish to iterate quickly on a messy codebase.
2022-09-09 18:49:05 -07:00
.builds ci: update tarballs for LLVM 13 2021-10-01 16:07:42 -07:00
.github codeowners: mark myself as the codeowner of /src/autodoc/ 2022-09-02 17:35:41 +02:00
ci test-cases: enable stage2 tests on Windows 2022-09-07 22:42:59 +02:00
cmake cmake: build stage3 by default 2022-08-28 17:07:21 -07:00
deps Do not detect byte-order using _BIG/_LITTLE_ENDIAN 2022-04-12 11:14:33 -07:00
doc std.zig.system.NativeTargetInfo: detection ignores self exe 2022-09-08 20:52:49 -07:00
lib stage2: --autofix proof-of-concept 2022-09-09 18:49:05 -07:00
src stage2: --autofix proof-of-concept 2022-09-09 18:49:05 -07:00
test Merge pull request #12772 from ziglang/coff-basic-imports 2022-09-09 13:08:58 +02:00
tools stage2+stage1: remove type parameter from bit builtins 2022-08-22 11:19:20 +03:00
.gitattributes mark tsan as linguist-vendored 2021-06-25 12:46:23 +03:00
.gitignore std/build: change default install prefix to zig-out 2021-04-29 23:58:45 +02:00
build.zig build: hook up -Dskip-stage2-tests and remove test-toolchain 2022-08-19 16:45:16 -07:00
CMakeLists.txt cmake: add runaway Coff/Object.zig path 2022-08-30 10:42:21 +02:00
LICENSE Y++ 2021-12-31 19:58:21 -05:00
README.md move some files to the .github directory 2022-03-24 12:22:23 -07:00

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.