Commit graph

32947 commits

Author SHA1 Message Date
Ryan Liptak
0779e847f7 Skip empty/invalid records/certs in MacOS keychain files
In the original PR that implemented this (https://github.com/ziglang/zig/pull/14325), it included a list of references for the keychain format. Multiple of those references include the checks that are added in this commit, and empirically this fixes the loading of a real keychain file that was previously failing (it had both a record with offset 0 and a record with cert_size 0).

Fixes #22870
2025-02-18 09:01:10 +01:00
schtvn
9e925a7acc Clean up duplicate code in decl_fields_fallible 2025-02-17 22:30:49 -08:00
schtvn
5a313192e6 Autodoc: Improve documentation for common types declared as type functions, such as ArrayList, StaticStringMap, BoundedArray, and more 2025-02-17 22:27:01 -08:00
Andrew Kelley
d2e70ef84a
Merge pull request #22913 from jacobly0/x86_64-rewrite
x86_64: rewrite unsafe int vector multiplication
2025-02-17 16:13:22 -08:00
Alex Rønne Petersen
b732070fd3
Merge pull request #22589 from alexrp/target-changes
Some miscellaneous target and calling convention changes
2025-02-18 00:51:59 +01:00
Alex Rønne Petersen
faccd79ca5
test: Update some compiler-internal type names in expected output. 2025-02-17 19:18:20 +01:00
Alex Rønne Petersen
f90f8f59a5
stage1: Update zig1.wasm.
Signed-off-by: Alex Rønne Petersen <alex@alexrp.com>
2025-02-17 19:18:20 +01:00
Alex Rønne Petersen
481b7bf3f0
std.Target: Remove functions that just wrap component functions.
Functions like isMinGW() and isGnuLibC() have a good reason to exist: They look
at multiple components of the target. But functions like isWasm(), isDarwin(),
isGnu(), etc only exist to save 4-8 characters. I don't think this is a good
enough reason to keep them, especially given that:

* It's not immediately obvious to a reader whether target.isDarwin() means the
  same thing as target.os.tag.isDarwin() precisely because isMinGW() and similar
  functions *do* look at multiple components.
* It's not clear where we would draw the line. The logical conclusion before
  this commit would be to also wrap Arch.isX86(), Os.Tag.isSolarish(),
  Abi.isOpenHarmony(), etc... this obviously quickly gets out of hand.
* It's nice to just have a single correct way of doing something.
2025-02-17 19:18:19 +01:00
Alex Rønne Petersen
e62352611f
std.Target: Move osArchName() and Cpu.Arch.archName() to std.zig.target.
These deal with how Zig stores OS headers in `lib/libc/include` and so don't
really belong in std.Target.
2025-02-17 19:17:56 +01:00
Alex Rønne Petersen
ce8c61b0fc
std.Target: Move Cpu.Arch.supportsAddressSpace() up to Cpu.
This allows it to inspect CPU features which is needed for Propeller, and AVR in
the future.
2025-02-17 19:17:56 +01:00
Alex Rønne Petersen
0048166867
std.Target: Make Cpu.Arch.supportsAddressSpace() take an optional context.
Allows deduplicating the code in Sema.
2025-02-17 19:17:56 +01:00
Alex Rønne Petersen
aa4ac2f85f
std.builtin: Rename CallingConvention.propeller1_sysv to propeller_sysv. 2025-02-17 19:17:56 +01:00
Alex Rønne Petersen
e0f8d4e68e
std.builtin: Rename CallingConvention.wasm_watc to wasm_mvp. 2025-02-17 19:17:56 +01:00
Alex Rønne Petersen
9c015e6c2b
std.builtin: Remove CallingConvention.arm_(apcs,aapcs16_vfp).
* arm_apcs is the long dead "OABI" which we never had working support for.
* arm_aapcs16_vfp is for arm-watchos-none which is a dead target that we've
  dropped support for.
2025-02-17 19:17:56 +01:00
Alex Rønne Petersen
2fe32ef847
std.Target: Remove Cpu.Arch.propeller2 and use a CPU feature instead. 2025-02-17 19:17:55 +01:00
Alex Rønne Petersen
5248f0a909
update_cpu_features: Handle targets that don't have LLVM data. 2025-02-17 19:17:55 +01:00
Alex Rønne Petersen
b541a7af11
std.Target: Remove Cpu.Arch.spu_2.
This was for a hobby project that appears to be dormant for now. This can be
added back if the project is resumed in the future.
2025-02-17 19:17:55 +01:00
Frank Denis
55c46870b2
crypto.auth.Aegis128X*Mac: properly absorb tags in the first lane (#22922)
In the MAC finalization function, concatenated tags at odd positions
were not absorbed into the correct lane.

Spotted by a Tigerbeetle regression test and reported by Rafael Batiati
(@batiati) — Thanks!
2025-02-17 17:56:09 +00:00
schtvn
1b62469ec9
Fix build failure in sbrk allocator, caused by #20511 2025-02-17 15:37:19 +01:00
Jacob Young
ff74127526 x86_64: implement prefetch 2025-02-17 06:04:43 -05:00
Jacob Young
82eedf56d7 x86_64: rewrite scalar @byteSwap 2025-02-17 05:36:18 -05:00
Jacob Young
cec6867d76 x86_64: rewrite unsafe int vector multiplication 2025-02-17 00:10:24 -05:00
Tw
d7b93c7876 Sema: make source location in checkCallConvSupportsVarArgs more meaningful
As calling convention may not be specified explicitly in the source,
so use va_arg's location instead.

Signed-off-by: Tw <tw19881113@gmail.com>
2025-02-17 05:28:11 +01:00
Mark Rushakoff
86064e66d6 std.testing: improve compile error on untagged union equality 2025-02-16 15:51:40 +01:00
Alex Rønne Petersen
ddff1fa4c6 compiler-rt: Use Windows Arm ABI routines for UEFI for now.
Until #21630 is addressed.

Closes #22893.
2025-02-16 01:15:29 +01:00
Manuel Spagnolo
9ad57515b2 remove unneeded native_os check
The check is not needed, since we are already checking for the os
at line 847 and returning at 916 when the check succeeds.
Therefore, at 926, we know the os is not windows.
2025-02-16 01:02:33 +01:00
Alex Rønne Petersen
d7f9b5a661 zig.h: Add new zig_gcc macro to indicate GCC.
As opposed to "GNU C" (zig_gnuc) which includes Clang.

This addresses #22890 but does not fix it until a zig1.wasm update.
2025-02-16 00:21:51 +01:00
Ian Johnson
75ccdcc356 Autodoc: report errors in user interface
Also includes panics by virtue of the previous commit, checking one item off #19249.
2025-02-15 17:32:44 -05:00
Ian Johnson
b745a96d20 Autodoc: use browser console log levels and simplify panic
Using the browser's `console.error`, etc. functions instead of `console.log` produces prettier output in the console. Additionally, `console.error` in particular includes a stack trace, which is useful for debugging where the error occurred.

Additionally, this commit leverages the enhanced logging to delete the separate `panic` function from the JS code and write it in Zig instead.
2025-02-15 17:29:31 -05:00
Ian Johnson
293603f040 Autodoc: report syntax errors to user
Additionally, this commit streamlines the way unparseable files are handled, by giving them the AST of an empty file. This avoids bugs in the rest of the Autodoc logic trying to work with invalid ASTs.
2025-02-15 17:29:31 -05:00
Andrew Kelley
e5174c7441
Merge pull request #22876 from jacobly0/x86_64-rewrite
x86_64: implement error set and enum safety
2025-02-15 12:33:09 -08:00
Jacob Young
dcc9fe322e x86_64: rewrite unsafe scalar int multiplication 2025-02-15 04:13:21 -05:00
Jacob Young
5db585fcde x86_64: reuse integer @divTrunc for @divExact 2025-02-15 03:45:21 -05:00
Jacob Young
f98f5a5f74 main: increase thread stack size for non-x86_64 backends
I observed a stack overflow during x86_64 CodeGen in a debug compiler
compiled by the llvm backend.  This happens while compiling
`main.buildOutputType` due to the Air being nested almost 500 levels.
2025-02-15 03:45:21 -05:00
Jacob Young
4ea18c22f9 x86_64: rewrite array access 2025-02-15 03:45:21 -05:00
Jacob Young
9f87aacaaf test: fix windows CI 2025-02-15 03:45:21 -05:00
Jacob Young
f6bcc9dbcb x86_64: rewrite scalar and vector int @rem 2025-02-15 03:45:21 -05:00
Jacob Young
8c48376d64 x86_64: rewrite scalar and vector int @divTrunc 2025-02-15 03:45:21 -05:00
Jacob Young
9f121ec8fb x86_64: implement unsafe scalar and vector integer add/sub 2025-02-15 03:45:21 -05:00
Jacob Young
8159ff8b81 x86_64: implement error set and enum safety
This is all of the expected 0.14.0 progress on #21530, which can now be
postponed once this commit is merged.

This required rewriting the (un)wrap operations since the original
implementations were extremely buggy.

Also adds an easy way to retrigger Sema OPV bugs so that I don't have to
keep updating #22419 all the time.
2025-02-15 03:45:21 -05:00
Benjamin Thompson
5ab5113077
added expectEqualDeep test coverage for issue 16625 (#22781) 2025-02-15 03:41:58 +01:00
LmanTW
13ad984b1f
std: add containsAtLeastScalar to mem (#22826) 2025-02-15 03:40:55 +01:00
Alex Rønne Petersen
8a3aebaee0 musl: Apply Rich Felker's CVE-2025-26519 mitigation patches.
https://www.openwall.com/lists/oss-security/2025/02/13/2

Closes #22883.
2025-02-14 06:42:57 +01:00
Hugo Beauzée-Luyssen
462d26171b glibc: don't redirect fts to fts64 before glibc 2.23 2025-02-14 02:11:26 +01:00
Michael Lynch
cb5547e3de
Expand zig fetch usage help doc to explain URL (#22850)
The current zig fetch help docs tell the user to specify a package's URL, but it's unclear what the URL should be.

This change expands the help output to explain what URLs the zig fetch command can handle and provides examples of valid URLs.

Related: #20096

A git bundle file seems to be the more accurate term, as it's what git uses in its documentation: https://git-scm.com/docs/git-bundle
2025-02-13 13:06:10 -08:00
Ali Cheraghi
bffbc918ee std.time: more precise nanoTimestamp in windows 2025-02-13 16:55:58 +01:00
Andrew Kelley
d12123a88c std.ArrayList: initial capacity based on cache line size
also std.MultiArrayList
2025-02-13 00:19:03 -08:00
wooster0
5b9b5e45cb std.fmt.digits2: optimize for ReleaseSmall
Difference:
```
$ cat x.zig
const std = @import("std");

pub const std_options = std.Options{ .keep_sigpipe = true };

pub fn main() void {
    std.io.getStdOut().writer().print("{d}\n", .{@intFromPtr(std.os.argv.ptr)}) catch {};
}
$ zig build-exe x.zig -OReleaseSmall -fsingle-threaded -fno-unwind-tables && wc -c x
2576 x
$ zig build-exe x.zig -OReleaseSmall -fsingle-threaded -fno-unwind-tables --zig-lib-dir ../zig/lib && wc -c x
2424 x
```
2025-02-12 14:45:38 -08:00
Andrew Kelley
de8741271f
Merge pull request #22873 from jacobly0/x86_64-rewrite
x86_64: implement conversions between float and int vectors
2025-02-12 13:54:03 -08:00
Jacob Young
13ca87e204 x86_64: implement conversions between float and int vectors 2025-02-12 10:11:54 -05:00