Commit Graph

22416 Commits

Author SHA1 Message Date
leap123
ef8f694d77
std.os.uefi: fix shift in pool allocator (again) (#14497) 2023-01-31 13:08:30 -05:00
r00ster91
17404f8e6e Sema: emit compile error for comptime or inline call of function pointer 2023-01-31 17:15:34 +02: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
kcbanner
fcb05ee2e7 cbe: don't emit unused undefined array literals 2023-01-29 15:02:04 -05:00
Andrew Kelley
317d57115d std.debug: disable sporadically failing test
see tracking issue #13963
2023-01-29 12:48:38 -07:00
joachimschmidt557
090186a0c2 stage2 AArch64: move copy-register-arg-to-stack code to fn prologue
This enhances the debugging experience as upon encountering a
breakpoint in a function, all arguments passed as registers have
already been moved to the stack, ready to be inspected by the
debugger.
2023-01-29 20:00:53 +01: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
Jakub Konka
5a67ae506a
Merge pull request #14472 from ziglang/alloc-decls
self-hosted: remove allocateDeclIndexes from the linker API
2023-01-28 22:33:56 +01:00
Jon-Eric Cook
4c11684184
std.json: check output and source lengths in std.json 2023-01-28 16:26:36 +00:00
Andrew Kelley
f68d3c63df CI: give x86_64-linux-release a little more time
When the CPU cores are pegged, the thermal throttling kicks in and makes
jobs take significantly longer.
2023-01-27 14:53:17 -07:00
Jakub Konka
a898729139 self-hosted: remove allocateDeclIndexes from the public link.File API 2023-01-27 19:51:06 +01:00
Luuk de Gram
b25efb86e1
wasm: migrate to new non-allocateDeclIndexes API 2023-01-27 19:24:15 +01:00
Andrew Kelley
97b1a9bb6b cmake: no -Werror on the C++ code we copy from llvm 2023-01-26 20:13:27 -05: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
Jakub Konka
cc1d7a0e31 coff: migrate to new non-allocateDeclIndexes API 2023-01-26 14:29:14 +01:00
Jakub Konka
e1b9800ffa elf: migrate to new non-allocateDeclIndexes API 2023-01-26 14:29:14 +01:00
Jakub Konka
fb8d754a4b elf: move TextBlock into its own module and rename to Atom 2023-01-26 14:29:14 +01:00
Jakub Konka
2b5d0ca73b elf: pull out logic for allocating a GOT entry into a helper 2023-01-26 14:29:14 +01:00
Jakub Konka
041bc71bc8 self-hosted: clean up calling logic for x86_64 and aarch64 across linkers 2023-01-26 14:29:14 +01:00
Jakub Konka
4d804c1b23 macho: completely remove allocateDeclIndexes in favor of linker tracking 2023-01-26 14:29:14 +01:00
Jakub Konka
48f9e491cb
Merge pull request #14453 from ziglang/self-hosted-codegen-cleanup
self-hosted: cleanup codegen.Result
2023-01-26 08:01:51 +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
Manlio Perillo
fcef728b9b langref: make "Type Coercion" subsections more consistent
In the "Type Coercion" section, rename:
  - Coercion Float to Int => Float to Int
  - unions and enums => Unions and Enums
  - tuples to arrays => Tuples to Arrays
2023-01-25 23:29:25 +02:00
Manlio Perillo
21d9f0c2a1 langref: add missing dot at the end of the paragraph
In the "C Variadic Functions" section, add a missing dot at the end of
the paragraph before the test_defining_variadic_function.zig example.
2023-01-25 16:09:17 -05:00
fn ⌃ ⌥
d0dedefde9 std.compress.xz: fix for big-endian targets 2023-01-25 08:49:59 -08:00
Manlio Perillo
d64dd75e34 langref: update the documentation of @Type
@Type is currently available for Functions.
2023-01-25 18:15:56 +02:00
Manlio Perillo
33e5a84706 langref: improve test_coerce_unions_enums.zig
Add more coercion examples to test_coerce_unions_enums.zig in the
"Type Coercion: unions and enums" section.
2023-01-25 17:03:39 +02:00
Manlio Perillo
8de46d1d7d langref: move paragraph inside the p element
In the "C Translation CLI" section, move the paragraph inside the p
element.

The current HTML is valid, but, as an example, a paragraph outside a p
element is not handled correctly by the browser Inspect tool.
2023-01-25 17:01:43 +02:00
Loris Cro
989e771534
Merge pull request #14456 from der-teufel-programming/autodoc-tuples
autodoc: added support for tuple structs
2023-01-25 15:44:08 +01:00
Der Teufel
e6cab917e1 autodoc: added support for tuple structs 2023-01-25 15:34:04 +01:00
Jakub Konka
a95d58caf2 self-hosted: rename codegen Result.appended to Result.ok 2023-01-25 10:28:18 +01:00
Jakub Konka
4983da40d0 self-hosted: remove unused externally_managed prong for Decls code 2023-01-25 10:10:50 +01:00
Jakub Konka
e675af0698 elf+macho: append null to DWARF strtab to avoid overlapping sects
Otherwise, we were risking having strtab zero-sized and overlap
with another section.
2023-01-25 09:58:13 +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
3ff1f346b0 CI: give aarch64-linux-debug a little more time 2023-01-24 20:32:29 -07: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