15114 Commits

Author SHA1 Message Date
Philipp Lühmann
d1908c9f66
zig fmt: Keep callconv(.Inline) on function pointer types
Co-authored-by: Philipp Lühmann <mail@philipp.lu>
2021-09-14 11:36:26 +02:00
Andrew Kelley
264acfdf3c stage2: fix incorrect spelling of AtomicOrder 2021-09-13 22:01:40 -07:00
Andrew Kelley
97d69e3352 stage2: add array_to_slice AIR instruction 2021-09-13 21:37:11 -07:00
Andrew Kelley
a9a21c5988 stage2: Type/Value use an enum rather than usize
Makes debugging nicer when you want to look at Type/Value
2021-09-13 21:14:40 -07:00
Andrew Kelley
5529febab0 stage2: implement Value.copy for structs and unions
The stage2_os hack inside `@import("builtin")` is no longer needed.
2021-09-13 20:11:35 -07:00
lucky
f011f13933
fix missing paths (#9754)
increase bcrypt benchmark rounds

Co-authored-by: lucky <>
2021-09-13 17:31:17 +02:00
Jakub Konka
50e34a063c
Merge pull request #9734 from Andoryuuta/macho-zld-win-filepath
link/include: fix invalid file path concatenation when cross-compiling for Windows -> Mac
2021-09-13 09:04:11 +02:00
Kenta Iwasaki
c4f97d3365 os: usingnamespace fixes for std.x.os.Socket and std.os.TCP
Extract existing constants to do with TCP socket options into a 'TCP'
namespace.

Export 'MSG' and 'TCP' from std.os.{linux, windows} into std.c.

Fix compile errors to do with std.x.os.Socket methods related to setting
TCP socket options.

Handle errors in the case that an interface could not be resolved in an
IPv6 address on Windows. Tested using Wine with the loopback interface
disabled.

Have all instantiations of std.x.os.Socket on Windows instantiate an
overlapped socket descriptor. Fixes the '1ms read timeout' test in
std.x.net.tcp.Client. The test would previously deadlock, as read
timeouts only apply to overlapped sockets.

Windows documentation by default recommends that most instantiations of
sockets on Windows be overlapped sockets (s.t. they may operate in both
blocking or nonblocking mode when operated with WSA* syscalls). Refer to
the documentation for WSASocketA for more info.
2021-09-12 23:36:44 -04:00
Andrew Gutekanst
ffb9891695 Fix same issue with dir/sysroot dir concatenation with includes on Windows 2021-09-12 19:35:03 -04:00
Andrew Gutekanst
62a6d83da1 Address feedback 2021-09-12 19:34:06 -04:00
Silver
2118566931 std: publicize ArrayListUnmanaged.allocatedSlice to match ArrayList 2021-09-12 19:32:40 +03:00
Andrew Gutekanst
6734271eb0 link: fix invalid file path used when cross-compiling for Windows -> Mac
While investigating hexops/mach#8 with @slimsag,
we found that zld is forming invalid file paths (absolute paths concatenated together),
which hits the unreachable `OBJECT_NAME_INVALID` case in `openDirAccessMaskW`:
0c091feb5a/lib/std/fs.zig (L1522)

This is caused by appending `dir` (which is guaranteed to be absolute) to `root`,
an obviously incorrect operation:
0c091feb5a/src/link/MachO.zig (L494-L499)

Fixes hexops/mach#8

Co-authored-by: Stephen Gutekanst <stephen@hexops.com>
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
Signed-off-by: Andrew Gutekanst <andrew.gutekanst@gmail.com>
2021-09-10 23:55:13 -04:00
Mr. Paul
0c091feb5a Improve HTML semantics and a11y of language reference
The language reference's HTML has been updated to be more semantically correct.
This also helps to improve the document's accessibility concerns.

* Document structure has single h1, other header sections start at h2, nav sections w/ aria labels, main section
* Zig's homepage is linked, Zig Standard Library section link to it
* Tables have caption and scoping rows and columns
* Code blocks are figures with figure captions citing source files
* Change line height 1.5 to include table of contents as well
* Luminosity contrast ratios have been adjusted to 7:1
* Dark mode colors adjusted to reduce eye strain
* Links have default browser underline with hover and focus effects
* Asides, definition lists, keyboard inputs, program outputs are represented semantically

Tools used to check:
WAVE plugin https://wave.webaim.org/
Firefox Accessibility Developer Tool
Lighthouse Accessibility Tool
2021-09-10 14:23:32 -04:00
Luuk de Gram
9e24727062
Fix compile error for p256 scalar arithmetic (#9715) 2021-09-10 15:41:15 +02:00
Martin Wickham
93c6e31cf1 Fix unmatched close brace in zir dump 2021-09-09 15:34:58 -04:00
lucky
3611487952
reexport crypto/phc_encoding (#9712)
Co-authored-by: lucky <>
2021-09-09 14:25:44 +02:00
FnControlOption
23c25c5eaf cmake: also check Homebrew install paths when looking for LLVM
- On Intel Macs, the path is /usr/local/opt/llvm@12
- On Silicon Macs, the path is /opt/homebrew/opt/llvm@12

This makes specifying CMAKE_PREFIX_PATH optional for Homebrew LLVM.
2021-09-08 13:48:16 -04:00
Sébastien Marie
175d95b591 openbsd: readapt event loop after usingnamespace changes 2021-09-08 13:40:43 -04:00
Andrew Kelley
6237dc0ab8
Merge pull request #9700 from marler8997/bootstrapAarch64Windows
changes to build zig-bootstrap aarch64-windows
2021-09-08 13:32:20 -04:00
Jonathan Marler
343547d4a4 finalize windows_sdk paths based on snickler suggestions 2021-09-07 21:49:08 -06:00
Andrew Kelley
501e6cf2f3 ci: add 0.8.1 release to download page 2021-09-07 14:36:08 -07:00
Jonathan Marler
375619820e changes to build zig-bootstrap aarch64-windows 2021-09-07 14:27:50 -06:00
Andrew Kelley
d305ba7f2d
Merge pull request #9636 from ehaas/hexfiles
stdlib: Add Intel HEX support to InstallRawStep
2021-09-07 15:12:00 -04:00
Martin Wickham
3d5ff91441
Fix libc file to check against compilation target instead of native (#9670) 2021-09-07 15:11:28 -04:00
Jacob G-W
88e0f81eef plan9: change output executable name
Now object files have the `name.<target char>`
Executables are just `name`
Libs are `name.a`
2021-09-07 15:08:51 -04:00
Sébastien Marie
c2f585e435 openbsd: event loop: use EVFILT_TIMER instead of EVFILT_USER
OpenBSD doesn't implement EVFILT_USER filter for kqueue(2), so we couldn't use that for event loop.

instead, use a EVFILT_TIMER filter with EV_ONESHOT (trigger only once) and delay 0sec (which trigger immediatly).
it fits the usage of EVFILT_USER which is only used to "wakeup" the kevent(2) call from userland.
2021-09-07 14:59:33 -04:00
Andrew Kelley
f1126e854c
Merge pull request #9695 from g-w1/evloop-usingns
std: update event loop for recent usingnamespace changes
2021-09-07 14:58:25 -04:00
Andrew Kelley
a48e5af69d
Merge pull request #9684 from FnControlOption/astgen-string-table
AstGen: use string index as key for string table
2021-09-07 14:52:45 -04:00
Jonathan Marler
fd2c1d8605
Fix building aarch64-windows-gnu by adding missing libc files and compiler_rt functions (#9555)
* fix issue 9519

Added some missing files from mingw

* add missing compiler_rt functions

* finish PR

* add aarch64-windows-gnu to test targets

* add more compiler_rt

* add log2

* add pow

* add modti3
2021-09-07 19:44:21 +03:00
Andrew Kelley
16c3cd3d19 langref: update link to 0.8.1 docs 2021-09-07 01:14:08 -07:00
Jacob G-W
107e3ba3cd add standalone test for issue #9693 2021-09-06 15:16:30 -04:00
Jacob G-W
738395f9bc std: update event loop for recent usingnamespace changes 2021-09-06 15:16:29 -04:00
Takeshi Yoneda
34671b1d19 stdlib: fix ChildProcess.killPosix
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2021-09-06 20:10:42 +03:00
Alex Rønne Petersen
eb5e4ac495 link: Recognize -z origin|noexecstack|now|relro linker args. 2021-09-04 12:18:38 +03:00
FnControlOption
5672ee4ed7 AstGen: use string index as key for string table 2021-09-03 06:55:38 -07:00
FnControlOption
fdf1918b39 std.hash_map: add StringIndexAdapter and StringIndexContext 2021-09-03 06:50:27 -07:00
Andrew Kelley
594271f8db
Merge pull request #9618 from ziglang/std-os-reorg
std.os reorganization; new `usingnamespace` semantics
2021-09-02 04:51:42 -04:00
Andrew Kelley
2264fca03e fix regression on linux with kernel_timespec
I incorrectly assumed that __kernel_timespec was used when not linking
libc, however that is not the case. `std.os.timespec` is used both for
libc and non-libc cases. `__kernel_timespec` is a special struct that is
used only for io_uring.
2021-09-01 17:54:07 -07:00
Andrew Kelley
21171fd71b AstGen: update std.zig.{ast,Ast}
This fixes a merge conflict when rebasing against master branch.
2021-09-01 17:54:07 -07:00
Evan Haas
bbf4c25e2d translate-c: rename import_builtin to import_c_builtin 2021-09-01 17:54:07 -07:00
Evan Haas
c0e84e3ee0 translate-c: translate valueless macros as empty strings 2021-09-01 17:54:07 -07:00
Andrew Kelley
0932b0d9b3 std.os reorg: regression fixes to stack_t, and std.Thread 2021-09-01 17:54:07 -07:00
Andrew Kelley
1a492d5156 re-apply a commit dropped in this branch due to conflicts
This commit reapplies 4f0aa7d639e099b18df583cb984412037fbb1dbe.
2021-09-01 17:54:07 -07:00
Andrew Kelley
5a4cc24c0e std: dirent is not part of posix 2021-09-01 17:54:07 -07:00
Andrew Kelley
f8dd4b13d6 std.os reorg: more fixes caught by CI 2021-09-01 17:54:07 -07:00
Andrew Kelley
057f0fec33 std.os fixes to get the test suite passing again 2021-09-01 17:54:07 -07:00
Andrew Kelley
feec4b0614 langref: new usingnamespace semantics 2021-09-01 17:54:07 -07:00
Andrew Kelley
f4d3d29f92 docgen: syntax blocks don't actually run the code 2021-09-01 17:54:07 -07:00
Evan Haas
f5553bfefc translate-c: Only consider public decls in isBuiltinDefined 2021-09-01 17:54:07 -07:00
Evan Haas
df589eecd6 translate-c: improve handling of undefined identifiers 2021-09-01 17:54:07 -07:00