Commit Graph

4163 Commits (c2db077574be841da586fa62d67619c901dd535d)

Author SHA1 Message Date
Andrew Kelley c2db077574
std.debug.assert: remove special case for test builds
Previously, std.debug.assert would `@panic` in test builds,
if the assertion failed. Now, it's always `unreachable`.

This makes release mode test builds more accurately test
the actual code that will be run.

However this requires tests to call `std.testing.expect`
rather than `std.debug.assert` to make sure output is correct.

Here is the explanation of when to use either one, copied from
the assert doc comments:

Inside a test block, it is best to use the `std.testing` module
rather than assert, because assert may not detect a test failure
in ReleaseFast and ReleaseSafe mode. Outside of a test block, assert
is the correct function to use.

closes #1304
2019-02-08 18:23:38 -05:00
John Schmidt be6d022257 Make ThreadSafeFixedBufferAllocator alias FixedBufferAllocator when --single-threaded
Fixes #1910
2019-02-07 23:21:37 -05:00
Andrew Kelley f330eebe4b fix using the result of @intCast to u0
closes #1817
2019-02-07 16:02:45 -05:00
Andrew Kelley 7843c96df8
build: make sure LLVM is exactly correct
* check the version to be the correct major version
 * ensure that it has all the default targets enabled
2019-02-07 12:18:01 -05:00
Andrew Kelley 2b2bf53a49
better error message when LLVM does not understand a triple 2019-02-07 11:40:56 -05:00
Andrew Kelley a0590bda29
Merge branch 'kristate-zig-backport-std.mem.join' 2019-02-07 10:56:30 -05:00
Andrew Kelley 38a7716194
fixups 2019-02-07 10:55:23 -05:00
Andrew Kelley 130f422742
Merge branch 'zig-backport-std.mem.join' of https://github.com/kristate/zig into kristate-zig-backport-std.mem.join 2019-02-07 10:43:14 -05:00
Andrew Kelley 7fc99c33bd
Merge branch 'kristate-zig-backport-std.os.path' 2019-02-07 00:49:06 -05:00
Andrew Kelley 36bade5c56
fixups, and modify std.mem.join and std.os.path.resolve API
* zig fmt
 * std.mem.join takes a slice of slices instead of var args
 * std.mem.join takes a separator slice rather than byte,
   and always inserts it. Previously it would not insert the separator
   if there already was one, violating the documented behavior.
 * std.mem.join calculates exactly the correct amount to allocate
   and has no call to allocator.shrink()
 * bring back joinWindows and joinPosix and the corresponding tests.
   it is intended to be able to call these functions from any OS.
 * rename std.os.path.resolveSlice to resolve (now resolve takes
   a slice of slices instead of var args)
2019-02-07 00:42:41 -05:00
Andrew Kelley c804ae2d6b
Merge branch 'zig-backport-std.os.path' of https://github.com/kristate/zig into kristate-zig-backport-std.os.path 2019-02-06 22:53:34 -05:00
Andrew Kelley 8a5d3e2eaf
Merge pull request #1924 from ziglang/tls
Implement Thread Local Variables
2019-02-06 20:21:13 -05:00
Andrew Kelley 89ffb58197 implement Thread Local Storage on Windows 2019-02-06 18:32:41 -05:00
Andrew Kelley d2602b442e
require running std lib tests coherently
this should actually improve CI times a bit too

See the description at the top of std/os/startup.zig (deleted in this
commit) for a more detailed understanding of what this commit does.
2019-02-06 14:32:20 -05:00
Andrew Kelley b1775ca168
thread local storage working for linux x86_64 2019-02-06 13:48:04 -05:00
Andrew Kelley 3abf293a84
doc/targets.md has moved to the github wiki
https://github.com/ziglang/zig/wiki/How-to-Add-Support-For-More-Targets
2019-02-06 11:53:09 -05:00
tgschultz 20e2d8da61 Fixed Serializer and BitOutStream when used with streams that have empty error sets. 2019-02-06 00:06:27 -05:00
Andrew Kelley fd28b9d501
Merge pull request #1919 from Sahnvour/windows-childprocess
Better behaviour of ChildProcess under windows.
2019-02-05 21:03:33 -05:00
Sahnvour 6860db66fe Typo: use the joined path to try executables available from PATH. 2019-02-05 23:13:17 +01:00
Sahnvour a9faace8b4 Notify failure to create a process when the executable is not found even in PATH. 2019-02-05 23:12:54 +01:00
Andrew Kelley ac4e38226b
docs: clarify passing aggregate types as parameters 2019-02-05 10:28:56 -05:00
Jimmi Holst Christensen 4010f6a11d Added support for vector wrapping mult and sub
* I also merged the code that generates ir for add, sub, and mult
2019-02-05 09:57:11 -05:00
Andrew Kelley 06be65a602
fix vector debug info tripping LLVM assertion 2019-02-04 22:16:16 -05:00
Andrew Kelley 8c6fa982cd
SIMD: array to vector, vector to array, wrapping int add
also vectors and arrays now use the same ConstExprVal representation

See #903
2019-02-04 20:30:00 -05:00
Andrew Kelley 2828a9695f
Merge branch 'kristate-zig-backport-std.mem.separate' 2019-02-04 15:27:44 -05:00
Andrew Kelley 67bd45f0cf
adjustments to std.mem split / separate
* rename std.mem.split to std.mem.tokenize
 * add future deprecation notice to docs
 * (unrelated) add note to std.os.path.resolve docs
 * std.mem.separate - assert delimiter.len not zero
 * fix implementation of std.mem.separate to respect the delimiter
 * separate the two iterators to different structs
2019-02-04 15:24:06 -05:00
Andrew Kelley f44ce7836a
Merge branch 'zig-backport-std.mem.separate' of https://github.com/kristate/zig into kristate-zig-backport-std.mem.separate 2019-02-04 13:29:17 -05:00
Andrew Kelley dfbc063f79
`std.mem.Allocator.create` replaced with better API
`std.mem.Allocator.createOne` is renamed to `std.mem.Allocator.create`.

The problem with the previous API is that even after copy elision,
the initalization value passed as a parameter would always be a copy.
With the new API, once copy elision is done, initialization
functions can directly initialize allocated memory in place.

Related:
 * #1872
 * #1873
2019-02-03 16:13:28 -05:00
Matthew McAllister c90c256868 Fix slice concatenation
This was causing an underflow error
2019-02-02 22:22:00 -05:00
Andrew Kelley 9b8e23934b
introduce --single-threaded build option
closes #1764

This adds another boolean to the test matrix; hopefully it does not
inflate the time too much.

std.event.Loop does not work with this option yet. See #1908
2019-02-01 18:05:54 -05:00
Matthew McAllister 8bedb10939 Fix runtime assignment to comptime aggregate field
This was causing a segfault
2019-02-01 17:14:12 -05:00
Andrew Kelley ae1ebe09b7
add compile errror for @bitCast when bit counts mismatch
fixes invalid LLVM IR from previous commit
2019-02-01 14:06:51 -05:00
Andrew Kelley bbe857be96
Merge pull request #1775 from tgschultz/stdlib-serialization
Added serialization, bitstreams, traits for int sign, TagPayloadType, some fixes to std
2019-02-01 13:05:34 -05:00
Andrew Kelley 8d32d25619 Merge branch 'emekoi-windows-mutex' 2019-02-01 12:22:55 -05:00
Andrew Kelley bfc1772d8e fixups 2019-02-01 12:22:21 -05:00
Andrew Kelley 8d3eb25e92 Merge branch 'windows-mutex' of https://github.com/emekoi/zig into emekoi-windows-mutex 2019-02-01 10:21:16 -05:00
Andrew Kelley 7a4ed10981 darwin: fix incorrect timeval struct type
closes #1648

I also added some more extern functions for darwin time functions,
although nothing depends on them currently.
2019-01-31 18:57:53 -05:00
Andrew Kelley 28873e7622 os.cpp: fix regression on Windows from 59c050e7 2019-01-31 16:52:59 -05:00
Andrew Kelley 545064c1d9
introduce vector type for SIMD
See #903

 * create with `@Vector(len, ElemType)`
 * only wrapping addition is implemented

This feature is far from complete; this is only the beginning.
2019-01-30 23:39:25 -05:00
Andrew Kelley 169a789b34
fix test after merging ad8381e0d2
this test slipped through due to branching
2019-01-30 16:12:30 -05:00
Andrew Kelley 59c050e7ff
collapse os_file_mtime into os_file_open_r and check for directory
This is a manual merge of kristate's pull request #1754, due to
conflicts + a couple fixups.

closes #1754
2019-01-30 16:06:18 -05:00
Matthew McAllister ad8381e0d2 Move tokenizer error location to offending char
Previously, it pointed to the start of the current token, but this made
it difficult to tell where the error occurred when it was, say, in the
middle of a string.
2019-01-30 14:02:01 -05:00
Andrew Kelley ecb0cb661a
darwin time code: don't cast to int until the end
See #1648
2019-01-30 02:53:59 -05:00
Andrew Kelley 9ca94bbba5
fix freebsd ci from previous commit 2019-01-30 02:53:50 -05:00
Andrew Kelley 581edd643f
backport copy elision changes
This commit contains everything from the copy-elision-2
branch that does not have to do with copy elision directly,
but is generally useful for master branch.

 * All const values know their parents, when applicable, not
   just structs and unions.
 * Null pointers in const values are represented explicitly,
   rather than as a HardCodedAddr value of 0.
 * Rename "maybe" to "optional" in various code locations.
 * Separate DeclVarSrc and DeclVarGen
 * Separate PtrCastSrc and PtrCastGen
 * Separate CmpxchgSrc and CmpxchgGen
 * Represent optional error set as an integer, using the 0 value.
   In a const value, it uses nullptr.
 * Introduce type_has_one_possible_value and use it where applicable.
 * Fix debug builds not setting memory to 0xaa when storing
   undefined.
 * Separate the type of a variable from the const value of a variable.
 * Use copy_const_val where appropriate.
 * Rearrange structs to pack data more efficiently.
 * Move test/cases/* to test/behavior/*
 * Use `std.debug.assertOrPanic` in behavior tests instead of
   `std.debug.assert`.
 * Fix outdated slice syntax in docs.
2019-01-29 22:30:30 -05:00
Andrew Kelley 9c328b4291
simpler implementation of `&&` and `||` hints
This accomplishes the same goal, but with less changes, so that
I can backport copy elision stuff easier.
2019-01-29 22:29:56 -05:00
kristopher tate 5bf9ffdc5b Hint at use of and/or when &&/|| is improperly used (#1886) 2019-01-25 21:10:40 +01:00
tharvik 3bec3b9f9b llvm-config sanity check 2019-01-21 15:58:54 -05:00
Andrew Kelley aee973829d
Merge branch 'kristate-zig-backport-issue1883' 2019-01-20 14:09:46 -05:00
Andrew Kelley 1357bc7430
add test case for previous commit 2019-01-20 14:09:17 -05:00