Commit Graph

6975 Commits

Author SHA1 Message Date
Andrew Kelley
71ff60f126 std.build: eliminate setTarget and setBuildMode
This is a breaking change that makes the API for creating build
artifacts no longer have any period of time where the target and
optimization mode are not set.
2023-01-31 15:09:35 -07:00
Andrew Kelley
063888afff std.build: implement passing options to dependency packages
* introduce the concept of maps to user input options, but don't
   implement it for command line arg parsing yet.
 * remove setPreferredReleaseMode and standardReleaseOptions in favor of
   standardOptimizeOption which has a future-proof options parameter.
2023-01-31 15:09:35 -07:00
leap123
ef8f694d77
std.os.uefi: fix shift in pool allocator (again) (#14497) 2023-01-31 13:08:30 -05:00
Andrew Kelley
d6b430b520 std.Target: remove workaround
This was working around a stage1 compiler bug.
2023-01-31 02:28:16 -05:00
Techatrix
885d696895 zig fmt: fix file ending in a multi line comment 2023-01-30 00:42:05 +02:00
Jiacai Liu
d8c3c11c6c
std: add expectEqualDeep (#13995) 2023-01-29 22:00:14 +00:00
Isaac Freund
23b7d28896 std: restrict mem.span() and mem.len() to sentinel terminated pointers
These functions are currently footgunny when working with pointers to
arrays and slices. They just return the stated length of the array/slice
without iterating and looking for the first sentinel, even if the
array/slice is a sentinel terminated type.

From looking at the quite small list of places in the standard
library/compiler that this change breaks existing code, the new code
looks to be more readable in all cases.

The usage of std.mem.span/len was totally unneeded in most of the cases
affected by this breaking change.

We could remove these functions entirely in favor of other existing
functions in std.mem such as std.mem.sliceTo(), but that would be a
somewhat nasty breaking change as std.mem.span() is very widely used for
converting sentinel terminated pointers to slices. It is however not at
all widely used for anything else.

Therefore I think it is better to break these few non-standard and
potentially incorrect usages of these functions now and at some later
time, if deemed worthwhile, finally remove these functions.

If we wait for at least a full release cycle so that everyone adapts to
this change first, updating for the removal could be a simple find and
replace without needing to worry about the semantics.
2023-01-29 15:07:06 -05:00
kcbanner
7c2ba950a7 build: .c ofmt does not produce a pdb 2023-01-29 15:04:51 -05:00
kcbanner
a9b68308b9 cbe: fixes for tls, support for not linking libc, and enabling tests
- cbe: Implement linksection support, to support TLS when not linking libc
- cbe: Support under-aligned variables / struct fields
- cbe: Support packed structs (in the C definition of packed)
- windows: Fix regression with x86 _tls_array
- compiler_rt: Add 128-bit atomics to compiler_rt
- tests: Re-enable threadlocal tests on cbe+windows, and llvm+x86
- tests: Re-enable f80 tests that now pass
- ci: change windows ci to run the CBE behaviour tests with -lc, to match how the compiler is bootstrapped
- update zig1.wasm
2023-01-29 15:04:13 -05:00
Yusuf Bham
9177e0da4f std.os.uefi: fix shift in pool allocator 2023-01-29 15:02:22 -05:00
Andrew Kelley
317d57115d std.debug: disable sporadically failing test
see tracking issue #13963
2023-01-29 12:48:38 -07:00
Michael Dusan
599b3ef9e9 netbsd: use versioned __msync13 from libc
The system linker shows warning when `msync` is linked instead of `__msync13`:

  "warning: reference to compatibility msync(); include <sys/mman.h> for correct reference"

closes #14422
2023-01-28 19:05:38 -05:00
zigster64
2b27bc2c65 On BrokenPipe error during os.sendfile - return error rather than unreachable 2023-01-28 18:27:43 -05:00
Jon-Eric Cook
4c11684184
std.json: check output and source lengths in std.json 2023-01-28 16:26:36 +00:00
Takeshi Yoneda
ce20ebb50c wasi: remove unnecessary breakpoint() in abort
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2023-01-26 19:14:36 +01:00
Takeshi Yoneda
3c6c4f88bb wasm: uses main instead of main2 for test runner
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2023-01-26 17:49:43 +01:00
Andrew Kelley
96a55f6ce8
Merge pull request #14434 from FnControlOption/xz
Add xz decoder

closes #14300
closes #2851
2023-01-25 20:31:55 -05:00
fn ⌃ ⌥
d0dedefde9 std.compress.xz: fix for big-endian targets 2023-01-25 08:49:59 -08:00
Der Teufel
e6cab917e1 autodoc: added support for tuple structs 2023-01-25 15:34:04 +01:00
Andrew Kelley
d703270545 zig build system: add LibExeObjStep.installLibraryHeaders
This function is needed when a library exposes one of its own library
dependency's headers as part of its own public API.

Also, improve error message when a file system error occurs during
install file step.
2023-01-25 02:45:57 -05:00
Andrew Kelley
cb9d00e1af
Merge pull request #14402 from kcbanner/cbe_x86_fixes
CBE: x86 support and MSVC ABI fixes
2023-01-24 17:53:54 -05:00
Andrew Kelley
92ea7bce5d std.compress.xz: fix compile error on 32-bit systems 2023-01-24 15:24:19 -07:00
Andrew Kelley
d94613c1d0 support xz compressed tarballs in the package manager
This includes a breaking change:

std.compress.gzip.GzipStream renamed to
std.compress.gzip.Decompress

This follows the same naming convention as std.compress.xz so that the
stream type can be passed as a comptime parameter.
2023-01-24 15:24:19 -07:00
Andrew Kelley
ea9ded8758 std.compress.xz public API cleanup
* add xz to std.compress
 * prefer importing std.zig by file name, to reduce reliance on the
   standard library being a special case.
 * extract some types from inside generic functions. These types are the
   same regardless of the generic parameters.
 * expose some more types in the std.compress.xz namespace.
 * rename xz.stream to xz.decompress
 * rename check.Kind to Check
 * use std.leb for LEB instead of a redundant implementation
2023-01-24 15:24:19 -07:00
fn ⌃ ⌥
06ce15e8f7 Add an xz decoder to the standard library 2023-01-24 15:24:04 -07:00
David Gonzalez Martin
dfcedfdca0 build: Fix red zone flag 2023-01-24 15:41:30 -05:00
Isaac Freund
9eeae556cc std: remove meta.assumeSentinel
All but 3 callsites of this function in the standard library and
compiler were unnecessary and were removed in faf2fd18.

In this commit, the remaining 3 callsites are removed. One of them
turned out to also be unnecessary and has been replaced by slicing
directly with the length..

The 2 remaining callsites were in the very pointer-math heavy
std/os/linux/vdso.zig code which should perhaps be refactored to better
utilize slices. These 2 callsites are replaced with a plain
@ptrCast([*:0]u8, ptr) though could likely use std.mem.sliceTo() if the
surrounding code was refactored.
2023-01-24 15:39:52 -05:00
Der Teufel
dd8e16b906 autodoc: Add tag handling to enums and unions. Add support for Struct, Enum, Union types in exprName.
Anonymous types now work via a hack to ast_nodes.
2023-01-24 19:07:25 +01:00
Der Teufel
da68e7f0cb autodoc: add html tags to "null" 2023-01-24 19:07:25 +01:00
Loris Cro
af820bbb94 autodoc: init support for guides 2023-01-24 18:56:35 +01:00
kcbanner
5d46addd25 compiler_rt: re-enable divxf3 test on windows/llvm 2023-01-24 13:06:59 +02:00
kcbanner
4f6fdd67dd debug: re-enable resource management test on x86_64 windows 2023-01-24 12:41:19 +02:00
David Gonzalez Martin
59d9afcb5c [UEFI] Delete unnecessary padding and fix number_of_pages type 2023-01-23 21:05:38 -05:00
Andrew Kelley
ac28bedbee
Merge pull request #14418 from ifreund/assume-sentinel-sux
std: eliminate pointless meta.assumeSentinel() usage
2023-01-23 21:01:54 -05:00
kcbanner
c7a9c28310 update zig1.wasm 2023-01-23 13:48:37 -05:00
kcbanner
77084093d8 cbe: handle building for -msvc using clang and -gnu using msvc 2023-01-23 13:48:37 -05:00
kcbanner
4a330ab811 target: use 16 byte alignment for 128-bit types on x86 and ofmt .c 2023-01-23 13:48:37 -05:00
kcbanner
0d249e558a cbe: fixup handling of c_longdouble for msvc abi 2023-01-23 13:48:36 -05:00
kcbanner
a7209e7d12 cbe: fixup zig_export for x86 2023-01-23 13:48:36 -05:00
kcbanner
b22b84de9d cbe: fixup x86 atomics
- add zig_msvc_atomic_barrier()
- fix zig_msvc_atomic_load_p32
2023-01-23 13:48:36 -05:00
kcbanner
1aa2c32055 cbe: fixes for x86
- Emit calling convention
- Fix .Naked handling for msvc
- Add teb helper for x86
- Fix 128-bit shl implementation when rhs is >= 64
- Add 128-bit shl tests
2023-01-23 13:48:36 -05:00
Isaac Freund
186e805838
std.net.Address: clarify unix socket getOsSockLen 2023-01-23 14:49:06 +01:00
Isaac Freund
faf2fd18d3
std: eliminate pointless meta.assumeSentinel() usage
This fixes a bug in std.net caused during the introduction of
meta.assumeSentinel due to the unfortunate semantics of mem.span()

This leaves only 3 remaining uses of meta.assumeSentinel() in the
standard library, each of which could be a simple @ptrCast([*:0]T, foo)
instead. I think this function should likely be removed.
2023-01-23 12:19:53 +01:00
Manlio Perillo
05c7f7abf1 build: fix incorrect name in InstallArtifactStep
Rename the full_pdb_path variable to full_h_path, in the
InstallArtifactStep.make method.
2023-01-23 02:07:37 -05:00
Jan Philipp Hafer
55e879d2ed std.os.windows: add possible error NETNAME_DELETED of ReadFile
Closes #13631
2023-01-23 02:07:12 -05:00
Mateusz Poliwczak
bbbc4ebf03 support P256 in x509 2023-01-22 17:24:45 -05:00
fn ⌃ ⌥
33682a29c6 Rewrite update_crc_catalog in zig and move tests to separate file 2023-01-22 07:16:49 -08:00
fn ⌃ ⌥
6089ed9ee7 Merge branch 'master' into crc 2023-01-22 05:30:38 -08:00
fn ⌃ ⌥
f85c01d4c7 Implement gzip header CRC check.
From RFC 1952:

> If FHCRC is set, a CRC16 for the gzip header is present,
> immediately before the compressed data. The CRC16 consists
> of the two least significant bytes of the CRC32 for all
> bytes of the gzip header up to and not including the CRC16.
2023-01-22 00:33:29 -05:00
Jakub Konka
562d52e23d
Merge pull request #14397 from ziglang/macho-unwind-info
zld: handle parsing and synthesising unwind info in the MachO linker
2023-01-22 00:44:44 +01:00