Commit Graph

29599 Commits

Author SHA1 Message Date
Jakub Konka
766e281a72 macho: set allow_shlib_undefined to true when TSAN was requested 2024-06-26 22:01:00 +02:00
Jakub Konka
e9309036b2 macho: print libtsan ref when dumping argv 2024-06-26 08:43:46 +02:00
Jakub Konka
6e78642d51 macho: link in TSAN if requested 2024-06-26 07:38:36 +02:00
Pavel Verigo
3e9ab6aa7b stage2-wasm: abs 128 bit 2024-06-24 20:50:39 +02:00
Bogdan Romanyuk
ab4c461b76
std.mem.zeroes: explicit compile error for @Type(.EnumLiteral) 2024-06-24 00:43:09 +00:00
Alex Rønne Petersen
1ede3af9f6 std.zig.target: Remove armeb-windows-gnu and aarch64_be-windows-gnu.
This doesn't actually exist; Windows on Arm only runs on little endian. MinGW
also doesn't work for these targets at all.
2024-06-23 19:53:52 -04:00
David Rubin
e73ae94b36 riscv: remove deprecated Module usages 2024-06-23 15:26:14 +01:00
Frank Denis
f3655fd07d
std.crypto.chacha: fix typo in XChaChaIETF.stream() (#20399)
Thanks to @r4gus for reporting this.

Fixes #20398
2024-06-23 13:20:18 +00:00
Bram
5f58956264 std: Extended type checks for Thread startFn return type 2024-06-23 04:35:00 +01:00
Sean
f1b6f1aeb3
std.meta.hasUniqueRepresentation: Handle optional pointers correctly (#20366)
std.meta.hasUniqueRepresentation should now return true for non-slice optional pointers. Additional checks were added to the test to reflect this.
2024-06-23 03:33:45 +00:00
Michael Bradshaw
642093e04b Rename *[UI]LEB128 functions to *[UI]leb128 2024-06-23 04:30:12 +01:00
Andrew Kelley
0fcd59eada rename src/Module.zig to src/Zcu.zig
This patch is a pure rename plus only changing the file path in
`@import` sites, so it is expected to not create version control
conflicts, even when rebasing.
2024-06-22 22:59:56 -04:00
Pavel Verigo
6026bbd0ad stage2-wasm: fix div and rem 2024-06-22 21:35:36 +02:00
Alex Rønne Petersen
9be9b8ca90 std.Build.findProgram(): Try with and without the Windows executable extensions.
I renamed std.process.Child.CreateProcessSupportedExtension to WindowsExtension
and made it public to avoid duplicating the list of extensions.

While here, I also improved it to not misreport OOM from std.fs.realpathAlloc()
as a generic failure to find the program, but instead panic like the rest of the
build system does for OOM.

Closes #20314.
2024-06-21 15:41:03 -04:00
Felix "xq" Queißner
451550e86a Closes #20355: Enables dynamic linking for .os_tag == .other again 2024-06-21 00:12:44 -04:00
kcbanner
0d12caee29 - Fix ypedef -> typedef 2024-06-21 00:12:13 -04:00
Ryan G
b6fd34aa46
std.static_string_map: Cast length of input for runtime initialization 2024-06-20 23:22:39 +00:00
Igor Anić
b8890f8ee1 io_uring: don't assume completions order (2)
In my first [try](https://github.com/ziglang/zig/pull/20224) to fix
20212 I didn't reproduce bug on required kernel (6.9.2) and wrongly
concluded that first two completions have different order on newer
kernel.
On my current kernel (6.5.0) order of completions is: send1, recv,
send2. On 6.9.2 order is send1, send2, recv. This fix allows second two
completions to arrive in any order.
Tested on both kernels.

Fixes: #20212
2024-06-20 18:03:28 -04:00
Alex Kladov
e03026507f
std: fuzz test sort stability (#20284)
Stability of std sort was undertested before this change. Add a fuzz
test for more confidence.

Specifically, we used to have a single example test that used an array
of eight elements. That ends up exercising only a tiny fraction of
sorting logic, as it hits a hard-coded sorting network due to small
size.
2024-06-20 12:38:54 -07:00
Alex Kladov
5afd774db3 std: mark Build.args as const
I don't think these are intended to be mutated!
2024-06-20 15:17:31 -04:00
snoire
f7d72ce881 build runner: add missing 'new' option to --summary error hint 2024-06-20 14:54:12 +03:00
Matthew Lugg
f73be120f4
Merge pull request #20299 from mlugg/the-great-decl-split
The Great Decl Split (preliminary work): refactor source locations and eliminate `Sema.Block.src_decl`.
2024-06-20 11:07:17 +01:00
mlugg
2b677d1660
Sema: fix performance regression
LLVM fails to notice that in release builds, `logFn` ignores its
arguments, so their computation can be elided. So, LLVM fails to elide
this hashmap lookup. Its cost isn't too significant, but doing it in the
hottest loop in Sema adds up!

Technically, we could do the lookup a single time, before the loop, but
it was cleanest (and a little faster) to just disable this log call at
comptime when debug logging is disabled.
2024-06-20 08:41:07 +01:00
Alex Ambrose
ccd3cc3266 Parse WASM linker flags as base 10, like clang
Resolves #19536
2024-06-20 07:34:24 +02:00
David Rubin
e5a3a10a5a add error message for -fno-llvm -flld
We plan to remove all dependency on LLD either way, so this will not be a supported usecase.
2024-06-19 20:13:21 +02:00
Jakub Konka
a154d8da8e
Merge pull request #20070 from Rexicon226/riscv
more RISC-V backend progress
2024-06-19 17:42:08 +02:00
mlugg
1fdf13a148 AstGen: error for redundant @inComptime() 2024-06-19 03:43:13 +01:00
Isaac Freund
5f2bdafa39 std.posix: remove unchecked std.os.linux usage
Using std.os.linux directly in e.g. std.posix.timerfd_create() causes
the function to compile but silently fail at runtime when targeting any
OS other than Linux.

To catch errors like this at compile time, std.os.linux must only be
directly accessed within std.posix where there has been a comptime check
that the target os is in fact Linux.
2024-06-18 22:35:28 +02:00
Veikka Tuominen
7dc52a367a
Merge pull request #20343 from rohlem/std-fix-recursive-union-eql
fix `std.testing.expectEqual`, `std.meta.eql` for `comptime`-only unions
2024-06-18 23:07:01 +03:00
rohlem
0ffeec4b4d fix std.meta.eql for comptime-only union
switch from `inline for` with `std.mem.eql`
to `inline else` and tag comparison.

add previously-failing test code.
2024-06-18 19:04:16 +02:00
rohlem
17ce3e5a17 fix std.testing.expectEqual for comptime-only union
switch from `inline for` with `std.mem.eql`
to `inline else` and tag comparison;
expectEqualDeep(Inner) was already doing this.

add a previously-failing test case.
2024-06-18 19:01:05 +02:00
mlugg
6a8cf25a8a
cases: un-regress some notes
Since we now have source locations for reified types again, some error
notes have returned which were previously regressed by this branch.
2024-06-18 04:55:39 +01:00
mlugg
75395c99c5
Zir: track reifications across updates
This was always necessary, it was just missing logic. It is necessary
due to type equivalence rules.
2024-06-18 04:48:24 +01:00
mlugg
0486aa5081
Zir: provide absolute node for reify
Since we track `reify` instructions across incremental updates, it is
acceptable to treat it as the baseline for a relative source location.
This turns out to be a good idea, since it makes it easy to define the
source location for a reified type.
2024-06-18 04:48:24 +01:00
mlugg
edf14777ba
link.Wasm: correctly fetch source location when decl is a type
The comment explains the situation here. This is a bit of a hack, and
should be reworked when `Decl` is properly split up.
2024-06-18 04:30:06 +01:00
Andrew Kelley
04e08ea883
Merge pull request #20304 from ifreund/std-abi-fixes
std: fix a few ABI issues in the OS layer
2024-06-17 19:41:57 -04:00
Isaac Freund
a1777cb5cb
std: fix pthread_{get,set}name_np return type ABI
I believe this was accidentally broken when the E enum for errno values
was introduces. These functions are quite the special case in that they
return the error value directly rather than returning -1 and passing the
error value through the errno variable.

In any case, using a u16 as the return type at the ABI boundary where a
c_int is expected is asking for trouble.
2024-06-17 23:26:53 +02:00
Isaac Freund
687a756bf9
std: make all dirent structs extern
Using structs with unspecified layout on the ABI boundry can't end well.
2024-06-17 23:26:53 +02:00
Jay Petacat
254a3ba9d9 std.zip: Fix typo in doc comments 2024-06-17 16:12:19 -04:00
mlugg
f37d0725fa
Sema: fix callconv detection in generic functions
When analyzing `zirFunc` to instantiate a generic function,
`sema.owner_decl` is not the owner Decl of the generic instance, but
instead of the call site, so that dependencies are propagated correctly.
(This aligns with the fact that in future, generic instantiations will
not have a corresponding `Cau`.) So, when deciding the callconv in this
case, we must check `sema.generic_owner` to determine whether the
function is exported.
2024-06-17 20:01:50 +01:00
Jonathan Marler
1165e13c25 wasm2c: avoid indexing null pointer triggering undefined behavior
Using zig cc to compile and run wasm2c on zig.wasm on Windows triggers
what appears to be a sanitizer crash.  The FuncGen reuse array pointer is
initialized to null and at some point it's resized to a length of zero,
which triggers this code to execute:

    memcpy(&self->reuse[self->reuse_i], &self->reuse[reuse_top], sizeof(uint32_t) * reuse_n);

Given the current values, this equates to:

    memcpy(&(NULL)[0], &(NULL)[0], 0);

Taking the address of the first element of a null pointer doesn't trigger
any actual runtime problem, since the pointer won't be dereferenced because
were passing 0 as the length to memcpy, however, it seems that the C spec
considers indexing a null pointer to be undefined behavior even if you
don't use the resulting value (or are just taking the address of an
indexed pointer).
2024-06-17 14:34:52 -04:00
Andrew Kelley
455899668b
Merge pull request #20322 from ziglang/ci-tidy
add -Denable-tidy flag and use it in the CI
2024-06-17 05:41:09 -04:00
Andrew Kelley
1e9e29398a disable tidy validation for autodocs
tidy gives a false positive:

line 304 column 9 - Warning: moved <style> tag to <head>! fix-style-tags: no to avoid.

I noticed that `--show-warnings no` still incorrectly causes exit code 1.
I was unable to find an alternative to tidy.
2024-06-17 00:10:35 -07:00
Andrew Kelley
651225c2d4 add -Denable-tidy flag and use it in the CI
Eliminates a TODO from the CI scripts; makes it easier to check validity
of html when working on the langref locally.
2024-06-17 00:10:35 -07:00
Andrew Kelley
fda2458f6a
Merge pull request #20321 from ziglang/build-system-fmt
enhance `std.Build.Step.Fmt` and use it more
2024-06-17 01:04:57 -04:00
Alex Rønne Petersen
2c373b0fb6 std.Target: Update known Windows 10/11 versions and build numbers. 2024-06-16 23:37:38 -04:00
Jacob Young
d208e59496 llvm: avoid debug info for naked function arguments
This is not supported by llvm.
2024-06-16 23:30:57 -04:00
Alex Rønne Petersen
6220c754cf std.Build: Add Step.Fail and addFail() function.
Closes #15373.
2024-06-16 23:13:12 -04:00
Alex Rønne Petersen
c533233f42 Revert "start: workaround for LLVM 17 regression"
This reverts commit d7daf7c203.

This is no longer needed with the LLVM 18 upgrade, and it was breaking PIE.

Closes #20306.
2024-06-16 23:11:08 -04:00
Andrew Kelley
cb1d1bdf59 make zig build test check for conforming formatting
There was already `zig build test-fmt` but now `zig build test` depends
on that one.

The CI scripts no longer need explicit logic since they already do
`zig build test`.
2024-06-16 19:31:59 -07:00