5193 Commits

Author SHA1 Message Date
fifty-six
da8d4d9225 std/fs: Support XDG_DATA_HOME
This is generally used for user-specific data on linux, with the
default being ~/.local/share
2022-01-24 17:33:38 +02:00
riverbl
1f10cf4edf
MultiArrayList: Fix error when struct is 0 sized
Also fixes error with ArrayHashMap when both key and value are 0 sized
2022-01-24 17:31:27 +02:00
Lee Cannon
c54a7ca4b2 allow expected_exit_code to be null 2022-01-24 17:29:19 +02:00
Andrew Kelley
12c2de6ee2
Merge pull request #10662 from ziglang/doc-comments-zir
Doc comments zir
2022-01-23 18:31:55 -05:00
Andrew Kelley
8a69726209 AstGen: doc comment fixups
* AstGen: use Ast.zig helper methods to avoid copy pasting token counting logic
   - take advantage of the `first_doc_comment` field we already have for
     param AST nodes
 * Add missing ZIR docs
2022-01-23 16:24:46 -07:00
Jimmi Holst Christensen
7287c7482a Stop using LinearFifo in BufferedWriter
Looking at the BufferedWriter assembly generated, one can see that is
has to do a lot of work, just to copy over some bytes and increase an
offset. This is because the LinearFifo is a much more general construct
than what BufferedWriter needs and the optimizer cannot prove that we
don't need to do this extra work.
2022-01-23 14:41:15 -05:00
Hadrien Dorio
490f067de8
compress: add a deflate compressor
Replaces the inflate API from `inflateStream(reader: anytype, window_slice: []u8)` to
`decompressor(allocator: mem.Allocator, reader: anytype, dictionary: ?[]const u8)` and
`compressor(allocator: mem.Allocator, writer: anytype, options: CompressorOptions)`
2022-01-23 19:30:06 +01:00
Hadrien Dorio
dba04a272a
compress: remove sha256 checks from tests
Read bytes to check expected values instead of reading and hashing them.
Hashing is a waste of time when we can just read and compare.
This also removes a dependency on std.crypto.hash.sha2.Sha256 for tests.
2022-01-23 19:29:57 +01:00
joachimschmidt557
fa84625aeb std: Add some missing termios types to c/linux.zig and os.zig 2022-01-23 17:12:07 +01:00
Andrew Kelley
d819663543 disable some broken stuff for stage2 llvm backend on aarch64 2022-01-21 14:42:58 -07:00
Jonathan Marler
0e682e71b0 remove unnecessary self argument 2022-01-20 10:55:10 +02:00
Meghan Denny
b7ba728929 std: add meta.DeclEnum 2022-01-20 10:54:45 +02:00
Daniel Saier
4a401b20e4 glibc: fix passing of __GNU_MINOR__
This was originally introduced in 4d48948b526337947ef59a83f7dbc81b70aa5723
but broken immediately afterwards in c8af00c66e8b6f62e4dd6ac4d86a3de03e9ea354.
2022-01-19 17:56:58 -05:00
Andrew Kelley
fd6d1fe015 stage2: improvements to entry point handling
* rename `entry` to `entry_symbol_name` for the zig build API
 * integrate with `zig cc` command line options
 * integrate with COFF linking with LLD
 * integrate with self-hosted ELF linker
 * don't put it in the hash for MachO since it is ignored
2022-01-19 11:41:08 -07:00
Kenta Iwasaki
5ae3e4e9bd lld: allow for entrypoint symbol name to be set
This commit enables for the entrypoint symbol to be set when linking ELF
or WebAssembly modules with lld using the Zig compiler.
2022-01-19 11:22:10 -07:00
Andrew Kelley
beb7495e19
Merge pull request #10624 from ziglang/prefetch
stage2: implement `@prefetch`
2022-01-18 23:25:44 -05:00
John Schmidt
305a7def13 Implement segfault handler for macOS x86_64 2022-01-18 15:10:49 -05:00
Andrew Kelley
30efcf22d7 stage2: implement @prefetch
This reverts commit f423b5949b8722d4b290f57c3d06d015e39217b0,
re-instating commit d48e4245b68bf25c7f41804a5012ac157a5ee546.
2022-01-18 11:59:09 -07:00
Andrew Kelley
f423b5949b Revert "stage2: implement @prefetch"
This reverts commit d48e4245b68bf25c7f41804a5012ac157a5ee546.

I have no idea why this is failing Drone CI, but in a branch, reverting
this commit solved the problem.
2022-01-18 10:47:02 -07:00
Andrew Kelley
4938fb8f5c test runner: stage2 llvm backend prints stats 2022-01-17 22:17:02 -07:00
Andrew Kelley
4d05f2ae5f remove zig_is_stage2 from @import("builtin")
Instead use the standarized option for communicating the
zig compiler backend at comptime, which is `zig_backend`. This was
introduced in commit 1c24ef0d0b09a12a1fe98056f2fc04de78a82df3.
2022-01-17 21:55:49 -07:00
Meghan
4a92f42ed7 std.c: add shm_open and shm_unlink
https://man7.org/linux/man-pages/man3/shm_open.3.html
2022-01-17 16:56:50 +02:00
johnLate
4addb26bba Fix os.rusage when linking with c library on Linux
Fixes ziglang#10543 on Linux.
2022-01-17 16:52:36 +02:00
Meghan Denny
0d0f277954 std: add json.stringifyAlloc 2022-01-17 12:32:02 +01:00
Jakub Konka
90343d1868 libstd: add smoke test for insert methods in MultiArrayList 2022-01-17 12:26:48 +01:00
Jarred Sumner
144e36770e
Fix missing !void in std.MultiArrayList
Calling `insert` on a `std.MultiArrayList` currently fails with a compiler error due to using a `try` without the `!` annotation on the return type

```zig
this.list.insert(allocator, 0, listener);
```

```zig
/Users/jarred/Build/zig/lib/std/multi_array_list.zig:192:13: error: expected type 'void', found '@typeInfo(@typeInfo(@TypeOf(std.multi_array_list.MultiArrayList(src.javascript.jsc.node.types.Listener).ensureUnusedCapacity)).Fn.return_type.?).ErrorUnion.error_set'
            try self.ensureUnusedCapacity(gpa, 1);
```
2022-01-16 17:26:49 -08:00
fifty-six
ff6ece3811 std/os/uefi: Don't treat efi status warnings as errors 2022-01-16 03:50:50 -05:00
fifty-six
03347114c3 std/os/uefi: Add util function for opening protocols 2022-01-16 03:04:37 -05:00
fifty-six
c727bd1bb6 std/os/uefi: Fix parameter type mismatch in edid_override_protocol 2022-01-16 02:52:45 -05:00
fifty-six
628a7f85de std/os/uefi: Add conversion from Status to EfiError
Allows handling uefi function errors in a more zig-style way with try
and catch, using `try f().err()` when a `Status` is returned.
2022-01-16 02:35:22 -05:00
fifty-six
d276a1189d std/os/uefi: Align first field of EdidOverrideProtocolAttributes to 4
This makes the struct align(4), which allows it to be passed as flags
more easily.
2022-01-16 02:05:27 -05:00
fifty-six
4771ac298b std/os/uefi: Simplify packed struct padding and default zero-initialize
Beyond adding default zero-initialization, this commit changes undefined
initialization to zero, as some cases reserved the padding and on other
cases, I've found some systems act strange when giving uninit instead of
zero even when it shouldn't be an issue, one example being
FileProtocol.Open's attributes, which *should* be ignored when not
creating a file, but ended up giving an unrelated error.
2022-01-16 02:04:39 -05:00
Jimmi Holst Christensen
f19b5ecf4b Slice function of BoundedArray now returns slice based on self pointer
If self pointer is const, the slice is const. Otherwise the slice is
mutable.
2022-01-16 01:37:37 -05:00
viri
12d6bcec02
std.os.windows: add ntdll thread information APIs 2022-01-15 17:46:33 -06:00
viri
3c2eddae5a
std.os.windows: fix casing for ntdll.lib
I've seen having this be wrong break some cross-compilers, and it's
also how it is in other files so it's best to be consistent.

It's also just the actual casing of the file.
2022-01-15 17:27:17 -06:00
Andrew Kelley
d48e4245b6 stage2: implement @prefetch 2022-01-15 15:18:25 -07:00
Jakub Konka
ba0f72363a
Merge pull request #10576 from schmee/macos-resolve-ip
Use libc if_nametoindex for macOS when parsing IPs
2022-01-15 00:47:12 +01:00
Andrew Kelley
3ed0741718 glibc: clean up build logic
also use the common naming convention for glibc versions ("2.33" rather
than "2-33").

I also verified that these files are exactly identical to the previous
files from before zig updated to glibc 2.34.
2022-01-14 12:39:06 -07:00
xavier
f1b14b91f1 glibc: restore compatibility with glibc<=2.33 for global initializers
__libc_start_main() from glibc.2.33.so or older needs to have a __libc_csu_init function callback parameter.

glibc-2.34 on the other hand has a different __libc_start_main() that does not use it,
and the start.S file from glibc-2.34 no longer construct the init function and pass null when calling __libc_start_main.

So, When targetting an older glibc, use the start.s files as they were in glibc-2.33 and construct the __libc_csu_init function.

fixes #10386 #10512
2022-01-14 11:48:37 -07:00
fifty-six
dab4c63684 std/os/uefi: Refactor getDevicePath()
Uses comptime loops over the types instead of writing out a large
switch.
2022-01-14 08:58:30 -05:00
John Schmidt
c992164dc7 Check for isDarwin() instead of linked libc 2022-01-14 13:44:38 +01:00
fifty-six
a2a2601da5 std/os/uefi: Complete DevicePathProtocol types 2022-01-14 07:02:55 -05:00
bryfry
0d45c72d3e Use allocPrintZ to avoid needing assumeSentinel 2022-01-14 00:17:38 -05:00
fifty-six
ae084c5f59 std/os/uefi: Complete AcpiDevicePath and HardwareDevicePaths 2022-01-13 15:47:14 -05:00
fifty-six
322757c4e1 std/os/uefi: Add parameter names to boot_services 2022-01-13 15:47:14 -05:00
fifty-six
88687645b2 std/os/uefi: Fill out remaining runtime services and add parameter names 2022-01-13 15:47:14 -05:00
fifty-six
fe28cb8261 std/os/uefi: Fill out remaining function signatures and docs on boot_services 2022-01-13 15:47:14 -05:00
fifty-six
649b872450 std/builtin: improve panic handler for uefi
Writes the panic message to stderr as well as passing it to
boot_services.exit when boot_services is available.
2022-01-13 15:47:14 -05:00
fifty-six
ea2df2601e std/os/uefi: Use usingnamespace to re-export symbols
`uefi/protocols.zig` and `uefi/tables.zig` just re-exported all the
public symbols, which is basically the purpose of `usingnamespace`
import-wise.
2022-01-13 15:47:13 -05:00
Andrew Kelley
9bf2bda683 compiler_rt: one less exception for stage2 2022-01-13 00:32:48 -07:00