5927 Commits

Author SHA1 Message Date
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
Loris Cro
1db99b08e2
Merge pull request #12347 from r00ster91/nicedocs
autodoc: various improvements
2022-08-08 18:31:01 +02:00
r00ster91
ff6d2e632f fix: cleanup recent changes 2022-08-08 18:14:26 +02: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
zooster
3debd6b732
Merge branch 'master' into nicedocs 2022-08-06 19:32:42 +02:00
Loris Cro
cb7c912a1b autodoc: use location.replace to avoid history spam when searching 2022-08-06 17:29:39 +02:00
Loris Cro
9fc6990052 autodoc: re-introduce search result limits 2022-08-06 17:29:13 +02:00
r00ster91
943f4eb515 fix: use brighter bg color for help modal in light mode
You can see this issue in the video.
2022-08-06 16:07:32 +02:00
r00ster91
60b04b0988 style: some more formatting 2022-08-06 16:01:43 +02:00
r00ster91
2f5afe1194 let -> const for dom elements
These should never be reassigned.
2022-08-06 15:53:20 +02:00
r00ster91
e921dd1136 style: missing semi 2022-08-06 15:38:32 +02:00
r00ster91
beba29c24f feat: make shadow of <kbd>s look nicer 2022-08-06 15:34:38 +02:00
r00ster91
ee72868f92 style: format
This is mostly manually formatted. I couldn't find a good HTML formatter for this file.
It also converts a bunch of tabs to spaces.
2022-08-06 15:34:00 +02:00
r00ster91
2f0abe63d4 fix: disable search bar before loading
This fixes the new search placeholder not disappearing if you type before
it finished loading, and maybe some other things.
2022-08-06 15:16:27 +02:00
r00ster91
df8cfb1273 feat: new search placeholder
This new search placeholder looks much nicer because it allows HTML inside it which
the `placeholder` attribute on `<input>`s doesn't allow.
I tested it for all kinds of cases and it seems to work pretty well.
2022-08-06 15:15:59 +02:00
r00ster91
6354851909 fix: "dialog" -> "modal"
"Dialog" is the incorrect term here because a dialog is a separate window that still lets you use the app
but a modal is a window where you can't continue using the app until you close it.
2022-08-06 15:05:58 +02:00
r00ster91
4ef567ba41 feat: make help modal disappear if you click outside it 2022-08-06 15:01:55 +02:00
Austin Rude
7afe7de4f0 autodoc: only modify the DOM once to display the search results 2022-08-05 21:47:36 -06:00
Austin Rude
e02f51762f autodoc: Run through prettier formatter with default settings 2022-08-05 16:01:57 -06: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
Loris Cro
7ffba492a5 autodoc: fix inconsistency when indexing generic types for search
closes #12334
2022-08-05 00:11:32 +02:00
Loris Cro
616f65df75 init-exe template: add flushing to the buffered writer 2022-08-04 21:12:42 +02:00
Loris Cro
cbac7a0194 init-exe template: small improvements 2022-08-04 20:27:46 +02:00
Loris Cro
fb0b9f05b3 new init-exe template
- removed an unnecessary (and confusing) `anyerror` fronm the function
  signature of `main`
- replaced the call to std.log with two prints: one to stderr and one to
  stdout
- replaced the test code with a better example
2022-08-04 20:10:43 +02: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

a2c32e972f
2022-08-03 21:19:41 +02:00
Loris Cro
4c750016eb autodoc: inferred error unions in function return values 2022-08-03 17:21:56 +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
Loris Cro
c5afefec42 autodoc: fix autodoc analysis for @typeInfo
We were previously erroneously saving it as a `@TypeOf`.
2022-08-02 17:49:36 +02:00
Loris Cro
622714b76b autodoc: fix frontend crash while rendering std.mem
Previously we expected to only find decl refs in a `foo.bar.baz`
type of expression. This would crash when trying to render something
like `@typeInfo(T).Int.bits`. We now properly account for builtins
and other components.
2022-08-02 17:49:36 +02:00
Veikka Tuominen
14f0b70570 Sema: add safety for sentinel slice 2022-08-02 18:34:30 +03:00
Loris Cro
2375658da9
Merge pull request #12276 from r00ster91/shortdesc
autodoc: better short description algorithm
2022-08-02 16:32:08 +02:00
Loris Cro
9ba2377d64
Merge pull request #12305 from squeek502/autodoc-field-doc-borders
autodoc: Add borders to field docs to make it clear which field they are associated with
2022-08-02 16:30:12 +02:00