Commit Graph

12877 Commits

Author SHA1 Message Date
Nathan Michaels 33b5dbb82c Document std.Mutex.
Not sure what the build platform is for the generated documentation,
and it's worth thinking about how best to deal with this pattern. It
might be worth figuring out how to rewrite this to have a single
definition of the public API with the implementation chosen at compile
time.
2019-12-19 23:42:27 -05:00
Vexu d172a7335c translate-c-2 copy parametrs to stack 2019-12-20 00:12:08 +02:00
Vexu 61482be153 translate-c-2 improve macro fn ptr caller 2019-12-19 20:58:48 +02:00
Vexu f837c7c9cd translate-c-2 compound assign 2019-12-19 16:13:28 +02:00
Vexu 62bfff5e87 translate-c-2 fix expression grouping bugs 2019-12-18 13:32:19 +02:00
Vexu 21bc3353b8 translate-c-2 character literals and more test fixes 2019-12-18 01:04:01 +02:00
kprotty c912296443 SpinLock: loopHint & yield distinction 2019-12-17 15:38:00 -06:00
kprotty 26e08d5701 ResetEvent: use futex on linux when possible 2019-12-17 15:38:00 -06:00
kprotty ac5ba27c2b Mutex: fix lock/spin bugs, improve perf slightly & more specialization 2019-12-17 15:38:00 -06:00
kprotty e67ce444e7 ResetEvent: simpler interface + fix tests 2019-12-17 15:38:00 -06:00
kprotty 947db78622 Spinlock: remove Backoff & improve yielding 2019-12-17 15:38:00 -06:00
Raul Leal 62c817420d [#3844 + #3767] update std.c and std.os.linux to use null-terminated pointer types (#3900)
* #3844 update std.c functions to use null-terminated pointer types

* check linux functions

* fix callsites

* fix io test

* Add allocPrintCstr function to remove other cast
2019-12-17 15:43:49 -05:00
Andrew Kelley b1abe4a172 Revert "added -- to pass args to zig build commands"
This reverts commit d4e56ae6ae.

This broke the build
2019-12-16 16:36:42 -05:00
Dmitry Atamanov 744133acb1 Fixes utf8ToUtf16Le (#3923) 2019-12-16 16:27:26 -05:00
emekoi d4e56ae6ae added -- to pass args to zig build commands 2019-12-16 16:24:54 -05:00
Andrew Kelley 13cdc137e6 Merge pull request #3570 from ziglang/c-sanitize-undef
use -fsanitize=undefined for C code in safe build modes
2019-12-16 16:17:52 -05:00
Andrew Kelley 839b3a61ad expose the ability to disable C sanitization
and disable C sanitization when building libcs.
Empirically, they seem to trigger undef-sanitization.
2019-12-16 13:51:21 -05:00
Andrew Kelley f8cd981c04 use -fsanitize=undefined for C code in safe build modes
closes #3569
2019-12-16 13:06:02 -05:00
Henry Wu 170de5ecae generated docs: log trace instead of error
When the error occurred for getValueText it could potentially omit
useful documentation since the page stops rendering.
2019-12-16 12:40:38 -05:00
Andrew Kelley 496f271d17 Merge branch 'shawnl-lessThan'
* always allow integer comparison operations no matter the
   bit width, signedness, or comptime-ness of operands.
   closes #2133
 * implement comparisons for vectors, which returns vector of
   bools.

closes #3001
2019-12-16 11:39:13 -05:00
Andrew Kelley 9468d63819 allow comparison of any numeric types 2019-12-16 11:09:10 -05:00
Lachlan Easton fe0e8c87b7 Tokenizer: Copy optional tokens prior to being set to null #3737 (#3910)
* Tokenizer: Copy optional tokens prior to being set to null #3737

* Add TODO comments, reminder to audit copying optional pattern.
2019-12-16 11:01:02 -05:00
LemonBoy 9d9b0720f5 Fix for the error codepath in ChildProcess 2019-12-16 10:57:29 +01:00
LemonBoy c257f892fd Revert "Revert "Use eventfd in ChildProcess on Linux""
This reverts commit 2c7a2aefbf.
2019-12-16 10:56:53 +01:00
Shawn Landden 143603b39f std: lessThan and greaterThan between signed and unsigned
It is a deviation from C, but I think we should consider making this the behavior
of the operators. See #2133
2019-12-16 01:41:26 -05:00
Andrew Kelley 2c7a2aefbf Revert "Use eventfd in ChildProcess on Linux"
This reverts commit b169f7b0d5.

This caused `integer cast truncated bits` at
std/child_process.zig:801:12

Can be reproduced on my machine simply by running `make`.
2019-12-16 01:39:41 -05:00
LemonBoy b169f7b0d5 Use eventfd in ChildProcess on Linux
Closes #819
2019-12-15 14:43:37 -05:00
LemonBoy 19ddbd9e9e Make sure the address is aligned for intToPtr ops
Closes #773
2019-12-15 14:41:05 -05:00
Vexu e57e3602e7 translate-c-2 implement enums 2019-12-14 23:24:47 +02:00
Vexu 1a967db083 add default initializers to all ast.Node base values 2019-12-14 20:40:56 +02:00
Vexu 1f84586836 translate-c-2 avoid collisions with zig keywords 2019-12-14 17:00:10 +02:00
Vexu 4dae70e702 translate-c-2 container aliases 2019-12-14 13:40:33 +02:00
Vexu e4ca1f441b translate-c-2 record type 2019-12-14 02:00:01 +02:00
Andrew Kelley fff3c1fff4 un-special-case startup code in the std lib
Previously, the compiler had special logic to determine whether to
include the startup code, which was in `std/special/start.zig`. Now,
the file is moved to `std/start.zig`, and there is no special logic
in the compiler. Instead, the standard library unconditionally imports
the `start.zig` file, which then has a `comptime` block that does the
logic of determining what, if any, start symbols to export. Instead of
`start.zig` being in its own special package, it is just another normal
file that is part of the standard library.

`std.builtin.TestFn` is now part of the standard library rather than
specially generated by the compiler.
2019-12-12 18:33:44 -05:00
Christine Dodrill b37acc4d68 allow custom OS entrypoint
Also:

 * Expose `std.start.callMain`.
 * Other fixes added to fix issues found in development.
2019-12-12 16:00:23 -05:00
Andrew Kelley d08dc21116 Merge pull request #3886 from kavika13/master
Add function params, parens handling, and some infix operators to self-hosted translate-c
2019-12-11 18:40:35 -05:00
Christine Dodrill b375f6e027 lib/std/io: let the bring-your-own OS package handle stdio (#3887) 2019-12-11 18:37:52 -05:00
Merlyn Morgan-Graham 5e8186a8ce Fix access of undefined field when calling ast.Tree.dump 2019-12-10 23:52:40 -08:00
Andrew Kelley 7c1dbfab72 self-hosted: manually parse args 2019-12-11 02:08:33 -05:00
Andrew Kelley c3d8b1ffeb remove iterator API from std.ArrayList
This is not a meaningful abstraction. Use a for loop on the result
of `toSlice` or `toSliceConst`.

An iterator can be implemented on top of ArrayList by applications which
want additional functionality, such as removing elements while
iterating.

Closes #3037.
2019-12-10 15:08:10 -05:00
frmdstryr f30af12bea Add hotpath for BufferedOutStream (#3858)
* Add hotpath for BufferedOutStream
2019-12-10 13:44:59 -05:00
Heppokoyuki 5ada11449a fix con_in difinition and add EFI_SIMPLE_TEXT_INPUT_PROTOCOL difinition 2019-12-10 13:25:28 -05:00
Andrew Kelley fdc3132126 fix windows dynamic lib loading test 2019-12-10 13:21:37 -05:00
Andrew Kelley 3ef8460d06 fix load dynamic library API when linking libc 2019-12-10 12:56:05 -05:00
Andrew Kelley 80882bda59 load dynamic library test: update API usage code 2019-12-10 12:48:10 -05:00
Andrew Kelley fd6b7b160d improve dynamic library API 2019-12-10 12:28:28 -05:00
emekoi 29fd727b79 fixed windows dynamic library loading and added loading for darwin 2019-12-10 11:41:54 -05:00
Robin Voetter 8c096707b7 Additional replacements of @typeOf with @TypeOf 2019-12-10 11:09:41 -05:00
Robin Voetter 4b4fbe3887 Replace @typeOf with @TypeOf in all zig source
This change was mostly made with `zig fmt` and this also modified some whitespace. Note that in some files, `zig fmt` produced incorrect code, so the change was made manually.
2019-12-10 11:09:41 -05:00
Robin Voetter d568db2386 Remove misplaced dot 2019-12-10 11:09:29 -05:00