Commit Graph

1090 Commits (58c5f94a99a78346286065bbf390e4c30be1b707)

Author SHA1 Message Date
Andrew Kelley f5a67dba08 self-hosted: implicit cast comptime ints to other ints
we now have successful exit codes from main linking
against libc
2018-07-20 01:46:49 -04:00
Andrew Kelley bd1c55d2c2 self-hosted: compile errors for return in wrong place
* outside fn definition
 * inside defer expression
2018-07-18 17:43:36 -04:00
Jimmi Holst Christensen fd3a41dadc Allow pointers to anything in extern/exported declarations (#1258)
* type_allowed_in_extern accepts all ptr not size 0

* Generate correct headers for none extern structs/unions/enums
2018-07-18 11:00:42 -04:00
Jimmi HC b7be082bd9 -Dskip-release now also skips build example tests 2018-07-18 10:28:14 +02:00
Andrew Kelley cbfe9a4077 fix @setEvalBranchQuota not respected in generic fn calls
closes #1257
2018-07-17 23:37:17 -04:00
Andrew Kelley 0fa24b6b75 allow implicit cast of undefined to optional 2018-07-16 19:26:15 -04:00
Andrew Kelley e9a03cccf3 all integer sizes are available as primitives
* fix wrong implicit cast for `@IntType` bit_count parameter.
 * fix incorrect docs for `@IntType` bit_count parameter.

closes #1242
closes #745
closes #1240
2018-07-16 10:53:15 -04:00
Andrew Kelley f78d4ed30c add an assertion to the test 2018-07-14 11:33:01 -04:00
Eduardo Sánchez Muñoz 722b9b9e59 codegen: Store returned value if type is 'handle_is_ptr' and function is not 'first_arg_ret'.
Seems to fix #1230, includes test.
2018-07-14 11:33:01 -04:00
Andrew Kelley 5354d1f5fc allow == for comparing optional pointers
closes #658
2018-07-13 12:34:42 -04:00
Andrew Kelley 9751a0ae04 std.atomic: use spinlocks
the lock-free data structures all had ABA problems and
std.atomic.Stack had a possibility to load an unmapped memory address.
2018-07-11 19:38:01 -04:00
Andrew Kelley 9bdcd2a495 add std.event.Future
This is like a promise, but it's for multiple getters, and
uses an event loop.
2018-07-11 16:00:06 -04:00
Andrew Kelley 5954c94d20 build system: add -Dskip-release option to test faster 2018-07-11 14:09:05 -04:00
Andrew Kelley 3f30897fdc add compile error for disallowed types in extern structs
closes #1218
2018-07-11 14:08:56 -04:00
Andrew Kelley 28f9230b40 fix crash when calling comptime-known undefined function ptr
closes #880
closes #1212
2018-07-10 10:12:08 -04:00
Andrew Kelley 2ee67b7642 langref: docs for invalid error set cast and incorrect pointer alignment
also add detection of incorrect pointer alignment at compile-time
of pointers that were constructed with `@intToPtr`.
2018-07-09 11:13:29 -04:00
Andrew Kelley 9eb51e20ed fix crash on @ptrToInt of a *void
closes #1192
2018-07-09 10:44:06 -04:00
Andrew Kelley d8295c1889 add @popCount intrinsic 2018-07-07 00:25:32 -04:00
Andrew Kelley 4ad4cd2654 fix iterating over a void slice
closes #1203
2018-07-06 17:27:44 -04:00
Andrew Kelley 1cf7511dc9 add compile error notes for where struct definitions are
closes #1202
2018-07-06 16:20:46 -04:00
Isaac Hier 9cff23dbf9 Fix assertion crash on enum switch values 2018-07-04 13:27:10 -04:00
Isaac Hier 9395162a7c Debug enum issue 2018-07-04 12:47:35 -04:00
Andrew Kelley 8c39cdc89f fix await on early return when return type is struct
previously, await on an early return would try to access the
destroyed coroutine frame; now it copies the result into a
temporary variable before destroying the coroutine frame
2018-07-04 11:51:02 -04:00
Andrew Kelley 35463526cc add runtime safety for `@intToEnum`; add docs for runtime safety
See #367
2018-07-02 15:50:28 -04:00
Andrew Kelley 4c0e280d6d
Merge pull request #1185 from ziglang/undefined-at-comptime-improvements
Operators now throw a compiler error when operating on undefined values
2018-07-01 01:33:23 -04:00
Jimmi Holst Christensen b182151de5 Fixed line numbers for tests 2018-06-30 21:59:14 +02:00
Jimmi Holst Christensen ecd5e60be9 Expanded the list of operators that catch undefined values at comptime 2018-06-30 20:50:09 +02:00
Jimmi Holst Christensen 42033ea3ca
Merge pull request #1167 from ziglang/comptime-array-by-value
Implement const_values_equal for arrays
2018-06-30 18:58:31 +02:00
Jimmi Holst Christensen 01bd5c46e1 Revert "ir_resolve_const now checks recursivly for undef values"
This reverts commit 4c3f27ce1e.
2018-06-30 17:35:06 +02:00
isaachier f1c56f7f22 Clarify reason implicit cast does not work for large RHS (#1168)
* Clarify reason implicit cast does not work for large RHS
2018-06-29 14:52:25 -04:00
Jimmi HC 4c3f27ce1e ir_resolve_const now checks recursivly for undef values 2018-06-29 10:21:43 +02:00
Jimmi HC 3ec38b2494 Implement const_values_equal for array type
* This allows arrays to be passed by value at comptime
2018-06-28 10:34:37 +02:00
Marc Tiehuis 4a35d7eeeb Correct hex-float parsing
Unblocks #495.
2018-06-28 20:12:03 +12:00
Andrew Kelley 2fa588e81d fix coroutine accessing freed memory
closes #1164
2018-06-27 18:45:21 -04:00
Andrew Kelley 19961c50e4 fix comptime @tagName crashing sometimes
closes #1118
2018-06-27 13:15:55 -04:00
Ben Noordhuis 440c1d52b4 simplify comptime floating-point @divTrunc
Replace a conditional ceil/floor call with an unconditional trunc call.
2018-06-27 16:20:04 +02:00
Ben Noordhuis fd75e73ee9 add f16 type
Add support for half-precision floating point operations.

Introduce `__extendhfsf2` and `__truncsfhf2` in std/special/compiler_rt.

Add `__gnu_h2f_ieee` and `__gnu_f2h_ieee` as aliases that are used in
Windows builds.

The logic in std/special/compiler_rt/extendXfYf2.zig has been reworked
and can now operate on 16 bits floating point types.

`extendXfYf2()` and `truncXfYf2()` are marked `inline` to work around
a not entirely understood stack alignment issue on Windows when calling
the f16 versions of the builtins.

closes #1122
2018-06-27 16:20:04 +02:00
Ben Noordhuis 0ebc7b66e6 scope variables in floating point cast tests
Fixes a bug where the result of a @floatCast wasn't actually checked; it
was checking the result from the previous @floatCast.
2018-06-27 16:20:04 +02:00
Andrew Kelley 11ca38a4e9 fix crash for optional pointer to empty struct
closes #1153
2018-06-26 15:27:41 -04:00
Andrew Kelley 8866bef92c clean up self hosted main. delete unsupported commands 2018-06-22 01:54:38 -04:00
Andrew Kelley 459d72f873 fix compiler crash for invalid enum
closes #1079
closes #1147
2018-06-21 17:41:49 -04:00
Andrew Kelley 5f38d6e2e9 add casting docs, __extenddftf2, and __extendsftf2 2018-06-21 14:44:35 -04:00
Isaac Hier f1207a8e74 Add test case 2018-06-21 08:32:05 -04:00
Ben Noordhuis eb6a8e6a3b fix f128 remainder division bug
The modulo operation computed rem(b+rem(a,b), b) which produces -1
for a=1 and b=2.

Switch to a - b * trunc(a/b) which produces the expected result, 1.

closes #1137
2018-06-20 17:37:38 -04:00
Andrew Kelley e891f9cd9d zig fmt 2018-06-20 17:16:27 -04:00
kristopher tate 71db8df548 std: update stdlib to match updated allocator create signature; ref #733 2018-06-21 00:40:21 +09:00
Andrew Kelley 55193cb13b fix runtime fn ptr equality codegen
closes #1140
2018-06-20 06:46:53 -04:00
Andrew Kelley 7c99c30bf4 fix calling method with comptime pass-by-non-copyign-value self arg
closes #1124
2018-06-19 19:35:59 -04:00
Andrew Kelley 42db807f37 remove redundant implicit casting code
and introduce better type mismatch errors

closes #1061
2018-06-19 18:51:46 -04:00
Andrew Kelley c7804277bf `@floatToInt` now has safety-checked undefined behavior
when the integer part does not fit in the destination integer type

 * Also fix incorrect safety triggered for integer casting an
   `i32` to a `u7`. closes #1138
 * adds compiler-rt function: `__floatuntidf`
2018-06-19 16:06:10 -04:00