14432 Commits

Author SHA1 Message Date
Jakub Konka
cea8a2f500 tapi: apply ast fixes 2021-06-24 15:01:14 +02:00
Jakub Konka
b55a3cefa4 zld: extract path to libc in the linker proper 2021-06-24 14:45:45 +02:00
Jakub Konka
bc78b02c04 zld: introduce Stub.zig which represents parsed stub file
Instead of trying to fit a stub file into the frame of a Dylib struct,
I think it makes more sense to keep them as separate entities with
possibly shared interface (which would be added in the future).

This cleaned up a lot of logic in Dylib as well as Stub. Also, while
here I've made creating actual *Symbols lazy in the sense Dylib and
Stub only store hash maps of symbol names that they expose but we
defer create and referencing given dylib/stub until link time when
a symbol is actually referenced. This should reduce memory usage
and speed things up a bit.
2021-06-24 14:45:45 +02:00
Jakub Konka
09b46198ff zld: move logic unpacking path to libc stub to Compilation 2021-06-24 14:45:45 +02:00
Jakub Konka
a600d41880 zld: apply AST fixes 2021-06-24 14:45:45 +02:00
Jakub Konka
4854c96bc5 zld: create a synthetic ___dso_handle symbol self-referenced 2021-06-24 14:45:45 +02:00
Jakub Konka
96a0479db2 zld: parse lib stubs as tbds on the linker line 2021-06-24 14:45:45 +02:00
Jakub Konka
089577a71d zld: parse libSystem tbd stub when linking 2021-06-24 14:45:45 +02:00
Jakub Konka
fbdc515418 link: add basic TAPI parser for linkers
Parser uses kubkon/zig-yaml gitrev c3eae1e40a02aedd44ad1171e5c8b259896cbda0
2021-06-24 14:45:45 +02:00
Andrew Kelley
31c49ad64d
Merge pull request #9191 from ziglang/stage1-astcheck
run AstGen even when using the stage1 backend
2021-06-23 18:09:19 -04:00
Evan Haas
29314b64bd translate-c: ensure scoped (non-public) enum constants are used 2021-06-23 14:51:19 -04:00
Andrew Kelley
3259532080 langref: fix unused vars 2021-06-23 11:32:28 -07:00
Evan Haas
de9306096e translate-c: remove explicit comptime from shuffle mask expression 2021-06-23 11:01:46 -07:00
Evan Haas
8a5fb4c248 translate-c: Ensure all local variables and function params are used 2021-06-23 10:47:47 -07:00
Andrew Kelley
2beb21c4e4 stage2: fix crash when using stage1 backend
Calling processOutdatedAndDeletedDecls() should not happen when using
the stage1 backend. Problem solved with checking a simple flag.
2021-06-23 10:44:46 -07:00
Jacob G-W
960932a4bf astgen: error on struct field with no type 2021-06-23 10:44:46 -07:00
Andrew Kelley
84fe5d4681 fix unused variable errors in runtime safety test cases 2021-06-23 10:44:46 -07:00
Andrew Kelley
3a4a710894 update godbolt test case for unused parameter 2021-06-23 10:44:46 -07:00
Andrew Kelley
189fc964f7 fix unused parameters in compare_output test cases 2021-06-23 10:44:46 -07:00
Andrew Kelley
af40e3f54c stage2: glue code to AstGen root source file when using stage1
Normally we rely on importing std to in turn import the root
in the start code, but when using the stage1 won't happen,
so in order to run AstGen on the root we put it into the
import_table here.
2021-06-23 10:44:46 -07:00
Andrew Kelley
150515f44d stage2: slightly improve error reporting for missing imports
There is now a distinction between `@import` with a .zig extension and
without. Without a .zig extension it assumes it is a package name, and
returns error.PackageNotFound if not mapped into the package table.
2021-06-23 10:44:46 -07:00
Andrew Kelley
6fb45807ab progress bar: call it "AST Lowering" instead of "AstGen" 2021-06-23 10:44:46 -07:00
Andrew Kelley
c3f637a54c cmake: debug builds of zig enable logging by default
when logging is enabled, the --debug-log flag is available.
2021-06-23 10:44:46 -07:00
Andrew Kelley
96ebf9396f ci: no need for --ast-check
since zig will now run AstGen even when using the stage1 backend.
2021-06-23 10:44:46 -07:00
Andrew Kelley
cf65ab8601 run AstGen even when using the stage1 backend
This change reduces the amount of divergence in the compiler's main
pipeline logic enough to run AstGen for all files in the compilation,
regardless of whether the stage1 or stage2 backend is being used.

Practically, this means that all Zig code is subject to new compile
errors, such as unused local variables.

Additionally:
 * remove leftover unsound asserts from recent hash map changes
 * fix sub-Compilation errors not indenting correctly
2021-06-23 10:44:46 -07:00
Andrew Kelley
fc185a6f71 stage1: @shuffle type and mask params in comptime scope 2021-06-23 09:52:09 -07:00
Jonathan Marler
0134cb0214 nice error for unsupported async sockets on Windows 2021-06-23 12:54:20 +03:00
Veikka Tuominen
29945fb8b3 fix typos in langref.html
I thought I built the docs locally but apparently not.
2021-06-23 09:20:39 +03:00
Roman Frołow
ce3679aa45
Docs clarification: local static variable (#8381) 2021-06-23 08:45:36 +03:00
Jacob G-W
da063ebd96 docs: top level global assembly -> container level 2021-06-23 08:44:52 +03:00
Evan Haas
0e7897a9a2 translate-c: Remove usage of extern enum
Translate enum types as the underlying integer type. Translate enum constants
as top-level integer constants of the correct type (which does not necessarily
match the enum integer type).

If an enum constant's type cannot be translated for some reason, omit it.

See discussion https://github.com/ziglang/zig/issues/2115#issuecomment-827968279

Fixes #9153
2021-06-23 08:44:25 +03:00
Luna
d1f99eabb7 add compile error if root.log is not a function 2021-06-22 16:38:18 +03:00
Andrew Kelley
c6844072ce
Merge pull request #9047 from g-w1/spider-astgen
stage2 astgen: catch unused vars
2021-06-21 20:20:48 -04:00
Andrew Kelley
7bebb24838 fix unused locals from merge conflict 2021-06-21 17:09:22 -07:00
Andrew Kelley
d3ddb48075 AstGen: remove unused parameters 2021-06-21 17:03:04 -07:00
Andrew Kelley
06412e04f9 cleanups related to unused params 2021-06-21 17:03:04 -07:00
Andrew Kelley
d279a23c93 mips: fix syscall_pipe
Previously the fd parameter was ignored and so the result would not get
populated. Now it passes the fd pointer to the inline assembly so that
the results can be observed.
2021-06-21 17:03:04 -07:00
Andrew Kelley
af9a2c7c50 Sema: don't miscompile fns with inferred error sets 2021-06-21 17:03:04 -07:00
Andrew Kelley
fee5aad699 stage2: remove unused parameter from importPkg 2021-06-21 17:03:04 -07:00
Andrew Kelley
f203334878 stage2: wire up AstGen to the progress bar 2021-06-21 17:03:03 -07:00
Andrew Kelley
a51ff3a903 AstGen: remove unused scope parameter from rvalue 2021-06-21 17:03:03 -07:00
Andrew Kelley
b9b0e53197 AstGen: remove unused parameter 2021-06-21 17:03:03 -07:00
Andrew Kelley
7a595f2e6c remove unused parameters 2021-06-21 17:03:03 -07:00
Andrew Kelley
3d8aa97165 std.os.linux.bpf: fix incorrect usage of unexpectedErrno 2021-06-21 17:03:03 -07:00
Andrew Kelley
59d6b7bbb9 std.os.linux: fix splitValueBE64 2021-06-21 17:03:03 -07:00
Andrew Kelley
f21a3ed540 std.TrailerFlags: remove superfluous parameter 2021-06-21 17:03:03 -07:00
Andrew Kelley
98b10d94bf std.crypto.p256: fix neg function compile error
There was a typo here and the neg function referenced a non-existent
variable.
2021-06-21 17:03:03 -07:00
Andrew Kelley
2551598013 std: ArrayHashMap remove unused parameter 2021-06-21 17:03:03 -07:00
Jacob G-W
d14272ab68 std: fix code unblocked by previous commit 2021-06-21 17:03:03 -07:00
Andrew Kelley
a04a98ff3e AstGen: while loop continue expr captures in scope
Before this, the continue expression of a while loop did not have the
capture variable in it, making it incorrectly emit a compile error for
not using the capture, even if it was referenced.
2021-06-21 17:03:03 -07:00