21533 Commits

Author SHA1 Message Date
Veikka Tuominen
dff32a2cd7 Sema: resolve lazy values in analyzeMinMax
Closes #13797
2022-12-07 14:48:24 +02:00
Veikka Tuominen
ddce76059b Sema: add error for @tagName on empty enum 2022-12-07 14:48:24 +02:00
Veikka Tuominen
d078d08e4f Sema: export function instead of the constant referencing it
Closes #13706
2022-12-07 14:48:24 +02:00
Veikka Tuominen
92f1a29c40 AstGen: make @compileError operand implicitly comptime
This matches the language reference.
2022-12-07 14:48:24 +02:00
Andrew Kelley
1310ef7577 disable failing behavior tests with -ofmt=c -target x86_64-windows
and enable CI checks for the C backend on Windows.
2022-12-07 04:01:04 -05:00
Andrew Kelley
53a9ee699a
Merge pull request #13799 from ziglang/close-stage1-issues
close stage1 issues
2022-12-07 03:06:10 -05:00
Casey Banner
8ccb9a6ad3
cache: Fix LockViolation during C compilation paths (#13591)
- C compilation flows didn't hold an exclusive lock on the cache manifest file when writing to it in all cases
- On windows, explicitly unlock the file lock before closing it
2022-12-06 23:15:54 -05:00
Frank Denis
14416b522e
Revert "std.crypto.aes: use software implementation in comptime context (#13792)" (#13798)
This reverts commit d4adf4420071397d993bac629a9da27b33c67ca3.

Unfortunately, this is not the right place to check if AES functions
are being used at comptime or not.
2022-12-07 03:49:20 +00:00
Andrew Kelley
50eb7983cd remove most conditional compilation based on stage1
There are still a few occurrences of "stage1" in the standard library
and self-hosted compiler source, however, these instances need a bit
more careful inspection to ensure no breakage.
2022-12-06 20:38:54 -07:00
Andrew Kelley
c8aba15c22 remove references to stage1 in behavior tests
Good riddance.
2022-12-06 19:06:48 -07:00
Andrew Kelley
b7b905d227 add behavior test for while(true) not needing else unreachable
closes #707
2022-12-06 17:57:27 -07:00
Andrew Kelley
e7d28344fa
Merge pull request #13560 from ziglang/wasi-bootstrap
Nuke the C++ implementation of Zig from orbit using WASI
2022-12-06 18:52:39 -05:00
Frank Denis
817cf6a82e
Update wasi-libc to 8b7148f69ae241a2749b3defe4606da8143b72e0 (#13793) 2022-12-06 22:48:35 +00:00
Frank Denis
d4adf44200
std.crypto.aes: use software implementation in comptime context (#13792)
Hardware-accelerated AES requires inline assembly code, which
cannot work at comptime.
2022-12-06 22:48:19 +00:00
Andrew Kelley
3f693cf5d5 CLI: quality of life enhancement for windows CBE behavior tests
When testing with

```
stage4/bin/zig test ../test/behavior.zig -I../test -ofmt=c -target x86_64-windows
```

previously, one would see this message:

```
error: lld-link: subsystem must be defined
```

Now, `--subsystem console` as well as `-lntdll -lkernel32` are on the
`zig run` line, producing a binary.
2022-12-06 12:46:59 -07:00
Andrew Kelley
20d86d9c63 add zig1.wasm.zst
This commit adds a 637 KB binary file to the source repository. This
commit does nothing else, so it should be replaced with a different
commit before this branch is merged to avoid bloating the git
repository.
2022-12-06 12:27:28 -07:00
Andrew Kelley
106e967893 CI: revert windows script to master branch version
This commit chickens out and reverts
02456a32ad6fa672ea383b57a2b9f592b9e2b9ed, leaving it for a future
enhancement.
2022-12-06 12:27:28 -07:00
Jacob Young
a0a2e75773 cmake: disable stack protector for zig2 to avoid link errors on windows
On windows we get:

    lld-link: error: undefined symbol: __stack_chk_fail
    >>> referenced by CMakeFiles/zig2.dir/zig2.c.obj:(main)
    >>> referenced by CMakeFiles/zig2.dir/zig2.c.obj:(main_main)
    >>> referenced by CMakeFiles/zig2.dir/zig2.c.obj:(log_scoped_28_default_29_err__anon_2764)
    >>> referenced 36192 more times

    lld-link: error: undefined symbol: __stack_chk_guard
    >>> referenced by CMakeFiles/zig2.dir/zig2.c.obj:(.refptr.__stack_chk_guard)
    >>> referenced by CMakeFiles/zig2.dir/compiler_rt.c.obj
2022-12-06 12:27:28 -07:00
Jacob Young
2a3d9c321e compiler_rt: remove stack probe functions from c builds 2022-12-06 12:27:28 -07:00
Jacob Young
91e489174b CBE: avoid trailing space 2022-12-06 12:27:28 -07:00
Jacob Young
3683602226 wasm2c: improve amortized speed of memory.grow 2022-12-06 12:27:28 -07:00
Jacob Young
3686787f67 CBE: add windows-specific reserved identifiers 2022-12-06 12:27:28 -07:00
Jacob Young
c4dc8515b6 compiler_rt: don't use the llvm windows v2u64 abi with the C backend 2022-12-06 12:27:28 -07:00
Andrew Kelley
c58ebfb1e1 CI: aarch64-macos tarball patch
I messed up the spelling of '-stack_size' making it '-stack' instead.
Will need to fix on master branch. But let's test this here before
making another master branch commit.
2022-12-06 12:27:28 -07:00
Andrew Kelley
0f2a7d3b54 CI: don't pass -Denable-stage1 when building stage4 2022-12-06 12:27:28 -07:00
Andrew Kelley
f46567e6bf CI: update tarballs
In particular, these two changes are relevant:

 * zig cc: support -stack in addition to --stack for linker arg
   - Fixes stack overflow when running zig2 on aarch64-macos.
 * compiler_rt: avoid using weak aliases
   - Fixes duplicate symbol when linking zig2 on aarch64-linux.
2022-12-06 12:27:28 -07:00
Jacob Young
793db27805 wasi: add support for windows paths 2022-12-06 12:27:28 -07:00
Jacob Young
98338358ed cmake: fix bootstrap dependencies 2022-12-06 12:27:28 -07:00
Andrew Kelley
3fb1b2caef CI: use a patched tarball
In the CI system, I copied the old tarball and then applied
05c21a26cb2d5daf06191bd996d0770192704b66 to its compiler_rt
implementation.

After this is verified we can drop this commit and regenerate the
tarballs from a master branch commit.
2022-12-06 12:27:28 -07:00
Andrew Kelley
eef4348953 CMake: remove --color on for compiler_rt too
Missing change from bcd4ea9b28a7560a1c1ef28c6c7258c6126c80e5
2022-12-06 12:27:28 -07:00
Andrew Kelley
ee2fb5b2ab zig.h: fix f16 has builtin check 2022-12-06 12:27:28 -07:00
Andrew Kelley
4451786c66 langref: update WASI preopens example 2022-12-06 12:27:28 -07:00
Andrew Kelley
823d1e7087 add std.heap.wasm_allocator 2022-12-06 12:27:28 -07:00
Jacob Young
4a701490d4 zig.h: avoid using _Float16 when __builtin_inff16 isn't available 2022-12-06 12:15:05 -07:00
Jacob Young
5dbd28f171 wasm2c: support memory.copy with overlapping buffers 2022-12-06 12:15:05 -07:00
Andrew Kelley
a3fadd2813 stage2: revert change to handling of --color on
This change has been extracted to #13786 and can be solved separately
than this branch.
2022-12-06 12:15:05 -07:00
Andrew Kelley
aaf95ce849 CMake: adjust apple clang compiler check
Before it was checking if the compiler was AppleClang, however, this did
not handle the case when using a compiled-from-source Clang on a macOS
computer, in which case the linker is still Apple ld64, and it is in
fact the linker that needs to have the different flag to communicate
stack size.
2022-12-06 12:15:05 -07:00
Andrew Kelley
e73170f972 std: fix WASI regressions
This branch largely reverts 58f961f4cb9875bbce3070969438ecf08f392c9f. I
would like to revisit the proposal to modify the standard library in
this way and think more carefully about it before adding isAbsolute()
checks everywhere.
2022-12-06 12:15:05 -07:00
Andrew Kelley
cb012490ee translate-c: fix wrong logic adjustment
In ea9ad1e85dd5e2ba18e7d55f7a7f9694282159f1, I incorrectly applied
boolean logic to one of the pieces of logic, resulting in a regression
in translate-c.
2022-12-06 12:15:05 -07:00
Andrew Kelley
57995c2100 translate-c: remove stage1 conditions from tests 2022-12-06 12:15:05 -07:00
Andrew Kelley
ec1334d2d4 CMake: remove --color on
This flag makes CI servers print garbage to the terminal. I started
implementing detection in wasi.c, but it would have destroyed the
beautiful code that only touches the C stdlib, does not do any
conditional compilation based on the operating system, or rely on any
POSIX functions.

So instead, let's just do without this flag to retain simplicity in this
step of the build process.
2022-12-06 12:15:05 -07:00
Jacob Young
bd4a1f38fa zig.h: fix shlo breakage on smaller bitwidths 2022-12-06 12:15:05 -07:00
Jacob Young
c8541f0a12 cc: remove argument parsing from only-c builds 2022-12-06 12:15:04 -07:00
Jacob Young
fad2142ecf zig.h: fix shift ub for a shlo by 0 2022-12-06 12:15:04 -07:00
Jacob Young
9f4ef4de23 wasm2c: remove unnecessary brackets to reduce max bracket depth
This avoids the need to pass `-fbracket-depth=512` to clang.
2022-12-06 12:15:04 -07:00
Jacob Young
fdb98c5ce1 cmake: fix stack size linker argument on mac 2022-12-06 12:15:04 -07:00
Jacob Young
47a2a526e2 test: remove reference to stage1 2022-12-06 12:15:04 -07:00
Jacob Young
687ea31ef9 cmake: fix host target detection 2022-12-06 12:15:04 -07:00
Jacob Young
f421efbcc1 CBE: fix bad local reuse for volatile memset 2022-12-06 12:15:04 -07:00
Jacob Young
ce4e5fee63 wasm2c: avoid aliasing issues on memory access 2022-12-06 12:15:04 -07:00