11963 Commits

Author SHA1 Message Date
Alex Cameron
ca282184ae Implement parsing for multi-arg Clang options. 2020-12-23 15:03:11 +02:00
g-w1
51a904677c
update depreciated code (#7502)
* `zig env`:

* fix depreciated interface, update outStream -> writer
* make code more readable by updating `anytype` -> `std.fs.File.Writer`
2020-12-23 13:01:29 +02:00
xackus
4128eea00c std.c: add fmemopen 2020-12-23 12:58:21 +02:00
Veikka Tuominen
ce7dcf2294
Merge pull request #7507 from joachimschmidt557/stage2-arm
stage2 ARM: implement basic binary bitwise operations
2020-12-23 12:17:40 +02:00
daurnimator
53a8e73205
Add sincosf function (#7267)
* Add sincosf function

* also add sincos

Co-authored-by: Veikka Tuominen <git@vexu.eu>
2020-12-23 11:18:15 +02:00
Andreas Linz
7e63f7ad03
Truncate user and group ids for 64 bit Linux systems (#7466)
* Truncate user and group ids

Calls to `getuid`, `getgid` and their `eid` variants fail to compile on
64bit Linux systems because the return value of the syscall is of
`usize` and needs to be truncated to fit the size of `uid_t` that is 32
bit.

Thanks to @FireFox317 for figuring this out in Zig's Discord channel!

* Add a regression test for user and group ids

* Replace @truncate with @intCast

This should be safe because `uid_t` will be 32-bit.

* Add missing import for getauxval

* Add missing package names

* Revert "Add missing import for getauxval"

This reverts commit 38f93dc89effdf657f2b81a56b96527ce4083f52.

* Skip user and group test if builtin.link_libc
2020-12-23 11:16:27 +02:00
Sébastien Marie
4420dabdf5 openbsd: fix siginfo_t struct definition
`_proc` struct part contains an union for kill/cld parts.

see [siginfo_t](77c6c13150/sys/sys/siginfo.h (L132))
2020-12-23 11:08:55 +02:00
Alex Cameron
60020fd545 Enable segfault handling on FreeBSD. 2020-12-23 11:02:05 +02:00
Matt Sicker
d9fe7ea815 Fix Gimli hash on 16n byte inputs 2020-12-23 10:59:14 +02:00
Matthew Knight
55b998c98d
Add c_longdouble mapping for bpf (#7504) 2020-12-23 01:33:43 +02:00
tgschultz
ab6183e119 Added std.io.counting_reader 2020-12-23 01:27:12 +02:00
g-w1
cb3198af2a
stage2: @TypeOf (#7475)
* stage2: add @TypeOf

* stage2: discriminate on what type of @builtinCall in nodeMayNeedMemoryLocation

* merge upstream into my stash

* add type equality to make easier to test and defer free the types

* remove addDeclErr, I dont know why I added it, its from a different branch that im working on

* add tests

* update error message to match stage1

* use ComptimeStringMap and update which nodes don't need memory from vexu's suggestions

* fix typo

Co-authored-by: Veikka Tuominen <git@vexu.eu>

* make @TypeOf(single_arg) go to .typeof zir inst and add test for that

* unioninit, as, reduce change mayneedmemorylocation

Co-authored-by: Veikka Tuominen <git@vexu.eu>
2020-12-23 01:26:36 +02:00
g-w1
ea18f894f5
Peer type resolution with unsigned ints and larger signed ints 2020-12-23 00:05:42 +02:00
Veikka Tuominen
03113d9246
Merge pull request #7111 from tetsuo-cpp/emit-h
Implement emit-h
2020-12-23 00:01:22 +02:00
Veikka Tuominen
ba2f2e1393
Merge pull request #7476 from ifreund/pkgs
stage2: free Package resources, print package path on --pkg-begin failure
2020-12-23 00:00:37 +02:00
Evan Haas
ccdb81fb31 Improve handling of C compiler intrinsics in translate-c
C compiler intrinsics can only appear as part of a function call. When called
they are implicitly cast to a function pointer; treat this as a non-null
pointer so that it emits as a regular Zig function call.

Put `pub usingnamespace @import("std").c.builtins;` at the top of translated
C files so that they will have access to builtin functions defined there.

Fixes #6707
2020-12-22 23:59:30 +02:00
luna
6a75cfd0f6
cast sendto to SendError inside send (#7481)
* cast sendto to SendError inside send

* remove WouldBlock from SendToError

* add missing ENOTCONN mapping

* remove SystemResources duplicate

* move NetworkUnreachable to SendError

* add NetworkSubsystemFailed to SendError

* Use zig's implicit error set casting

Co-authored-by: Andrew Kelley <andrew@ziglang.org>
2020-12-22 16:47:11 -05:00
Alex Cameron
9849e894d5 Add emit_h path to compilation hash. 2020-12-23 01:14:35 +11:00
Alex Cameron
0771aac48b Don't use emit-h in test cases for other backends. 2020-12-23 01:14:35 +11:00
Alex Cameron
e834d0369a Make sure emit-h is off by default. 2020-12-23 01:14:35 +11:00
Alex Cameron
58bd6c5f8e Add tests for emit-h functionality. 2020-12-23 01:14:35 +11:00
Noam Preil
8d6066e09c Fix a dumb 2020-12-23 01:14:35 +11:00
Noam Preil
8538053940 Add header test harness 2020-12-23 01:14:35 +11:00
Noam Preil
ac33b10b5e CBE: Improve formatting 2020-12-23 01:14:35 +11:00
Noam Preil
37438dd789 CBE: add support for bool,u32 2020-12-23 01:14:35 +11:00
Noam Preil
15a148db01 Fix memory leak 2020-12-23 01:14:35 +11:00
Alex Cameron
c87da2f45a Remove redundant emit_h member in Compilation struct. 2020-12-23 01:14:35 +11:00
Alex Cameron
aba273d731 Enable emit-h by default for obj and lib compilation. 2020-12-23 01:14:35 +11:00
Alex Cameron
40f0275e7c Implement emit-h 2020-12-23 01:14:35 +11:00
Jakub Konka
43dbe86226
Merge pull request #7516 from kubkon/macho-better-space-alloc
macho: space preallocation, and various cleanups and fixes
2020-12-22 14:23:55 +01:00
Jakub Konka
34663abc90 macho: pad out LINKEDIT upto specified filesize 2020-12-22 10:57:58 +01:00
Jakub Konka
f106a46fd2 macho: enable binding and lazy binding info writes 2020-12-21 23:16:00 +01:00
Jakub Konka
3f21f9155f macho: write only bits that changed
Refactor use of `log` to not include an additional newline char.
2020-12-21 19:59:40 +01:00
joachimschmidt557
45a88be573
stage2 ARM: add test cases for binary bitwise operations 2020-12-21 19:24:23 +01:00
joachimschmidt557
82236a5029
stage2 ARM: implement basic binary bitwise operations 2020-12-21 19:24:21 +01:00
Jakub Konka
de5421a0a6 macho: deduplicate symbol table relocation codepath 2020-12-21 18:31:26 +01:00
Jakub Konka
a1b3606f0e macho: dynamically preallocate space for LINKEDIT sections as well 2020-12-21 17:03:55 +01:00
Vexu
286077fec8 stage1: add missing error check on inferred struct field ptr 2020-12-21 12:40:51 +02:00
Andrew Kelley
4918605176
Merge pull request #7462 from ziglang/parallel-c-objects
Introduce a ThreadPool and parallel execution of some of the compilation work items
2020-12-20 21:19:05 -05:00
Andrew Kelley
1d94a68936 add an option to compile zig in single-threaded mode
And enable it for Drone CI. I hate to do this, but I need to make
progress on other fronts.
2020-12-20 15:37:58 -07:00
Andrew Kelley
10d30838d1 update WaitGroup to yet another version 2020-12-20 15:08:59 -07:00
Andrew Kelley
fbcffe9d5d std.Progress: fix atomic ordering semantics
thx king protty
2020-12-20 15:08:59 -07:00
Andrew Kelley
4e621d4260 workaround for std lib AutoResetEvent bug 2020-12-20 15:08:59 -07:00
Andrew Kelley
e00b6db2aa update stage2 test harness to new std.Progress API 2020-12-20 15:08:59 -07:00
Andrew Kelley
aa6ef10cc6 std.Progress: make the API thread-safe
We generally get away with atomic primitives, however a lock is required
around the refresh function since it traverses the Node graph, and we
need to be sure no references to Nodes remain after end() is called.
2020-12-20 15:08:59 -07:00
Andrew Kelley
b2f8631a3c ThreadPool: delete dead code
If this errdefer did get run it would constitute a race condition. So I
deleted the dead code for clarity.
2020-12-20 15:08:59 -07:00
Andrew Kelley
32fd637e57 stage2: replace WaitGroup with a trivially auditable one 2020-12-20 15:08:59 -07:00
Andrew Kelley
0d1cd0d482 use kprotty's ThreadPool implementation (v5) 2020-12-20 15:08:59 -07:00
Andrew Kelley
01d33855c7 stage2: protect mutable state from data races in updateCObject 2020-12-20 15:08:59 -07:00
Andrew Kelley
4964bb3282 std: move serialization to the std lib orphanage
std-lib-orphanage commit 633792839f6f838fa864cde6af015413ee713404
2020-12-20 15:08:06 -07:00