Commit Graph

5591 Commits

Author SHA1 Message Date
Jakub Konka 070282a96e libstd: fix off-by-one error in def of ProcSym in pdb
Make sure `ProcSym` includes a single element byte-array which delimits
the start of the symbol's name as part of its definition. This makes
the code more elegant in that accessing the name is equivalent to taking
the address of this one element array.
2022-08-17 16:36:02 -04:00
Andrew Kelley a12abc6d6c Merge pull request #12456 from Vexu/stage2
Stage2 namespacing fixes
2022-08-16 19:57:22 -04:00
Andrew Kelley 9d85335de9 Merge pull request #12427 from r00ster91/nicelexer
tokenizer: cleanups
2022-08-16 14:08:31 -04:00
Veikka Tuominen 9d4561ef00 AstGen: detect declarations shadowing locals
Closes #9355
2022-08-16 20:35:03 +03:00
r00ster91 83909651ea test: simplify testTokenize
What this does is already done by `expectEqual`.
Now the trace seems to be shorter and more concise so the errors should be easier to read now.
2022-08-16 00:20:19 +02:00
r00ster91 5490688d65 refactor: use std.ascii functions 2022-08-16 00:20:19 +02:00
r00ster91 e3b3eab840 test(names): some renamings 2022-08-16 00:20:19 +02:00
r00ster91 f07cba10a3 test(names): remove unnecessary "tokenizer - " prefix 2022-08-16 00:20:19 +02:00
Ryan Liptak 764cf4e53f std.fs: Fix WalkerEntry.dir not always being the containing dir
Before this commit, the modified test would fail with `FileNotFound` because the `entry.dir` would be for the entry itself rather than the containing dir of the entry. That is, if you were walking a tree of `a/b`, then (previously) the entry for `b` would incorrectly have an `entry.dir` for `b` rather than `a`.
2022-08-15 11:25:51 +03:00
Yujiri 2279f27e0f Fix #12423: auto_hash not hashing arrays of slices uniquely 2022-08-14 23:12:48 +03:00
Andrew Kelley e67a43a673 Merge pull request #12410 from ifreund/sig-err-dfl-ign-fix
std: fix definition of SIG_IGN, SIG_DFL, etc.
2022-08-11 15:05:07 -04:00
LordMZTE bbcc26a9b6 fix error message when providing slice to std.hash.autoHash 2022-08-11 21:44:33 +03:00
Andrew Kelley a82d7c2063 std: add missing error to windows.WriteFile
I encountered this error today when testing the self-hosted compiler on
Windows.
2022-08-11 06:22:05 -04:00
Isaac Freund b78f3bf1f1 std: fix definition of SIG_IGN, SIG_DFL, etc.
POSIX specifies that the sa_handler field of the sigaction struct may
be set to SIG_IGN or SIG_DFL. However, the current constants in the
standard library use the function pointer signature corresponding to
the sa_sigaction field instead.

This may not cause issues in practice because the fields usually occupy
the same memory in a union, but this isn't required by POSIX and there
may be systems we do not yet support that do this differently.

Fixing this also makes the Zig interface less confusing to use after
reading the man page.
2022-08-11 12:09:34 +02:00
Isaac Freund 7d6a7f513b std: Don't pass undefined memory to the kernel in os.abort() 2022-08-11 11:05:53 +02:00
Andrew Kelley fa620ef710 link.MachO: use accurate alignment attribute on pointers
Also adds a new method to ArrayList: appendUnalignedSlice
2022-08-10 22:28:05 -07:00
Andrew Kelley e0178890ba Merge pull request #12379 from ifreund/packed-struct-explicit-backing-int
stage2: Implement explicit backing integers for packed structs
2022-08-10 19:13:29 -04:00
zooster 8fd20a5eb0 fix: disallow newline in char literal 2022-08-10 16:13:56 -04:00
Isaac Freund 0d32b73078 stage2: Implement explicit backing integers for packed structs
Now the backing integer of a packed struct type may be explicitly
specified with e.g. `packed struct(u32) { ... }`.
2022-08-10 19:54:45 +02:00
Veikka Tuominen 19af4b5cad std: add workaround for stage2 bug 2022-08-09 16:19:55 +03:00
Andrew Kelley 1a500b9699 Sema: avoid error return traces when possible
stage2 was adding bogus error return trace frames when an error was not
being returned. This commit makes several improvements:

 * Make a runtime check if necessary to only emit a frame into the error
   return trace when an actual error is returned.
 * Use the `analyzeIsNonErrComptimeOnly` machinery to avoid runtime
   checks when it is compile-time-known that the value is an error, or a
   non-error.
 * Make std.builtin.returnError take a non-optional stack trace pointer.

closes #12174
2022-08-08 19:16:21 -07:00
Ryotaro "Justin" Kimura 50b36e84fa std: fix BoundedArray test checking wrong condition (#12372) 2022-08-08 18:13:35 -04:00
Meghan Denny 0879cbeed2 remove 'builtin.stage2_arch', Sema is smart enough now 2022-08-07 16:07:08 -07:00
Jakub Konka ae16c1d083 std: use std.macho.LoadCommandIterator for MachO parsing in std.debug 2022-08-06 23:14:54 -07:00
Veikka Tuominen bd21f499dc Type: adjust C type sizes 2022-08-06 14:42:05 -07:00
N00byEdge 18440cb239 std.mem.zeroes: Zero sized structs with uninitialized members (#12246)
`std.mem.zeroes(struct{handle: void})` Failed with the following error before:
```
/nix/store/l6v4359wc9xrxxmvvp3rynsb5s3d78xf-zig-0.9.1/lib/zig/std/mem.zig:270:42: error: missing field: 'handle'
            if (@sizeOf(T) == 0) return T{};
                                         ^
```
2022-08-05 15:47:52 +03:00
Allan Regush 44c321c05e std.enums: make directEnumArrayLen public 2022-08-05 15:41:03 +03:00
Felix "xq" Queißner 263b5933d2 Makes std.meta.Tuple and std.meta.ArgsTuple generate a unique type instead of generating one per invocation. 2022-08-05 15:39:53 +03:00
Stephen Gregoratto b3950d4a88 Update Linux syscall list for 5.19
New changes: memfd_secret implemented for RISC-V.
2022-08-05 15:36:32 +03:00
Jakub Konka 421d3e8d28 macho: add missing align cast in LoadCommandIterator 2022-08-03 21:19:41 +02:00
Jakub Konka bb532584bc macho: update how we insert output sections
Instead of generating sections upfront, allow generation by scanning
the object files for input -> output sections mapping. Next, always
strive to keep output sections in the final container sorted as they
appear in the final binary. This makes the linker less messy wrt
handling of output sections sort order for dyld/macOS not to complain.
There's still more work to be done for incremental context though
to make this work but looks promising already.
2022-08-03 21:19:41 +02:00
Jakub Konka f26d5ee7ea macho: sync with zld
gitrev a2c32e972f8c5adfcda8ed2d99379ae868f59c24

https://github.com/kubkon/zld/commit/a2c32e972f8c5adfcda8ed2d99379ae868f59c24
2022-08-03 21:19:41 +02:00
Frank Denis fa321a07cd crypto.sign.ed25519: include a context string in blind key signatures (#12316)
The next revision of the specification is going to include a context
string in the way blinded scalars are computed.

See:
https://github.com/cfrg/draft-irtf-cfrg-signature-key-blinding/issues/30#issuecomment-1180516152
https://github.com/cfrg/draft-irtf-cfrg-signature-key-blinding/pull/37
2022-08-03 15:25:15 +02:00
Veikka Tuominen 14f0b70570 Sema: add safety for sentinel slice 2022-08-02 18:34:30 +03:00
Ryan Liptak e7b6a18331 std.fs: Split Iterator.next on Linux and WASI to allow for handling platform-specific errors
Follow up to #12226, implements the compromise detailed in https://github.com/ziglang/zig/issues/12211#issuecomment-1196011590
2022-08-01 19:38:05 +03:00
Ryan Liptak 1a1b7a3afd Linux: Add IN_MASK_CREATE and corresponding error handling in inotify_add_watch
From https://man7.org/linux/man-pages/man7/inotify.7.html

> **IN_MASK_CREATE** (since Linux 4.18)
>
> Watch pathname only if it does not already have a watch associated with it; the error EEXIST results if pathname is already being watched.
2022-07-31 13:00:16 -07:00
Veikka Tuominen d26d696ee0 parser: require expression after colon in slice expr 2022-07-30 00:18:08 +03:00
Andrew Kelley a482517357 std.debug: default signal handler also handles SIGFPE 2022-07-29 02:35:06 -07:00
Meghan Denny b5861193e0 std: rename std.Target.systemz to .s390x 2022-07-28 23:22:44 -07:00
Andrew Kelley 90f23e131e Merge pull request #12252 from ziglang/stage3-test-cases
CI: run test-cases with stage3
2022-07-27 10:27:12 -07:00
r00ster91 baafb8a491 std.fmt: add more invalid format string errors 2022-07-27 18:07:53 +03:00
r00ster91 4ef7d85810 std.fmt: lowercase compile errors
`compileError\("([A-Z])` and `compileError\("\L\1`. It's pretty convenient.
2022-07-27 18:07:53 +03:00
Evan Haas 7ba1f9bfb5 translate-c: take address of functions before passing them to @ptrToInt
Fixes #12194
2022-07-27 14:03:08 +03:00
Andrew Kelley a127693f95 start code: enable segfault handler for stage2 2022-07-26 20:04:24 -07:00
Andrew Kelley 0ffcf19e3d Merge pull request #12237 from Vexu/stage2-compile-errors
Stage2 improve errors for builtin function options structs
2022-07-26 11:26:35 -07:00
InKryption a0d3a87ce1 std.fmt: require specifier for unwrapping ?T and E!T 2022-07-26 11:25:49 -07:00
r00ster 1a16b7214d std.mem: add reset to SplitBackwardsIterator and SplitIterator 2022-07-26 14:26:46 +03:00
Veikka Tuominen a463dc7d6c AstGen: disable null bytes and empty stings in some places
Namely:
 * test names
 * identifiers
 * library names
 * import strings
2022-07-26 12:14:59 +03:00
Veikka Tuominen 2f54129087 parser: add error for doc comment attached to comptime or test blocks 2022-07-26 12:14:59 +03:00
r00ster cff5d9c805 std.mem: add first method to SplitIterator and SplitBackwardsIterator 2022-07-25 22:04:30 +03:00