Commit Graph

5916 Commits

Author SHA1 Message Date
Jonathan Marler b728cb6d4e Add @Type builtin 2019-09-03 22:50:29 -06:00
Andrew Kelley 77a5f888be emit a compile error if a test becomes async
See #3117
2019-09-03 22:09:47 -04:00
Andrew Kelley 6b27290c68 Merge branch 'Vexu-comment-in-array' 2019-09-03 21:51:23 -04:00
Andrew Kelley 8a7e2e3479 Merge branch 'comment-in-array' of https://github.com/Vexu/zig into Vexu-comment-in-array 2019-09-03 21:49:35 -04:00
Sahnvour ce14c543d1 error message and test for alignment of variables of zero-bit types 2019-09-03 21:14:40 -04:00
Andrew Kelley a4ce10df80 Merge pull request #3169 from Sahnvour/string_hash_map
Using StringHashMap everywhere it's needed
2019-09-03 20:30:26 -04:00
Andrew Kelley 42cc4a406b Merge branch 'marler8997-fixSegfault' 2019-09-03 18:26:10 -04:00
Andrew Kelley 1862075652 fix union field ptr ir instruction 2019-09-03 18:25:00 -04:00
Andrew Kelley a81e4351a2 Merge branch 'fixSegfault' of https://github.com/marler8997/zig into marler8997-fixSegfault 2019-09-03 18:15:01 -04:00
Sahnvour 9d6f236728 add fastpath for std.mem.eql and simplify std.hash_map.eqlString
this should also be friendlier to the optimizer
2019-09-03 23:56:04 +02:00
Sahnvour f08c6e4fe6 changing occurrences of HashMap with []const u8 as keys for StringHashMap 2019-09-03 23:53:05 +02:00
Andrew Kelley fc0f8d0359 zig build: make install prefix available to build.zig and
prevent accident of '/' showing up in application/library names
2019-09-03 16:19:10 -04:00
Andrew Kelley be17a4b6c1 fix compiler crash in struct field pointers
when the llvm type has not been fully analyzed. This is a regression
from lazy values.
2019-09-03 14:51:34 -04:00
Andrew Kelley e673d865fb fix stack traces on macos when passing absolute path to root source file
The comment added by this commit is copied here:

For macOS stack traces, we want to avoid having to parse the compilation unit debug
info. As long as each debug info file has a path independent of the compilation unit
directory (DW_AT_comp_dir), then we never have to look at the compilation unit debug
info. If we provide an absolute path to LLVM here for the compilation unit debug info,
LLVM will emit DWARF info that depends on DW_AT_comp_dir. To avoid this, we pass "."
for the compilation unit directory. This forces each debug file to have a directory
rather than be relative to DW_AT_comp_dir. According to DWARF 5, debug files will
no longer reference DW_AT_comp_dir, for the purpose of being able to support the
common practice of stripping all but the line number sections from an executable.

closes #2700
2019-09-03 13:46:08 -04:00
Vesa Kaihlavirta e9530ce97b Fix addition direction, remove superfluous loop counter, add tests 2019-09-03 13:45:02 -04:00
Andrew Kelley bdac2ba9dd Merge branch 'mikdusan-issue.2485'
closes #2544
2019-09-03 10:09:26 -04:00
Andrew Kelley aba67ecf44 rename test-compare-panic to test-stack-traces 2019-09-03 10:08:39 -04:00
Andrew Kelley 1fd24791a7 rename compare-panic to compare-stack-traces 2019-09-03 10:05:19 -04:00
Michael Dusan a19e73d8ae test: add compare-panic
`zig build test-compare-panic`

Create basic tests to compare panic output. The address field
is replaced by a symbolic constant and each expected output is
specific to os. Tests will only run for explicitly defined
platforms.

see also #2485
2019-09-03 09:59:43 -04:00
Andrew Kelley d74b8567cf omit prefix data for async functions sometimes
When `@frameSize` is never called, and `@asyncCall` on a runtime-known
pointer is never used, no prefix data for async functions is needed.

Related: #3160
2019-09-02 21:31:26 -04:00
Michael Dusan 00d82e34df cmake: improve building without git repository
- quiet `fatal: not a git repository` message
- if git probe fails skip ZIG_VERSION modification
2019-09-02 21:36:16 -04:00
Andrew Kelley 4a5b0cde13 fix const result loc, runtime if cond, else unreachable
Closes #2791. See that issue for more details; I documented the
debugging process quite thoroughly on this one.
2019-09-02 20:28:25 -04:00
Andrew Kelley ab4cba14c8 fix recursive call of await @asyncCall with struct return type 2019-09-02 14:35:41 -04:00
Andrew Kelley d291d3c8c0 fix using @typeOf on a generic function call 2019-09-02 13:07:44 -04:00
Andrew Kelley 0fe28855c5 add ability to specify darwin framework search dirs 2019-09-02 11:48:06 -04:00
Andrew Kelley 0c4d47c6d5 add regression test for already fixed bug
closes #2692
2019-09-01 23:35:58 -04:00
Andrew Kelley 8b1900e5df Revert "Merge pull request #2991 from emekoi/mingw-ci"
This reverts commit ec7d7a5b14, reversing
changes made to 81c441f885.

It looks like this broke colors in Windows Command Prompt (#3147)
and this method of detecting native C ABI isn't working well (#3121).
2019-09-01 00:33:02 -04:00
Andrew Kelley ec6f15b0f5 fix @typeOf an async function call of generic fn with error union type 2019-09-01 00:27:22 -04:00
Michael Dusan 1f99899408 stage1 enhance IR print
- pass2 now prints missing instructions in a trailing fashion
- instruction struct name added to print as column 2
2019-08-31 22:42:58 -04:00
Andrew Kelley 5c3a9a1a3e improvements to @asyncCall
* `await @asyncCall` generates better code. See #3065
 * `@asyncCall` works with a real `@Frame(func)` in addition to
   a byte slice. Closes #3072
 * `@asyncCall` allows passing `{}` (a void value) as the result
   pointer, which uses the result location inside the frame.
   Closes #3068
 * support `await @asyncCall` on a non-async function. This is in
   preparation for safe recursion (#1006).
2019-08-31 18:50:16 -04:00
Andrew Kelley a223063923 @typeOf now guarantees no runtime side effects
related: #1627
2019-08-31 11:00:31 -04:00
Andrew Kelley 6ab8b2aab4 support recursive async and non-async functions
which heap allocate their own frames

related: #1006
2019-08-30 20:06:02 -04:00
Andrew Kelley 2148943fff Merge pull request #3139 from hspak/zig-fmt-nested-if
zig fmt: fix nested if
2019-08-30 15:48:07 -04:00
Andrew Kelley fed5c12d9a musl: fix alltypes.h and syscall.h not being correct
The previous
[instructions](https://github.com/ziglang/zig/wiki/Updating-libc) for
updating musl libc headers had this (repeated for each architecture):

make DESTDIR=build-all/arm install-headers ARCH=arm

However musl's build system does not properly rebuild alltypes.h and
syscall.h from source, instead using whatever is cached from the
previous build. In the case of the previous time that I updated to musl
1.1.23, this happened to be the aarch64 architecture.

As a workaround, one can remove the obj/ directory to force rebuilding
this file. Now the instructions say this (repeated for each architecture):

rm -rf obj/ && make DESTDIR=build-all/arm install-headers ARCH=arm

This commit updates the resulting headers after this workaround is
applied and the process headers tool is run again.
2019-08-30 15:02:23 -04:00
Andrew Kelley 37ef490fc6 update process_headers.zig for latest zig 2019-08-30 15:01:37 -04:00
Andrew Kelley d9fed5cdfd align(@alignOf(T)) T does not force resolution of T 2019-08-30 14:53:44 -04:00
Michael Dusan 966670645a fix stage1 to build on macOS + xcode/clang 2019-08-30 09:01:29 -04:00
Hong Shick Pak 19964f5dc8 run new zig fmt and remove stale comment 2019-08-29 21:23:49 -07:00
Hong Shick Pak 9f4d44bc49 zig fmt: fix nested if 2019-08-29 21:10:26 -07:00
Andrew Kelley 10541c8fc8 Merge branch 'lazy-sizeof' 2019-08-29 22:44:21 -04:00
Andrew Kelley e9a4bcbcc6 fix regressions 2019-08-29 22:44:07 -04:00
Andrew Kelley 03910925f0 await does not force async if callee is blocking
closes #3067
2019-08-29 21:51:37 -04:00
Andrew Kelley 8e93991634 avoid unnecessarily requiring alignment for array elem pointers 2019-08-29 16:25:58 -04:00
Andrew Kelley 0512beca9d comparing against zero participates in lazy values 2019-08-29 14:46:22 -04:00
Andrew Kelley d9f0446b1f make @sizeOf lazy 2019-08-29 12:43:56 -04:00
Andrew Kelley 94bbb46ca6 fix not fully resolving debug info for structs causing llvm error 2019-08-29 10:29:48 -04:00
Shritesh 834a789bb9 Use LLVM path provided by homebrew 2019-08-29 10:19:35 -04:00
Andrew Kelley e8a9caa3dd add suggestion to AutoHash compile error message 2019-08-28 14:38:55 -04:00
Andrew Kelley af90da1531 fix implicit cast from zero sized array ptr to slice
closes #1850
2019-08-28 12:16:52 -04:00
Andrew Kelley d5b3d97c23 Merge pull request #2760 from Vexu/fmt-comment-fix
Fix non-empty comments getting removed with empty comments
2019-08-28 12:01:08 -04:00