19537 Commits

Author SHA1 Message Date
Andrew Kelley
c650ccfca7
Merge pull request #12265 from ziglang/stage3-run-translated-c
CI: test-run-translated-c with stage3
2022-07-27 22:04:00 -07:00
Andrew Kelley
3ccb6a0cd4 CI: run test-run-translated-c tests with stage3 2022-07-27 17:56:59 -07:00
Andrew Kelley
3ba7098a17 LLVM: fix returning extern union with C callconv 2022-07-27 17:56:15 -07:00
Andrew Kelley
6a4df2778e AstGen: fix ref instruction injection for functions
For the expressions regarding return type, alignment,
parameter type, etc.
2022-07-27 16:19:23 -07:00
Andrew Kelley
401abd793d run-translated-c: disable two failing tests
Issues reported:
 * #12263
 * #12264
2022-07-27 16:19:23 -07:00
Andrew Kelley
f880af369d LLVM: fix lowering byte-aligned packed struct field pointers 2022-07-27 16:19:23 -07:00
Andrew Kelley
dfc7493dcb
Merge pull request #12256 from Vexu/stage2
stage2 typeInfo UAF fix + more
2022-07-27 16:11:07 -07:00
Andrew Kelley
90f23e131e
Merge pull request #12252 from ziglang/stage3-test-cases
CI: run test-cases with stage3
2022-07-27 10:27:12 -07:00
Andrew Kelley
0527b441ae move zig.h to become an installation file
Now instead of zig.h being baked into the compiler binary, it is a
header file distributed along with all the other header files
distributed with Zig.

Closes #11643
2022-07-27 10:26:45 -07:00
Veikka Tuominen
793db63746 Sema: copy fn param ty in zirTypeInfo
Closes #12247
2022-07-27 18:27:17 +03:00
LordMZTE
c6f5832bb6 Module: fix inverted condition 2022-07-27 18:17:07 +03:00
LordMZTE
8c4896fb3a Module: use path.isSep
Co-authored-by: Veikka Tuominen <git@vexu.eu>
2022-07-27 18:17:07 +03:00
LordMZTE
1110eafe9b Module: fix error message importing file starting with root path 2022-07-27 18:17:07 +03:00
r00ster91
baafb8a491 std.fmt: add more invalid format string errors 2022-07-27 18:07:53 +03:00
r00ster91
4ef7d85810 std.fmt: lowercase compile errors
`compileError\("([A-Z])` and `compileError\("\L\1`. It's pretty convenient.
2022-07-27 18:07:53 +03:00
Veikka Tuominen
3818d63dd8 Sema: resolve pointee type in zirReify
Closes #12223
2022-07-27 17:11:46 +03:00
Veikka Tuominen
e4a36a4cec AstGen: add dbg_stmts for unreachable and @panic
Closes #12249
2022-07-27 17:11:46 +03:00
Evan Haas
7ba1f9bfb5 translate-c: take address of functions before passing them to @ptrToInt
Fixes #12194
2022-07-27 14:03:08 +03:00
Andrew Kelley
20c230cda9 test-cases harness: annotate an optional type
Not sure why this is needed by the CI; it's not needed locally. This is
a mystery that will have to wait for another day.
2022-07-27 02:13:01 -07:00
Andrew Kelley
ffac6a1b9f CI: run test-link with stage3 2022-07-26 20:23:33 -07:00
Andrew Kelley
3de9ffa84d CI: run test-cases with stage3
See #12144 for why I did not `-Denable-llvm` yet.
2022-07-26 20:15:57 -07:00
Andrew Kelley
bdaa915a02 test-cases: remove failing test
This causes a stack overflow in a debug build of stage3 unfortunately. I
will open an issue to track this test coverage, which we absolutely
should get working - users of the compiler should get a compile error,
not a segfault if they hit the default branch quota from abusing
recursive inline functions.

Note that the problem does not occur in a release build of stage3
which has significantly reduced stack usage.

On Linux, I tried bumping up the stack size from 32 MiB to 64 MiB and it
did not solve the problem. I'm not sure why not. It seems like it should
be fine.

Note that we also have a problem of running test-cases in multi-threaded
mode which is currently the default. Currently Zig threads are spawned
with 16 MiB stack space.
2022-07-26 20:12:40 -07:00
Andrew Kelley
acf1aa10c2 test-cases harness: refresh just before update()
This makes it so that in a -Dsingle-threaded build of test-cases, if a
crash happens, the test case name will be printed just before the stderr
of the crash.
2022-07-26 20:11:52 -07:00
Andrew Kelley
4e53249d76 test-cases harness: improve stage2 compatibility
* proper skip_stage1 mechanism that doesn't get side-stepped with
   manually added test cases.
 * avoid runtime-known function pointers.
 * check for type equality more simply without checking the type name.
2022-07-26 20:09:48 -07:00
Andrew Kelley
ea3db3274d link: avoid passing bad ptrs to pwritev
At least on Linux, the pwritev syscall checks the pointer and returns
EFAULT before it checks if the length is nonzero.

Perhaps this should be fixed in the standard library, however, these are
still improvements since they make the kernel do less work within the
syscall.
2022-07-26 20:05:54 -07:00
Andrew Kelley
0bc4726e00 LLVM: add probe-stack function attribute 2022-07-26 20:05:06 -07:00
Andrew Kelley
a127693f95 start code: enable segfault handler for stage2 2022-07-26 20:04:24 -07:00
Andrew Kelley
c8c798685f
Merge pull request #12244 from Vexu/stage2
Minor stage2 fixes
2022-07-26 17:41:26 -07:00
Andrew Kelley
e2d4709779 C ABI tests no longer apply to only stage1 2022-07-26 14:51:45 -07:00
Veikka Tuominen
d6e3988fe8 Sema: better error when coercing error sets 2022-07-26 23:29:54 +03:00
Andrew Kelley
f50c98a75a test-cases harness: test all updates
even if some are "run" on foreign hosts.

closes #12193
2022-07-26 13:28:46 -07:00
Andrew Kelley
7a09bce232
Merge pull request #12136 from topolarity/llvm-config-rework
CMake: Improve usage of `llvm-config` (esp. for consistent static/shared linking)
2022-07-26 11:41:00 -07:00
Andrew Kelley
0ffcf19e3d
Merge pull request #12237 from Vexu/stage2-compile-errors
Stage2 improve errors for builtin function options structs
2022-07-26 11:26:35 -07:00
InKryption
a0d3a87ce1 std.fmt: require specifier for unwrapping ?T and E!T 2022-07-26 11:25:49 -07:00
Veikka Tuominen
7862ab9f41 Sema: disable "unreachable else prong" error for error sets for now
Closes #11798
2022-07-26 16:40:24 +03:00
Veikka Tuominen
5d99e5ecd4 Sema: improve expression value ignored error
Closes #4483
2022-07-26 16:40:24 +03:00
Veikka Tuominen
3d18c8c130 Sema: resolve lazy values for compile log
Close #12204
2022-07-26 16:40:24 +03:00
Veikka Tuominen
d78532f462 Sema: give comptime_field_ptr priority over field_ptr in tuples
Closes #11983
2022-07-26 16:40:24 +03:00
r00ster
1a16b7214d
std.mem: add reset to SplitBackwardsIterator and SplitIterator 2022-07-26 14:26:46 +03:00
Veikka Tuominen
a463dc7d6c AstGen: disable null bytes and empty stings in some places
Namely:
 * test names
 * identifiers
 * library names
 * import strings
2022-07-26 12:14:59 +03:00
Veikka Tuominen
2f54129087 parser: add error for doc comment attached to comptime or test blocks 2022-07-26 12:14:59 +03:00
Veikka Tuominen
825fc654b6 Sema: better source location for builtin options 2022-07-26 12:14:59 +03:00
Veikka Tuominen
28478a4bac Module: improve handling of errors in @call arguments 2022-07-26 12:14:59 +03:00
Jakub Konka
20ea44ef10 macho: fix memory leak and refactor Target usage 2022-07-25 22:46:43 -07:00
r00ster
cff5d9c805
std.mem: add first method to SplitIterator and SplitBackwardsIterator 2022-07-25 22:04:30 +03:00
Veikka Tuominen
2f34d06d01 Sema: analyzeInlineCallArg needs a block for the arg and the param 2022-07-25 22:04:08 +03:00
Cody Tapscott
abc1ae538f CMake: Search for Clang in CMAKE_LIBRARY_PATH, CMAKE_PREFIX_PATH, and CMAKE_FRAMEWORK_PATH
On some systems (esp. systems that use unique hashed file-paths for
library-versions like Nix), we can't expect LLVM and Clang to share
lib/bin directories.

The best we can do is find the matching clang libraries in the
CMAKE_LIBRARY_PATH provided by the environment
2022-07-25 10:38:52 -07:00
VÖRÖSKŐI András
370793a36b PriorityDequeue: use compareFn in update() method 2022-07-25 18:12:32 +03:00
Luuk de Gram
9a3dacc00e
Merge pull request #12188 from Luukdegram/llvm-wasm-c-abi
stage2: llvm - Implement C ABI when targetting wasm32
2022-07-25 16:12:36 +02:00
Ryan Liptak
75e5b38410
std.fs: End iteration on Linux/WASI during Iterator.next when hitting ENOENT
`getdents` on Linux can return `ENOENT` if the directory referred to by the fd is deleted during iteration. Returning null when this happens makes sense because:

- `ENOENT` is specific to the Linux implementation of `getdents`
- On other platforms like FreeBSD, `getdents` returns `0` in this scenario, which is functionally equivalent to the `.NOENT => return null` handling on Linux
- In all the usage sites of `Iterator.next` throughout the standard library, translating `ENOENT` returned from `next` as null was the best way to handle it, so the use-case for handling the exact `ENOENT` scenario specifically may not exist to a relevant extent

Previously, ENOENT being returned would trigger `os.unexpectedErrno`.

Closes #12211
2022-07-25 16:14:25 +03:00