Commit Graph

4135 Commits

Author SHA1 Message Date
Andrew Kelley 609207801a make "gnu" (mingw-w64) the default C ABI on Windows
Closes #6565
2021-05-24 00:13:54 -04:00
Andrew Kelley 8fa6ca6daa Merge pull request #8879 from squeek502/dot-and-dotdot-test
Add . and .. tests for std.fs functions
2021-05-23 23:26:05 -04:00
Ryan Liptak 78019452f7 Add updateFile to . and .. fs tests 2021-05-23 16:35:31 -07:00
Ryan Liptak 1bc0df7250 Add . and .. tests for std.fs functions
These tests check that . and .. are able to be handled by the std.fs functions. Before #7664, these tests would have failed on Windows.

Closes #4659
2021-05-23 16:22:27 -07:00
Michael Dusan 0f26120377 overhaul elf csu (c-runtime startup) logic
- more support for linux, android, freebsd, netbsd, openbsd, dragonfly
- centralize musl utils; musl logic is no longer intertwined with csu
- fix musl compilation to build crti/crtn for full archs list
- fix openbsd to support `zig build-lib -dynamic`
- initial dragonfly linking success (with a warning)

ancillary:

- fix emutls (openbsd) tests to use `try`
2021-05-23 15:38:57 -04:00
Daniele Cocca 44e480aa2c translate_c: remove unused WriteFileStep import 2021-05-23 14:35:19 -04:00
Andrew Kelley 1c636e2564 Merge pull request #8844 from ifreund/inline
Support inline keyword as well as callconv(.Inline)
2021-05-22 20:56:30 -04:00
Sébastien Marie ceacb7d247 openbsd: complete kqueue(2) constant definitions 2021-05-22 20:52:44 -04:00
Sobeston 742d588b3a std.os: munmap takes a const pointer 2021-05-22 20:51:53 -04:00
Matthew Borkowski d7bf4f8070 fix Boyer-Moore-Horspool algorithm in indexOfPos and lastIndexOf when element type is larger than a byte 2021-05-22 20:51:17 -04:00
Andrew Kelley 7cd9b30e0a Merge pull request #7664 from marler8997/fixWindowsPaths
implement nt path conversion for windows
2021-05-22 17:58:59 -04:00
Jakub Konka 9d311e9960 Merge pull request #8857 from ziglang/cc-wasm-ar
wasm: produce static lib by default and rename produced object files to simply .o from .o.wasm
2021-05-22 16:13:47 +02:00
Matthew Borkowski f4101c1153 fix accidental quadratic dependence on haystack length in replace and replacementSize (#8859) 2021-05-22 10:55:28 +02:00
Jakub Konka bd325d1bd9 wasm: fix object extension to standard .o from .o.wasm
This should offer more compatibility with external tooling when
cross-compiling to wasm with zig.
2021-05-21 22:29:36 +02:00
Jonathan Marler b0116afd8a handle relative paths with too many ".." 2021-05-21 01:29:40 -06:00
Jakub Konka 4b69bd61e4 Merge pull request #8837 from ziglang/cc-wasm32-wasi
cc,wasi: ship WASI libc and autobuild it when needed
2021-05-21 09:04:16 +02:00
mason1920 884547f177 Const correct GUID parameter of getInfo and setInfo 2021-05-20 18:53:59 -04:00
Andrew Kelley 495e996169 Merge pull request #8776 from notviri/windows-wm-constants
fix & add some Win32 window message constants
2021-05-20 18:51:45 -04:00
Matthew Borkowski 510f858143 fix calculation of max_io_bits in PackedIntIo 2021-05-20 18:47:16 -04:00
Jonathan Marler 59de5d0350 add the openDir cwd parent test 2021-05-20 14:00:41 -06:00
Jonathan Marler a72ad61cd4 have collapseRepeats return slice intead of just len 2021-05-20 14:00:41 -06:00
Jonathan Marler 666584067a implement nt path conversion for windows 2021-05-20 14:00:40 -06:00
Andrew Kelley 61850f8883 std: Windows: WSASocketW ensures WSAStartup
When WSASocketW gets WSANOTINITIALISED, now it will lock a mutex to
safely call WSAStartup and then try again one time.

This implementation:
 * Does not use recursion
 * Contains a detailed doc comment explaining why things are how they are
 * Is careful about which errors are surfaced in the respective error
   sets. `std.os.socket` intentionally does not have "not initialised"
   as one of the possible errors.
2021-05-20 12:28:30 -07:00
Bxil 85c2ffc9ba std.os: WSAStartup is now called upon socket creation when needed 2021-05-20 11:22:55 -07:00
Isaac Freund 5b850d5c92 Run zig fmt on src/ and lib/std/
This replaces callconv(.Inline) with the more idiomatic inline keyword.
2021-05-20 17:14:18 +02:00
Isaac Freund 4a582734fd zig fmt: replace callconv(.Inline) with the inline keyword 2021-05-20 17:13:47 +02:00
Jakub Konka 3a5d0f7700 wasm: link dynamically by default when targeting wasm
This matches the behaviour of other languages and leaves us
the ability to create actual static Wasm archives with

```
zig build-lib -static some.zig
```

which can then be combined with other Wasm object files and linked
into either a Wasm lib or executable using `wasm-ld`.

Update langref to reflect the fact we now ship WASI libc.
2021-05-20 16:54:00 +02:00
Jakub Konka f291b8b9bc cc,wasi: remove unused headers and sources 2021-05-20 16:54:00 +02:00
Jakub Konka 6d5002028a cc,wasi: link compiled WASI libc with wasm-ld 2021-05-20 16:54:00 +02:00
Jakub Konka 60d8779eae cc,wasi: add source file paths to wasi_libc.zig 2021-05-20 16:54:00 +02:00
Jakub Konka 7b74de7d71 wasi,cc: fix naming and add stubs for building
Rename include dir to match the convention:
  from `wasm32-wasi` to `wasm-wasi-musl`

Add building stubs which will be used to build and cache WASI
libc sysroot.
2021-05-20 16:54:00 +02:00
Jakub Konka 782cfedaf6 cc,wasi: add wasi-libc source 2021-05-20 16:54:00 +02:00
Jakub Konka a901d44b4e cc,wasi: add wasi libc headers 2021-05-20 16:53:59 +02:00
LemonBoy ec9a44b2a5 std: Make atfork handler more robust
The atfork handler is executed even when fork()-ing threads that have
never initialized their local csprng. Handle this case gracefully
instead of raising a runtime error.

Fixes #8841
2021-05-20 15:28:59 +02:00
LemonBoy abfe7f96dd std: Call pthread_atfork only once
Some libc implementations (glib) deduplicate identical hooks, others
(musl, macos) do not and blindly append them to an internal list.
Ensure there's only a single call to pthread_atfork to prevent unbounded
memory use when lots of threads/forks are used.
2021-05-20 15:26:17 +02:00
Isaac Freund 3fd8ac092e stage2: support inline keyword on function decls
This is an alternative to callconv(.Inline). Using an inline keyword
as well as an explicit callconv() is a compile error.
2021-05-20 14:54:44 +02:00
LemonBoy 992c02ab95 std: Fix error in tlcsprng init sequence
The fallback case was actually switched with the success one.
2021-05-20 14:43:04 +02:00
Sébastien Marie 28a89b9ebc openbsd: convert builtin.arch to builtin.target.cpu.arch 2021-05-19 10:55:21 +02:00
Andrew Kelley 22f51f2f7d Merge pull request #8667 from sagehane/nixos
std.zig: handle -frandom-seed in NIX_CFLAGS_COMPILE
2021-05-19 03:28:12 -04:00
Andrew Kelley 8861ee18f7 std: add android __SIZEOF_PTHREAD_MUTEX_T
closes #8384
2021-05-18 21:08:41 -07:00
Andrew Kelley 667236668f build.zig: blank out "*test.zig" files instead of omit
Now that `@import` of a non-existent file name is a compile error, the
Zig installation needs to include files that end with test.zig. However
we still want to avoid bloat in the installation size, so we blank them
out instead of omitting them entirely.

Now AstGen of the full standard library can complete successfully on a
Zig installation rather than erroring out with file not found.
2021-05-18 17:18:42 -07:00
Andrew Kelley a9cd9b021b Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgen
I want the updated Drone CI stuff to get the CI green.
2021-05-18 12:37:03 -07:00
Andrew Kelley 4187008b5e std: update freebsd bits to new builtin 2021-05-18 10:49:33 -07:00
Jakub Konka 1dac5f5214 zld: parse dylibs as positionals
* add preliminary rpath support
* enable shared_library test on x86_64 macOS
2021-05-18 09:28:00 +02:00
Jakub Konka 73c015b956 zld: parse dylib id 2021-05-18 09:28:00 +02:00
Andrew Kelley 93dbf30dcf std.fmt: fix regressions from master
A previous commit from this branch incorrectly changed the usage of
`comptime` keyword, and broke the std lib tests. This commit adds
`comptime` to a few function calls, correcting the behavior.
2021-05-17 19:53:46 -07:00
Andrew Kelley 615d45da77 Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgen
Conflicts:
 * src/codegen/spirv.zig
 * src/link/SpirV.zig

We're going to want to improve the stage2 test harness to print
the source file name when a compile error occurs otherwise std lib
contributors are going to see some confusing CI failures when they cause
stage2 AstGen compile errors.
2021-05-17 19:30:38 -07:00
Andrew Kelley ab6b0ad8a4 test runner: prepare stage2 workaround
This provides a simpler test runner that exercises fewer language
features so that we can get to the point faster where `zig test` works
for stage2.
2021-05-17 16:09:20 -07:00
Andrew Kelley 83677074f9 std: update regarding std.builtin reorganization
There are also some regressed std.fmt tests here and I haven't figured
out what's wrong yet.
2021-05-17 16:08:09 -07:00
Andrew Kelley 84fdeb47a3 compiler-rt: fix usage of builtin
In this branch std.builtin and `@import("builtin")` are rearranged, fix
a trivial compile error due to the conflict with master.
2021-05-17 14:18:30 -07:00