Commit Graph

3108 Commits

Author SHA1 Message Date
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
Andrew Kelley
3f4b77f561
Merge pull request #1177 from jayschwa/fix-out-of-src-builds
Fix version detection for out-of-source builds
2018-06-30 12:01:47 -04: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
Jimmi Holst Christensen
616fe798c8 Revert "contains_comptime_undefined_value should not follow pointers"
This reverts commit 58b1692182.
2018-06-30 17:35:05 +02:00
Marc Tiehuis
887c97742f Alignment fix and allow rudimentary f128 float printing 2018-06-30 21:58:59 +12:00
Marc Tiehuis
951512f5ae compiler_rt: Add CMake entries 2018-06-30 21:58:59 +12:00
Marc Tiehuis
9f48b2ab48 compiler_rt: Remove wrapping add/sub operators where unneeded
Closes #495.
2018-06-30 21:58:59 +12:00
Marc Tiehuis
814a34f263 compiler_rt: Add floattitf/floattidf/floattisf 2018-06-30 21:58:59 +12:00
Marc Tiehuis
53fef94b9f compiler_rt: Add missing install targets 2018-06-30 21:58:59 +12:00
Marc Tiehuis
e19fc4a0a3 compiler_rt: Add missing exports 2018-06-30 21:58:59 +12:00
Marc Tiehuis
cb7bdc2da1 compiler_rt: Add floatuntitf 2018-06-30 21:58:59 +12:00
Marc Tiehuis
61ebfe6603 compiler_rt: Add floatunditf and floatunsitf 2018-06-30 21:58:59 +12:00
Marc Tiehuis
c32b2e45ef compiler_rt: Add floatuntisf 2018-06-30 21:58:59 +12:00
Marc Tiehuis
379950f81d compiler_rt: Add trunc f128 narrowing functions 2018-06-30 21:58:59 +12:00
Jay Weisskopf
25bbb1a8ff Fix version detection for out-of-source builds
Git was called in the build directory and not the source directory.
This works fine when the build directory resides within the source
repository, but doesn't work for out-of-source builds. Example:

```
~/zigbuild$ cmake ../zig
fatal: not a git repository (or any of the parent directories): .git
Configuring zig version 0.2.0+
```

Use Git's `-C <path>` flag to always point to the source directory so
that it doesn't matter where the build directory lives.
2018-06-29 22:22:04 -04:00
Andrew Kelley
a3ab4325fd
Merge pull request #1175 from bnoordhuis/zig-test-emit-switch
support --emit in 'test' command
2018-06-29 18:39:19 -04:00
Ben Noordhuis
03f66825d6 support --emit in 'test' command
Support the `--emit` switch in `zig --emit asm test file.zig`.

The command fails because no tests run (no executable is created) but
it emits the requested file.  That seems like a good tradeoff.
2018-06-29 23:32:10 +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
Andrew Kelley
0874a5ba77 std.atomic.queue - document limitation and add MPSC queue 2018-06-29 14:45:42 -04:00
Jimmi HC
58b1692182 contains_comptime_undefined_value should not follow pointers 2018-06-29 11:34:38 +02:00
Jimmi HC
4c3f27ce1e ir_resolve_const now checks recursivly for undef values 2018-06-29 10:21:43 +02:00
Jimmi HC
b1128b18d5 Assert that array is not ConstArraySpecialUndef in const_values_equal 2018-06-29 08:41:16 +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
Andrew Kelley
6f88ecc9b6 add f16 to langref 2018-06-27 12:59:12 -04:00
tgschultz
3e94347e61 Fix up some std.rand syntax #1161 (#1162)
* Fix old syntax in rand

Ziggurat somehow did not get updated to latest syntax

* Fix broken float casts

f32 float casts somehow not updated to latest syntax
2018-06-27 12:30:15 -04:00
Andrew Kelley
1b4bae6d69
Merge pull request #1159 from bnoordhuis/f16
add f16 type
2018-06-27 12:29:05 -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
1f45075a0e dry floating-point type definitions 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
4de60dde6e langref: explicit cast section 2018-06-26 15:48:42 -04:00
Andrew Kelley
11ca38a4e9 fix crash for optional pointer to empty struct
closes #1153
2018-06-26 15:27:41 -04:00
Andrew Kelley
af95e15572 rename get_maybe_type to get_optional_type 2018-06-26 15:11:05 -04:00
Isaac Hier
8e714289ca Fix os_path_join for case where dirname is empty 2018-06-26 13:31:32 -04:00
Andrew Kelley
3290e72833 std.zig.ast: fix incorrect impl of FnProto.firstToken
closes #1151
2018-06-25 11:54:10 -04:00
Andrew Kelley
8866bef92c clean up self hosted main. delete unsupported commands 2018-06-22 01:54:38 -04:00
Andrew Kelley
be2a4c42bd
Merge pull request #1149 from ziglang/issue346
fix compiler crash for invalid enum
2018-06-21 21:21:05 -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
Andrew Kelley
47dd1049c8
Merge pull request #1145 from isaachier/bigint-neg-one-incr-fix
Fix bigint -1 increment operation
2018-06-21 13:40:37 -04:00
Isaac Hier
f1207a8e74 Add test case 2018-06-21 08:32:05 -04:00
Isaac Hier
eeda1a1396 Fix logic 2018-06-21 08:17:08 -04:00
Isaac Hier
0ab4afbf42 Fix increment operation for bigint -1 2018-06-21 08:14:26 -04:00
Marc Tiehuis
f50c0c664f Add float repr bit extraction functions 2018-06-21 01:45:12 -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
4eca75c53b Merge branch 'kristate-stdmem-replace-create-with-construct' 2018-06-20 17:33:49 -04:00
Andrew Kelley
85f928f8bf remove std.mem.Allocator.construct and other fixups 2018-06-20 17:33:29 -04:00