Commit Graph

5038 Commits

Author SHA1 Message Date
Andrew Kelley
b4f8d68e2e
translate-c: fix using wrong enum
closes #2385
2019-04-30 03:14:45 -04:00
daurnimator
fd056752da
std: add sendmmsg on linux 2019-04-30 16:47:09 +10:00
Andrew Kelley
a7f99c8ee9
self-hosted translate-c: iterate over top level decls
See #1964
2019-04-30 00:21:45 -04:00
Shritesh Bhattarai
01365be82f WASI: implement argsAlloc and argsFree (#2364)
* wasi: change URL to canon WASI-core.md

* wasi: import args_get and args_sizes_get

* wasi: Implement argsAlloc and argsFree

* test return value for wasi arg syscalls

* wasi: return unexpectedErrorPosix in argsAlloc

* wasi: Add TODO for ArgIterator
2019-04-29 21:54:30 -04:00
LemonBoy
77383f968d translate-c: Emit @ptrCast + @alignPtr sequence
Avoid producing Zig code that doesn't compile due to mismatched
alignments between pointers.

Always emit a @alignOf instead of hardcoding the alignment value
returned by LLVM for portability sake of the generated code.
2019-04-29 21:30:19 -04:00
LemonBoy
b1a61a6d51 compiler-rt: Add __mulodi4 2019-04-29 18:55:20 -04:00
Andrew Kelley
d2328ac71a
Merge pull request #2372 from LemonBoy/aeabi_idiv
compiler-rt: Add __divsi3, __aeabi_idiv
2019-04-29 18:54:21 -04:00
Andrew Kelley
75d42ace31
Merge branch 'squeek502-readme-std-lib' 2019-04-29 18:25:49 -04:00
Andrew Kelley
360ab8310b
readme: expand Developing Zig section into Contributing section 2019-04-29 18:25:27 -04:00
Andrew Kelley
fe80c15c4b
Merge branch 'readme-std-lib' of https://github.com/squeek502/zig into squeek502-readme-std-lib 2019-04-29 17:38:03 -04:00
Matt Stancliff
a4e506510b Fix crash due to command line argument parsing
zig --help -> ok
zig --help --c-source -> ok
zig --c-source --help -> crash [fixed]

'i' was being incremented without regard for the 'argc' limit, so
we were running off the end of 'argv'.
2019-04-29 17:34:23 -04:00
Andrew Kelley
e3452ba21b
json tests do not need this prefix anymore 2019-04-29 14:04:31 -04:00
Andrew Kelley
da28811c50
enable more json tests
I think it was a mistake that these weren't getting automatically run by
the test suite.
2019-04-29 14:02:19 -04:00
Andrew Kelley
4b6f350369
DirectAllocator: move if > 0 condition above @memcpy
Minor improvement to 3c13aa17 as noted by daurnimator
2019-04-29 13:48:15 -04:00
Shawn Landden
3c13aa178b std.heap: do not excessively call mmap, and munmap in direct allocator 2019-04-29 13:47:24 -04:00
Andrew Kelley
8afa1e800b
fix build (unused function warning)
d3c88a89 needed some #ifdefs shuffled around
2019-04-29 13:18:16 -04:00
LemonBoy
4e241263ff compiler-rt: Add __divmodsi4, __aeabi_idivmod 2019-04-29 19:17:48 +02:00
LemonBoy
738562e990 compiler-rt: Add __divsi3, __aeabi_idiv 2019-04-29 19:17:48 +02:00
Andrew Kelley
d3c88a8949
Merge pull request #2139 from emekoi/lib-on-mingw
implement linking to libc on mingw
2019-04-29 13:16:41 -04:00
LemonBoy
9902b604cb Fix generation of container initializers
The code creates temporary ConstExprValue with global_refs set to
nullptr and that's carried over to the final value. Doing so prevents
the deduplication mechanism to work correctly, causing all sorts of
runtime crashes.

Fixes #1636
Fixes #1608 (Even though it was already fixed by #1991)
2019-04-28 13:13:42 -04:00
LemonBoy
fbcc559cdb Make io offsets/sizes u64 instead of usize
Decouple the concepts of address-space size and file size.

Closes #637
2019-04-28 18:07:40 +02:00
emekoi
6057513cc7 fixed visibility of zig_libc_cc_print_file_name 2019-04-27 16:17:07 -05:00
Ryan Liptak
205e501e42 std.fmt: add max_depth to avoid infinite recursion from self-references 2019-04-27 11:20:10 -04:00
daurnimator
bc1840e18f Revert "std: Add mem.nativeIntToBig and mem.nativeIntToLittle"
This reverts commit 211f0a2226.

The functions `mem.nativeToBig` and `mem.nativeToLittle` already existed.
2019-04-27 11:18:53 -04:00
emekoi
66f3ef06e8 fixed syntax error 2019-04-27 11:16:33 -04:00
emekoi
dfada0cc77 added static_crt_dir to libc file 2019-04-27 00:24:26 -05:00
Shritesh Bhattarai
d02489fd9a fix missing semicolon 2019-04-26 21:01:20 -04:00
Andrew Kelley
2d6520d5d4
zig fmt is built directly into stage1 rather than child process
Previously, `zig fmt` on the stage1 compiler (which is what we currently
ship) would perform what equates to `zig run std/special/fmt_runner.zig`

Now, `zig fmt` is implemented with the hybrid zig/C++ strategy outlined
by #1964.

This means Zig no longer has to ship some of the stage2 .zig files, and
there is no longer a delay when running `zig fmt` for the first time.
2019-04-26 20:46:28 -04:00
Andrew Kelley
ac3946620c
Merge pull request #2357 from squeek502/heap-shrink-large-align
DirectAllocator: reduce the amount of redundant memcpy calls on Windows
2019-04-26 19:34:24 -04:00
Shritesh Bhattarai
efc5122fb6 docgen: properly close tags for skipped execs 2019-04-26 19:33:33 -04:00
Ryan Liptak
6936f0514f readme: Fix filepath to test file when testing std lib changes 2019-04-26 14:14:48 -07:00
Andrew Kelley
28071ac637
self-hosted translate-c emits a hello world AST
Also breaking std lib API change: the return value of
std.zig.parse returns `*ast.Tree` rather than `ast.Tree`.

See #1964
2019-04-26 15:43:36 -04:00
Andrew Kelley
c82acdbb9e
clean up test output
After 4df2f3d74f test names have the word "test" in them so the
redundant word is removed from test runner. Also move the prefix/suffix
to where it logically belongs in the fully qualified symbol name.
2019-04-26 15:10:13 -04:00
Andrew Kelley
1d95fdaf6e
Fix path canonicalization when $HOME has a trailing slash 2019-04-26 14:37:26 -04:00
LemonBoy
9ec4ccc68f Do not invoke UB in BigInt shr operations
Shifting a value of type T by an amount that's greater or equal to the
size of the type itself is UB.

Spotted by @tgschultz
2019-04-26 14:24:35 -04:00
rylmovuk
4df2f3d74f Change symbol name of tests in codegen
Tests now have the symbol name of the format `test "<name>"` in order
to be more easily distinguished from functions with similar names.
See issue #2267.
2019-04-26 14:23:56 -04:00
Ryan Liptak
afc33f00ee heap: fixup style of realloc memory copies 2019-04-25 13:41:19 -07:00
Ryan Liptak
57f545eed8 std.heap.DirectAllocator: reduce the amount of redundant memcpy calls on Windows
Previously the memory would be copied to a different aligned address in some cases where the old offset could have been used. This fixes it so that it will always try to use the old offset when possible, and only uses a different offset if the old one is truly invalid (not aligned or not enough space to store the alloc at the old offset).
2019-04-25 13:35:45 -07:00
Andrew Kelley
92d9cef071
Merge pull request #2332 from ziglang/translate-c-userland
beginnings of implementing translate-c in userland
2019-04-25 08:35:28 -04:00
Andrew Kelley
17ffe166c2
add preliminary windows support to std.io.COutStream 2019-04-25 00:24:25 -04:00
Andrew Kelley
e1bf74fca3
translate-c: put -x c back in there, it's necessary 2019-04-25 00:06:58 -04:00
Andrew Kelley
535d419590
translate-c: self-hosted implementation can detect C errors
See #1964
2019-04-25 00:06:58 -04:00
Andrew Kelley
712274997e
translate-c: unify API for self-hosted and C++ translate-c
See #1964
2019-04-25 00:06:57 -04:00
Andrew Kelley
976080462c
translate-c: a little closer to self-hosted implementation 2019-04-25 00:06:54 -04:00
Andrew Kelley
56e07622c6
Merge pull request #2312 from squeek502/heap-shrink-large-align
fix heap allocators when shrinking an object but growing its alignment
2019-04-24 23:44:28 -04:00
Shawn Landden
8ef7f6febb remove Shebang (#!) support
Closes:  #2165
2019-04-24 23:34:19 -04:00
Andrew Kelley
fb2acaff06
@sizeOf returns 0 for comptime types
This defines `@sizeOf` to be the runtime size of a type, which means
that it is zero for types such as comptime_int, type, and (enum
literal).

See #2209
2019-04-24 22:31:53 -04:00
vegecode
733c547a65 compiler-rt: Add missing import of test for comparesf2 2019-04-24 21:16:03 -04:00
vegecode
01168e1577 compiler-rt: add aeabi_dcmp, comparedf2 2019-04-24 21:15:39 -04:00
LemonBoy
e4825dbd77 Other 2019-04-24 20:54:17 +02:00