2736 Commits

Author SHA1 Message Date
xackus
5c8f7f81cd change debug.assert to testing.expect in tests 2020-11-06 22:48:54 +01:00
Andrew Kelley
d1b1f053b0
Merge pull request #6941 from LemonBoy/floateqapprox
std: Implement more useful approxEq semantics
2020-11-06 14:09:31 -05:00
Vexu
79549e0ac1
translate-c: fix macro functions with no arguments 2020-11-06 12:48:52 +02:00
LemonBoy
78840c4ab2 stage1: Make sure union(enum(T)) is valid
The T type should be wide enough to fit values in the  0...num field
range.

Closes #6988
2020-11-05 17:24:04 -05:00
LemonBoy
ff14451b4a std: Implement more useful approxEq semantics
Comparisons with absolute epsilons are usually useful when comparing
numbers to zero, for non-zero numbers it's advised to switch to relative
epsilons instead to obtain meaningful results (check [1] for more
details).

The new API introduces approxEqAbs and approxEqRel, where the former
aliases and deprecated the old `approxEq`, allowing the user to pick the
right tool for the job.

The documentation is meant to guide the user in the choice of the
correct alternative.

[1] https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/
2020-11-05 16:08:49 +01:00
LemonBoy
be26c3bf4e stage1: Fix *WithOverflow intrinsics with u0 values
Closes #5369
2020-11-02 13:40:00 -05:00
LemonBoy
4fd1ec78e9 std: Re-enable union behaviour test for mips targets 2020-11-02 11:46:26 +01:00
Andrew Kelley
909aae8153
Merge pull request #6792 from koachan/sparc64-linux
Initial sparc64-linux bringup
2020-11-01 22:14:56 -05:00
LemonBoy
0d6a7088dc stage1: Implement Add/Mul reduction operators 2020-11-01 14:30:31 -07:00
Veikka Tuominen
9ca9819488
Merge pull request #6883 from Vexu/translate-c
translate-c: correctly handle pointers to opaque demoted structs
2020-10-31 15:25:14 +02:00
Vexu
28a0583b84
run zig fmt on src/ and test/ 2020-10-31 12:21:49 +02:00
Veikka Tuominen
7c8d9cfa40
Merge pull request #6660 from Vexu/stage2
Stage2 switch and package imports
2020-10-31 09:39:28 +02:00
Vexu
3ff381385a
translate-c: correctly handle pointers to opaque demoted structs 2020-10-31 09:30:13 +02:00
Travis
bb6e39e274 remove extra space in .** error message 2020-10-30 21:26:05 +02:00
Veikka Tuominen
80dd432137
Merge pull request #6858 from travv0/no-star-after-dot-star
don't allow a token starting with an asterisk directly following .*
2020-10-30 16:08:04 +02:00
Vexu
22ec5e0859
stage2: fix typo in liveness; add comptime switch test 2020-10-30 15:58:13 +02:00
LemonBoy
490cafe2c5 stage1: Error out when trying to execute unreachable
Closes #6802
2020-10-29 20:06:52 -04:00
LemonBoy
4fb896f16e
stage1: Fix bug in internal string slicing (#6843)
Closes #6456
2020-10-29 14:38:13 -04:00
Travis
960b5b518f updated zig tokenizer to handle .*** and added tests 2020-10-29 12:03:45 -05:00
LemonBoy
b3314a8be6 stage1: Fix small bug in pointer type analysis
A flag meant to catch recursively-defined types was never reset, leading
the compiler to generate wrong answers when asked for its
type/alignment.

Closes #6850
2020-10-29 15:41:45 +02:00
LemonBoy
7bc9531698 stage1: Correctly generated optional constant values
Closes #6799
2020-10-28 21:56:28 +02:00
LemonBoy
6d2f103bfb stage1: Fix crash in comptime struct value copy
Comptime fields are never materialized in the ZigValue so pay attention
when iterating over the fields array.

Fixes #6800
2020-10-28 21:13:32 +02:00
Koakuma
3a58b2330c Update stack traces testcases 2020-10-28 17:46:26 +07:00
frmdstryr
1ce0994897 Fix @import of empty file 2020-10-26 13:29:32 -07:00
Andrew Kelley
e83334274f add regression test for already fixed bug
closes #6781
2020-10-26 13:18:44 -07:00
Andrew Kelley
392e6da8a3 update stack trace test case 2020-10-22 21:57:30 -07:00
Andrew Kelley
e02655798f
Merge pull request #6743 from LemonBoy/someppc64stuff
Some ppc64 stuff
2020-10-22 17:39:26 -04:00
Andrew Kelley
e6ac082437
Merge pull request #6744 from LemonBoy/intcast-vec
stage1: Implement `@intCast` between vectors
2020-10-22 17:36:18 -04:00
LemonBoy
44f8e6a534 stage1: Fix edge case in Union ZigValue generation
Unions that passed the one_possible_value check were incorrectly
generated, none of their internal fields were initialized.

Fixes #6758
2020-10-21 22:42:03 -04:00
LemonBoy
39e34081ca Update the stack-traces tests 2020-10-19 20:09:43 +02:00
LemonBoy
2f465761bb stage1: Implement @intCast between vectors
Explicit and implicit integer casts on vector types are now supported
and follow the same rules as their scalar counterparts.

Implicit float casts are accidentally supported, `@floatCast` is still
not vector-aware.
2020-10-19 20:05:09 +02:00
LemonBoy
2a256d5ea0 stage1: Fix type-checking of unary neg for vector types
Validate the vector element type as done for the scalar case.

Fixes #6708
2020-10-17 21:08:39 -04:00
Andrew Kelley
9052e0b137
Merge pull request #6713 from jprudil/close-6697
Make std.meta.Int accept a signedness parameter
2020-10-17 18:55:25 -04:00
Andrew Kelley
0011def2b2 fix compilation error when building with io_mode evented
The merge of #5613 introduced a regression when building with io_mode
evented, fixed in this commit.

closes #6715
2020-10-17 15:46:36 -07:00
Jan Prudil
132813849c Convert remaining call sites 2020-10-17 14:50:26 +02:00
Andrew Kelley
245d98d32d
Merge pull request #6291 from pixelherodev/cbe_arithmetic
CBE: addition and subtraction
2020-10-17 01:00:38 -04:00
vegecode
2545f44db0 byteOffsetOf add fields to non-packet struct to maintain symmetry 2020-10-16 20:04:42 -07:00
vegecode
0456b2145d byteOffsetOf rounds up using bit offset in host integer 2020-10-16 20:04:42 -07:00
Isaac Freund
0e4c3934a0 zig fmt: write modified files to stdout not stderr 2020-10-16 20:23:18 -04:00
LemonBoy
2a62d4b20b stage1: Expand undefined struct/arrays when indexed
Fixes #6693
2020-10-16 17:13:38 +03:00
Andrew Kelley
d87bd3d8af fixups regarding windows wide strings
* remove GetModuleHandleA from kernel32.zig. use of A functions
   considered harmful.
 * make it a compile error to expose WinMain instead of wWinMain. same
   thing.
 * start code declares wWinMainCRTStartup instead of WinMainCRTStartup
   when it has the choice.
2020-10-15 19:37:55 -07:00
Andrew Kelley
c7c38e7279 Merge branch '5002-fix-entrypoint-with-winmain' of https://github.com/AnthonyYoManz/zig into AnthonyYoManz-5002-fix-entrypoint-with-winmain 2020-10-15 18:22:12 -07:00
Andrew Kelley
d91e75f5ca getExternalExecutor fixups regarding dynamic linker
* std.Target.standardDynamicLinkerPath: macOS has a dynamic linker
 * no need to override the default dynamic linker in the macos
   CrossTarget initialization in the tests
 * in getExternalExecutor, when validating the dynamic linker path, take
   into account the standard dynamic linker path.
2020-10-15 16:44:16 -07:00
Jakub Konka
0e1afee732 Enable stage2 end-to-end tests on macOS run natively
This commit enables stage2 end-to-end tests to run natively on macOS
(where and when applicable). Since QEMU on macOS doesn't support
the same type of architecture emulation as it does on linux (i.e.,
there is no `qemu-x86_64` for instance), this commit ensures that we
specify a path to dynamic linker on macOS (`/usr/lib/dyld`) which
is then checked for existence in `std.CrossTarget.getExternalExecutor()`
function, and if exists, we can run the test natively.

Signed-off-by: Jakub Konka <kubkon@jakubkonka.com>
2020-10-15 15:59:16 -07:00
LemonBoy
ab585c680b stage1: Off-by-one error in int to float conversion
The base is 2^64 and not 2^64-1.

Closes #6683
2020-10-15 21:25:59 +03:00
Jakub Konka
68b31c59a6
Merge pull request #6650 from kubkon/macho-incremental
stage2: enable incremental MachO linking
2020-10-14 08:20:33 +02:00
LemonBoy
0570df69b1 stage1: Fix missing runtime safety check for intToPtr
Elide the alignment check if the pointer alignment is one, the null
check must be preserved as it depends on the pointer type.

Fixes #6667
2020-10-14 00:05:50 -04:00
Jakub Konka
951721343f Reuse text blocks; enable all incremental tests 2020-10-13 08:38:17 +02:00
Jakub Konka
cf2aea7b41 Enable incremental testcase for macOS 2020-10-13 08:38:17 +02:00
Vignesh Rajagopalan
2ab0c7391a Rename .macosx to .macos 2020-10-12 18:56:25 -04:00