Commit Graph

127 Commits

Author SHA1 Message Date
Sahnvour
4c882e731f hash_map: adding a StringHashMap for convenience 2019-08-24 15:30:23 +02:00
Andrew Kelley
456a244d62 fix event loop regression on macos 2019-08-17 11:40:48 -04:00
Andrew Kelley
e24cc2e77b
std.event.Loop: fix not waking up after file system I/O
for single threaded event loops
2019-08-16 23:19:13 -04:00
Andrew Kelley
3dce41b61a
improvements to std lib for event-based I/O 2019-08-16 21:29:29 -04:00
Andrew Kelley
13c584d325
add compile error for casting const frame to anyframe
See #3063
2019-08-16 11:38:41 -04:00
Andrew Kelley
7e75e1075e
zig fmt 2019-08-15 18:19:04 -04:00
Andrew Kelley
13b5a4bf8c
remove cancel 2019-08-15 14:05:12 -04:00
Andrew Kelley
5092634103
avoid the word "coroutine", they're "async functions" 2019-08-13 14:14:19 -04:00
Andrew Kelley
12ff91c1c9
alignment of structs no longer depends on LLVM
fixes async function tests in optimized builds
2019-08-13 12:44:30 -04:00
Andrew Kelley
24d5ec0783
fix async function frames not aligned enough 2019-08-11 22:35:12 -04:00
Andrew Kelley
4d8d513e16
all tests passing 2019-08-11 19:53:10 -04:00
Andrew Kelley
da56959a9a
closer to std lib event stuff working 2019-08-08 16:41:38 -04:00
Andrew Kelley
93840f8610
fix var args call on non-generic function 2019-08-08 15:34:41 -04:00
Andrew Kelley
cfe84423c9
fix segfault with var args 2019-08-08 15:13:05 -04:00
Andrew Kelley
d422d5753b
avoid std.debug.global_allocator in http headers tests 2019-06-27 15:38:40 -04:00
Andrew Kelley
33f996bb16
all tests passing on linux 2019-06-26 14:00:44 -04:00
Andrew Kelley
ff737cc648
fix peer type resolution: unreachable, error set, unreachable 2019-06-26 12:31:51 -04:00
Andrew Kelley
036cc48a82
Merge remote-tracking branch 'origin/master' into copy-elision-3 2019-06-23 01:29:48 -04:00
Andrew Kelley
38568318a0
fix some legacy coroutine stuff 2019-06-23 00:41:11 -04:00
Sahnvour
987c209b40 heap: make one global instance of DirectAllocator
it is now stateless, so the de/init are not necessary anymore
2019-06-22 14:10:53 -04:00
daurnimator
ed41d10a06
std: existing LinkedList is actually a TailQueue 2019-06-10 15:41:40 +10:00
Andrew Kelley
5017a1d895 fix build on macos 2019-06-10 00:35:27 -04:00
Andrew Kelley
b735764898
different array literal syntax when inferring the size
old syntax:  []i32{1, 2, 3}
new syntax: [_]i32{1, 2, 3}

closes #1797
2019-06-09 19:26:32 -04:00
LemonBoy
477ee9c8b9 Fix some syscalls on arm64 2019-05-30 16:28:33 +02:00
Andrew Kelley
86bb7e5984 fixes for windows to build self hosted compiler 2019-05-27 15:55:15 -04:00
Andrew Kelley
db0a5e7516 darwin: add missing error handling 2019-05-27 15:14:35 -04:00
Andrew Kelley
06435535d3
fixes for darwin 2019-05-27 14:12:50 -04:00
Andrew Kelley
129714d077
more fixes for windows and wasi 2019-05-27 01:35:58 -04:00
Andrew Kelley
0c6ab61b22
tests passing on linux 2019-05-26 23:35:26 -04:00
Andrew Kelley
2f040a23c8
clean up references to os 2019-05-26 18:32:44 -04:00
Andrew Kelley
7cb6279ac0
clean up references to posix 2019-05-26 18:32:44 -04:00
Andrew Kelley
ca6debcaf4
starting to fix the regressions 2019-05-26 18:32:44 -04:00
Andrew Kelley
17b0166e00
do Jay's suggestion with posix/os API naming & layout 2019-05-26 18:32:44 -04:00
Andrew Kelley
2def23063f
more progress. moving windows API layer to its own file 2019-05-26 18:32:44 -04:00
Andrew Kelley
daae7e1f5a
more progress on posix API layer
see #2380
2019-05-26 18:32:43 -04:00
Andrew Kelley
67726e36b0
extract posix functions from std/os.zig to std/os/posix.zig
See #2380
2019-05-26 18:32:40 -04:00
Andrew Kelley
5a57610039
clean up code now that #769 is implemented 2019-05-14 19:23:31 -04:00
Andrew Kelley
c1793d6106
zig fmt on the standard library 2019-05-12 12:56:01 -04:00
emekoi
b7aa289ae4 fixed broken casts in std 2019-03-31 16:47:34 -05:00
Andrew Kelley
a45807db22 disable flaky event test until post coroutine rewrite 2019-03-09 01:15:18 -05:00
Andrew Kelley
3d2c48e4c9 disable some tests until coroutine rewrite is finished 2019-03-07 16:11:00 -05:00
Andrew Kelley
e402455704
rename std lib files to new convention 2019-03-02 16:46:04 -05:00
Maya Rashish
bc10382ec1 Add NetBSD support
Mostly picking the same paths as FreeBSD.
We need a little special handling for crt files, as netbsd uses its
own (and not GCC's) for those, with slightly different names.
2019-02-17 09:17:34 +02:00
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
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
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
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
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
b883bc873d
breaking API changes to all readInt/writeInt functions & more
* add `@bswap` builtin function. See #767
 * comptime evaluation facilities are improved to be able to
   handle a `@ptrCast` with a backing array.
 * `@truncate` allows "truncating" a u0 value to any integer
   type, and the result is always comptime known to be `0`.
 * when specifying pointer alignment in a type expression,
   the alignment value of pointers which do not have addresses
   at runtime is ignored, and always has the default/ABI alignment
 * threw in a fix to freebsd/x86_64.zig to update syntax from
   language changes
 * some improvements are pending #863

closes #638
closes #1733

std lib API changes
 * io.InStream().readIntNe renamed to readIntNative
 * io.InStream().readIntLe renamed to readIntLittle
 * io.InStream().readIntBe renamed to readIntBig
 * introduced io.InStream().readIntForeign
 * io.InStream().readInt has parameter order changed
 * io.InStream().readVarInt has parameter order changed
 * io.InStream().writeIntNe renamed to writeIntNative
 * introduced io.InStream().writeIntForeign
 * io.InStream().writeIntLe renamed to writeIntLittle
 * io.InStream().writeIntBe renamed to writeIntBig
 * io.InStream().writeInt has parameter order changed
 * mem.readInt has different parameters and semantics
 * introduced mem.readIntNative
 * introduced mem.readIntForeign
 * mem.readIntBE renamed to mem.readIntBig and different API
 * mem.readIntLE renamed to mem.readIntLittle and different API
 * introduced mem.readIntSliceNative
 * introduced mem.readIntSliceForeign
 * introduced mem.readIntSliceLittle
 * introduced mem.readIntSliceBig
 * introduced mem.readIntSlice
 * mem.writeInt has different parameters and semantics
 * introduced mem.writeIntNative
 * introduced mem.writeIntForeign
 * mem.writeIntBE renamed to mem.readIntBig and different semantics
 * mem.writeIntLE renamed to mem.readIntLittle and different semantics
 * introduced mem.writeIntSliceForeign
 * introduced mem.writeIntSliceNative
 * introduced mem.writeIntSliceBig
 * introduced mem.writeIntSliceLittle
 * introduced mem.writeIntSlice
 * removed mem.endianSwapIfLe
 * removed mem.endianSwapIfBe
 * removed mem.endianSwapIf
 * added mem.littleToNative
 * added mem.bigToNative
 * added mem.toNative
 * added mem.nativeTo
 * added mem.nativeToLittle
 * added mem.nativeToBig
2018-12-12 20:35:04 -05:00