zig/lib
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
..
compiler_rt Merge pull request #12574 from Vexu/remove-bit-op-type-param 2022-08-24 15:57:44 -04:00
docs autodoc: improve rendering of long fn signatures 2022-09-05 17:26:59 +02:00
include move zig.h to become an installation file 2022-07-27 10:26:45 -07:00
init-exe init-exe template: add flushing to the buffered writer 2022-08-04 21:12:42 +02:00
init-lib flatten lib/std/special and improve "pkg inside another" logic 2022-05-06 22:41:00 -07:00
libc glibc/abilists: add libresolv stubs 2022-08-25 16:36:10 +03:00
libcxx libcxx: do not include __config_site 2022-07-02 20:40:59 -07:00
libcxxabi update libcxxabi to llvm 14.0.6 2022-07-01 16:39:29 -07:00
libunwind update libunwind to llvm 14.0.6 2022-07-01 16:39:31 -07:00
std stage2: --autofix proof-of-concept 2022-09-09 18:49:05 -07:00
tsan
build_runner.zig flatten lib/std/special and improve "pkg inside another" logic 2022-05-06 22:41:00 -07:00
c.zig Sema: validate deref operator type and value 2022-07-01 10:22:25 +03:00
compiler_rt.zig stage2: lower float negation explicitly 2022-06-30 00:02:00 -07:00
ssp.zig flatten lib/std/special and improve "pkg inside another" logic 2022-05-06 22:41:00 -07:00
test_runner.zig Revert "test_runner: workaround #1923, isolating error traces in tests" 2022-08-22 11:46:54 -07:00