Commit Graph

710 Commits

Author SHA1 Message Date
Andrew Kelley 1d06c82c3b Merge pull request #4516 from xackus/remove-bytes-to-slice
remove @bytesToSlice, @sliceToBytes from the language
2020-02-24 13:51:47 -05:00
xackus 7664c3bc11 remove @bytesToSlice, @sliceToBytes from tests, docs 2020-02-23 18:03:50 +01:00
Andrew Kelley 2de7d0b10c fix zig build, ABI ABI, and update tests to new Target layout 2020-02-20 18:50:20 -05:00
Andrew Kelley 903127f36c Merge remote-tracking branch 'origin/master' into sub-architecture-annihilation 2020-02-20 18:36:04 -05:00
Andrew Kelley 0f016b368d support -mcpu=baseline, both in stage1 and stage2
See e381a42de9 for more details.
This is set up so that if we wish to make "baseline" depend on the
OS in the future, it is possible to do that.
2020-02-20 18:31:17 -05:00
LemonBoy a385547786 ir: Compile error on result_loc type mismatch w/ slicing
Closes #4508
2020-02-20 13:14:19 +01:00
Andrew Kelley 63383a8af8 consistent capitalization of error message 2020-02-19 01:24:19 -05:00
Andrew Kelley 30194f27fb update new test case to take into account lazy @typeInfo 2020-02-18 18:27:18 -05:00
LemonBoy a6b74cdd38 stage1: Make the parser reject extern fn with body 2020-02-18 18:18:29 -05:00
Andrew Kelley ccca4b5a5e Merge pull request #4474 from LemonBoy/saukerkraut
Patches
2020-02-18 18:15:11 -05:00
Timon Kruiper 7560fc716d Makes the declaration slice resolve lazely when using @typeInfo
This way all the declarations in a container won't be resolved untill
the user actually uses the decls slice in the builtin TypeInfo union.
2020-02-18 15:26:37 -05:00
LemonBoy 6b74fd2e12 ir: Avoid invalidating the decl_table iterator
Collect the declarations to resolve first and run resolve_top_level_decl
on them later.

Closes #4310
2020-02-16 21:14:30 +01:00
LemonBoy 096f79260b ir: Prevent crash when indexing undefined ptr to array
Closes #4471
2020-02-16 19:53:53 +01:00
Andrew Kelley 70a4794c57 fix compiler assertion when duplicating fields...
...in nested anonymous struct literals

closes #4391
2020-02-10 10:57:40 -05:00
Andrew Kelley 014f66e6de Merge pull request #4404 from ziglang/async-std
a big step towards std lib integration with async I/O
2020-02-10 00:22:59 -05:00
Andrew Kelley 27575d19c8 avoid conflict with master branch 2020-02-09 22:44:23 -05:00
Andrew Kelley acdf4048b4 allow local variable address detection to regress
See #3180 for a more comprehensive plan to catch this problem. More
sophisticated control flow analysis is needed to provide compile errors
for returning local variable addresses from a function.
2020-02-09 22:40:36 -05:00
Andrew Kelley 5ea79bfc4a fix not checking type of return pointer
Thanks to Vexu for the test cases.

Closes #3422
Closes #3646
Closes #3224
Closes #3327
Closes #3269
2020-02-09 22:34:34 -05:00
LemonBoy 21932a0ef2 Fix edge case in cast between fn with varargs
* Prevent the next_param_index to become greater than the param_count
  one as it's expected by every other function.
* Fix a typo in a error message.

Closes #4381
2020-02-05 20:31:18 +01:00
Benjamin Feng b077f3ab7d Promoted "leak_count_allocator" to the main testing.allocator 2020-01-29 22:22:00 -06:00
Benjamin Feng aa9caf5064 Create leak_count_allocator 2020-01-29 14:37:01 -06:00
Benjamin Feng 4d134a01f5 Move debug.global_allocator to testing.allocator 2020-01-29 12:21:29 -06:00
Andrew Kelley 504ce86ac9 fix more compile error test regressions 2020-01-28 14:17:25 -05:00
Andrew Kelley f41e50dc08 Merge branch 'fx-4274' of https://github.com/LemonBoy/zig into LemonBoy-fix-4274 2020-01-27 09:52:31 -05:00
LemonBoy 8d9b8ab930 More error checking for unresolved TLDs
Closes #4274
2020-01-23 22:40:12 +01:00
Andrew Kelley 48c7e6c48b std.Target.CpuFeatures is now a struct with both CPU and feature set
Previously it was a tagged union which was one of:
 * baseline
 * a specific CPU
 * a set of features

Now, it's possible to have a CPU but also modify the CPU's feature set
on top of that. This is closer to what LLVM does.

This is more correct because Zig's notion of CPUs (and LLVM's) is not
exact CPU models. For example "skylake" is not one very specific model;
there are several different pieces of hardware that match "skylake" that
have different feature sets enabled.
2020-01-22 17:13:31 -05:00
Vexu 6c8f01dcde correct field count 2020-01-16 22:52:10 +02:00
Vexu 02e5cb1cd4 add non-exhaustive enum to langref 2020-01-15 23:05:52 +02:00
Vexu f3d174aa61 require size for non-exhaustive enums 2020-01-15 21:38:11 +02:00
Vexu b971c7d0ff update tests and translate-c 2020-01-15 20:58:42 +02:00
LemonBoy 49771f356f Make sure @export symbol name is not empty 2020-01-14 21:23:11 +01:00
LemonBoy 84930fec27 Validate switch range endpoints 2020-01-13 21:45:16 +01:00
LemonBoy 54b11f66a9 Fix compiler-error regression 2020-01-13 08:49:32 +01:00
LemonBoy 34cdcb13c0 Fix @call being too eager to resolve the fn argument
Closes #4020
2020-01-12 23:51:18 +01:00
LemonBoy c96131f30c Propagate errors in for loop bodies
Closes #3819
2020-01-12 12:49:12 -05:00
LemonBoy 5ab5de89c0 New @export() handling
Use a struct as second parameter to be future proof (and also allows to
specify default values for the parameters)

Closes #2679 as it was just a matter of a few lines of code.
2020-01-09 13:43:06 -05:00
LemonBoy 3607d9ee68 Fix crash in struct initializer evaluation
Closes #4100
2020-01-07 15:06:22 -05:00
Andrew Kelley 8492c46ade add test case for already fixed bug
closes #2655
2020-01-06 23:03:07 -05:00
LemonBoy 8c640b3e60 Prevent bitCast to enum types
Stop the user from creating invalid enum values.
2020-01-06 19:36:17 -05:00
Andrew Kelley be2483c576 fix test suite regressions 2020-01-06 18:20:31 -05:00
Andrew Kelley 53913acaf7 zig fmt and update extern fn to callconv(.C) 2020-01-06 15:34:50 -05:00
LemonBoy 563d9ebfe5 Implement the callconv() annotation 2020-01-02 18:53:16 +01:00
Andrew Kelley 73e535e112 Merge pull request #3683 from Vexu/atomic-float
Support floats with some atomic operations
2019-12-30 19:19:05 -05:00
Andrew Kelley a05150e92d fix comparing comptime_int against undefined literal
closes #4004
2019-12-30 19:08:57 -05:00
LemonBoy c1ee846c22 Fix ptrCast of zero-sized type
Closes #2431
2019-12-30 17:43:58 -05:00
Vexu ab7fc33c83 add zig llvm wrapper for atomicrmw 2019-12-23 11:55:00 +02:00
Vexu 8bb1e04449 support some atomic operations with floats 2019-12-23 11:54:47 +02:00
Andrew Kelley 26f3c2d061 fix std.mem.addNullByte and implement sentinel slicing
see #3770
2019-12-20 18:28:56 -05:00
Andrew Kelley 9468d63819 allow comparison of any numeric types 2019-12-16 11:09:10 -05:00
Vexu 0f38410ea6 improve extern enum 2019-12-15 19:28:53 -05:00