Commit Graph

3539 Commits (5e345ff0ee9eb70d7f5f7167227f6a1e8903f428)

Author SHA1 Message Date
Andrew Kelley 3af2202ea4
add -I command line parameter, same as clang 2019-10-16 15:51:13 -04:00
Andrew Kelley 10f6176f3d
only look for .defs when needed; remove samsrv.dll cross compiling support
previously zig would look for all the .defs even when not needed,
wasting time. also, we only had samsrv definitions for some architectures.
remove cross compiling support for this.
2019-10-16 13:12:35 -04:00
Andrew Kelley 5bfea3f1ea
add more cross compiling support for windows system dlls 2019-10-16 12:43:57 -04:00
Andrew Kelley f81d9d2c84
add cross compiling support for opengl32.dll 2019-10-16 12:16:35 -04:00
Andrew Kelley 1014cfdf3b
generated docs: progress towards generic types being useful
See #3406
2019-10-16 01:49:02 -04:00
Andrew Kelley 9050cd847a
fix non-byte-aligned packed struct field...
...passed as generic fn parameter causing invalid LLVM IR.

closes #3460
2019-10-15 18:00:16 -04:00
Andrew Kelley f7f3dedb1d
Merge pull request #3436 from LemonBoy/unpatch-lld
Assemble lib files using LLVM tools instead of lld
2019-10-13 17:55:36 -04:00
LemonBoy 22e60df680 Propagate user-defined function alignment to LLVM IR 2019-10-13 14:19:36 +02:00
LemonBoy 2b624fea84 Add dlltool functionality
Don't need no patched lld --kill-at behaviour now.
2019-10-12 10:56:16 +02:00
Andrew Kelley 8b45921664
merge targets of generated docs 2019-10-11 18:14:06 -04:00
Andrew Kelley 30a555eed4
merge dumps tool: merging ast nodes
-fgenerate-docs is replaced ith -femit-docs
-fno-emit-bin is added to prevent outputting binary
2019-10-11 18:13:24 -04:00
LemonBoy 8aa20227ed Fix cross-compilation to i386-windows-msvc
Use Mingw's .def files to build a .lib when possible and show an error
otherwise.
2019-10-11 15:52:55 -04:00
Andrew Kelley 7b20205e68
codegen.cpp: remove unused variable 2019-10-10 21:24:44 -04:00
Andrew Kelley 0e0976828a
Merge pull request #3421 from LemonBoy/win32-mingw
Win32 mingw
2019-10-10 21:23:28 -04:00
Andrew Kelley 6082c14753
generated docs: add optional type support 2019-10-10 20:32:17 -04:00
Andrew Kelley fa47172841
better debug info for integers
now we use ABI size * 8 instead of size_in_bits which makes
gdb work instead of hang
2019-10-10 19:22:15 -04:00
LemonBoy 6cbb732b59 Extern unions should not trigger active field check
Fixes #3378
2019-10-10 13:57:48 -04:00
Andrew Kelley 78d06ec4af
Merge branch 'docs-union-enum' of https://github.com/Vexu/zig into Vexu-docs-union-enum 2019-10-10 13:36:37 -04:00
Andrew Kelley b9d63551de
Merge pull request #3420 from FireFox317/generated-docs-improvements
Generated docs: add parameter names to functions
2019-10-10 10:34:44 -04:00
Michael Dusan 3464351d1e stage1: fix ir_resolve_str() to return slice
`ir_resolve_str()` bug returns array expression even when when sliced
to a lesser length. Fix is to return array if slice.len == array.len,
otherwise return slice.

Bug report use-case is based on one builtin function. However, at least
the following builtins were exposed to the bug:

    `@byteOffsetOf`
    `@cDefine`
    `@cImport`
    `@cInclude`
    `@cUndef`
    `@compileError`
    `@embedFile`
    `@export`
    `@fieldParentPtr`
    `@hasDecl`
    `@hasField`
    `@import`
    `@unionInit`

closes #3384
2019-10-10 10:20:04 -04:00
Timon Kruiper e34e3344d4 Generated docs: Add function paramater names 2019-10-10 15:23:24 +02:00
Timon Kruiper 4250d27fe5 Generated docs: store static container info in a containerDecl astNode
And then get the struct field astNodes through the containerDecl astNode.
The type of a struct field is still stored in the types array, but the
static information is in the astNodes.
2019-10-10 14:21:35 +02:00
LemonBoy 86e5bbffd7 Patch lld to have a more sensible kill-at implementation
Lift some code from llvm-dlltool, the lld code is meant to follow what
gnu ld does but that's not much useful for our purposes.

Also use the `--kill-at` option when generating the .lib files out of
mingw's .def files: this way our building process closely matches the
one use by the upstream and now finally generates files that allow both
C code and Zig code to link.
2019-10-10 09:38:57 +02:00
Vexu 2b55484f3f
implement doc generation for union and enum 2019-10-10 10:27:12 +03:00
Andrew Kelley 000a1df4a3
generated docs: add array type support
See #3404
2019-10-09 18:22:46 -04:00
Michael Dusan 42f2814d9a stage1: fix root top-level-struct typename
- during diagnostics the string representation for root was empty
  and now is `(root)`
- retrofitted all other namespace-qualified type naming to elide
  prefixing with root

closes #2032
2019-10-09 17:36:13 -04:00
LemonBoy b96fa89462 Compile the architecture-specific mingw sources 2019-10-09 22:44:36 +02:00
LemonBoy 9ae293ae3b Remove x86/Windows name mangling hack
Let's fix this properly by generating the correct lib files from the
mingw sources.
2019-10-09 22:44:36 +02:00
Andrew Kelley e0ab685467
generated docs: more verbose fields
also prevent docs making hyperlinks for integer types
2019-10-09 16:31:20 -04:00
Andrew Kelley a5714ddb97
add comments about why we choose pentium4 for i386 target
See #3389
2019-10-09 15:06:37 -04:00
Andrew Kelley 2286003666
improve names of error sets when using merge error sets operator 2019-10-09 13:35:19 -04:00
Andrew Kelley 406b70aa56
Merge pull request #3390 from nrdmn/unicode_character_literals
unicode character literals
2019-10-09 13:25:41 -04:00
Andrew Kelley f929a58d5f
Merge pull request #3389 from LemonBoy/win32
Win32
2019-10-09 13:22:16 -04:00
Andrew Kelley e0f0e2aace
generated docs: error sets in fn docs 2019-10-08 18:09:08 -04:00
Timon Kruiper f74c29b49a Add initial support for struct fields in the docs 2019-10-08 17:29:03 -04:00
Christine Dodrill 1e59eb3c94 src/main: minor grammar fix in the help for `zig builtin` 2019-10-08 15:14:10 -04:00
Andrew Kelley 784a493dc7
generated docs: functions with inferred error sets display nicely
infrastructure in place for displaying error sets
2019-10-08 13:41:13 -04:00
Andrew Kelley 03a6b33a73
generated docs: bool type and fix error for some fns 2019-10-08 11:59:55 -04:00
Andrew Kelley 6814d6b332
generated docs: function parameters have links 2019-10-08 11:52:06 -04:00
Andrew Kelley a55db08a7b
generated docs contain generic instantiations and comptime calls 2019-10-08 00:15:16 -04:00
Andrew Kelley 2ccb48ddc3
generated docs: show doc comments on functions 2019-10-07 12:21:11 -04:00
Nick Erdmann ae7392e504
unicode character literals 2019-10-07 08:18:16 +02:00
Andrew Kelley 8e2c441b2e
stage1 parser supports doc comments 2019-10-06 16:39:27 -04:00
Andrew Kelley 86171afb9b
generated docs: docs/ instead of doc/
This appears to be more of a standard directory name.

See #21
2019-10-06 14:48:01 -04:00
LemonBoy 93a49076f7 Initial support for i386-windows-msvc target 2019-10-06 14:27:36 +02:00
Andrew Kelley 0e40fc46d1
generated docs: show public stuff only 2019-10-05 16:38:42 -04:00
Michael Dusan a82c6453c1
Merge pull request #3368 from mikdusan/issue.3367
fix: container member access `usingnamespace` decls fails
2019-10-05 15:47:07 -04:00
Michael Dusan a23a022820
fix container member access for fn/struct-fn
- decls brought in via `usingnamespace` were not always found
  because lookup was performed directly against decl_table and
  use_decls was never consulted
- fix to use find_container_decl() path instead
- closes #3367
2019-10-05 14:09:09 -04:00
Andrew Kelley dca6e74fec proof of concept of stage1 doc generation
This commit adds `-fgenerate-docs` CLI option, and it outputs:
 * doc/index.html
 * doc/data.js
 * doc/main.js

In this strategy, we have 1 static html page and 1 static javascript
file, which loads the semantic analysis dump directly and renders it
using dom manipulation.

Currently, all it does is list the declarations. But there is a lot more
data available to work with. The next step would be making the
declarations hyperlinks, and handling page navigation.

Another strategy would be to generate a static site with no javascript,
based on the semantic analysis dump that zig now provides. I invite the
Zig community to take on such a project. However this version which
heavily relies on javascript will also be a direction explored.

I also welcome contributors to improve the html, css, and javascript of
what this commit started, as well as whatever improvements are necessary
to the static analysis dumping code to provide more information.

See #21.
2019-10-04 20:18:06 -04:00
Michael Dusan 81c6bd37aa stage1: fix compile error on macOS Xcode 11.1 2019-10-04 01:33:31 -04:00
Andrew Kelley 071af5c1d6
fix noreturn attribute for msvc 2019-10-03 22:51:00 -04:00
Andrew Kelley 39d47b2c51
handle when std lib is unused 2019-10-03 18:05:44 -04:00
Andrew Kelley 59ac7b91da
add -fdump-analysis to dump type information to json
This commit adds -fdump-analysis which creates
a `$NAME-analysis.json` file with all of the finished
semantic analysis that the stage1 compiler produced.
It contains types, packages, declarations, and files.

This is an initial implementation; some data will be
missing. However it's easy to improve the implementation,
which is in `src/dump_analysis.cpp`.

The next step for #21 will be to create Zig code which parses
this json file and creates user-facing HTML documentation.

This feature has other uses, however; for example, it could
be used for IDE integration features until the self-hosted
compiler is available.
2019-10-03 17:58:22 -04:00
Andrew Kelley a7c9aa7ddb
finish conversion of translate_c.cpp to use zig_clang.h
See #1964

translate_c.cpp now exclusively uses the clang API via zig_clang.h

shaves off 5 seconds from building zig when translate_c.cpp
(or any h files it uses) change.
2019-10-02 19:21:40 -04:00
Andrew Kelley f84086132f
more conversion of translate_c.cpp to use zig_clang.h
Progress: 96%

See #1964
2019-10-02 02:02:31 -04:00
Andrew Kelley a8d6954c23
fix tripping LLVM assertion in const unions 2019-10-01 17:41:03 -04:00
Andrew Kelley c1a05f0581
translate-c: make trans_implicit_cast_expr use zig_clang.h
See #1964
2019-10-01 17:33:11 -04:00
Andrew Kelley 339f621735 detect the shared windows include dir as well 2019-09-29 14:12:06 -04:00
Andrew Kelley c8e967f43d
detect the windows um include directory 2019-09-29 14:04:23 -04:00
Andrew Kelley bd46c1c328
RISC-V: get to the linking phase of behavior tests
See #3338 and #3339
2019-09-29 12:21:22 -04:00
Andrew Kelley 543e729398
Merge pull request #3331 from meme/android-ndk
Support Android NDK
2019-09-28 13:30:19 -04:00
meme 030abfa0d2 minor tweaks 2019-09-28 13:21:29 -04:00
meme 0c556095f4 do not link against gcc runtime on Android target 2019-09-28 12:48:13 -04:00
Andrew Kelley ce0e794092
fix glibc builds on aarch64-linux-gnu
There was a missing include path in the compilation line, leading to
incorrect fstat ABI.

closes #3291
2019-09-27 18:19:21 -04:00
Andrew Kelley 579301c2af
avoid duplicated code of specifying the default glibc version 2019-09-27 17:39:11 -04:00
meme 308e7d5314 fix building static Android executables 2019-09-27 17:33:07 -04:00
meme f7bf61a983 support Android NDK and bionic 2019-09-27 16:51:42 -04:00
Andrew Kelley 09575bc0d6
fully specify padding bytes when necessary
This is what I was going for originally - either we understand that
LLVM's padding is sufficient, or we do the entire padding ourselves.
2019-09-27 15:53:30 -04:00
LemonBoy 67bd0267db
Correct calculation of padding length in struct
Make sure the resulting type is in-sync with the one produced and used
by LLVM.

Fixes #3138
2019-09-27 15:39:19 -04:00
Andrew Kelley 4d65373a3d
Merge pull request #3311 from LemonBoy/mips
Initial support for mipsel architecture
2019-09-26 13:44:36 -04:00
LemonBoy 2c8864f634 Don't warn about redeclaration for the same var node
Closes #3316
2019-09-26 13:39:09 -04:00
LemonBoy c8e4108c5b Export _start as __start for MIPS targets 2019-09-26 17:13:57 +02:00
LemonBoy 4ebcf64864 Initial support for mipsel architecture¬ 2019-09-26 09:31:55 +02:00
Andrew Kelley 4637e8f969
zig additionally looks for lib/std/std.zig
previously zig would search up directory parents for
lib/zig/std/std.zig. It still does that, but now it also accepts
lib/std/std.zig. This will probably be how we start shipping windows
.zip files, since the extra directory is pointless.

It also means you can run zig binaries from subdirectories of the zig
source tree without lib files being installed.
2019-09-26 00:30:51 -04:00
Andrew Kelley dc7016344e
remove --override-std-dir. fix issues caused by moving std lib 2019-09-25 23:59:07 -04:00
Andrew Kelley 40e77dad83
musl [PATCH] arm: fix setjmp and longjmp asm for armv8-a
From: Szabolcs Nagy <szabolcs.nagy@arm.com>

armv8 removed the coprocessor instructions other than cp14, so
on an armv8 system the related hwcaps should never be set.

new llvm complains about the use of coprocessor instructions in
armv8-a mode (even though they are never executed at runtime),
so ifdef them out when musl is built for armv8.

<dalias> i think the patch looks ok
2019-09-25 15:15:52 -04:00
Andrew Kelley c9690916e5
fix building musl on eabihf abis, incorrect include dirs
See #3286. The issue is not fully solved however because this has
uncovered another issue.
2019-09-25 14:03:26 -04:00
Andrew Kelley 53210b2304
better default enabled features for riscv
Until ability to specify target CPU features (#2883) is done, this
commit gives riscv target better default features.

This side-steps #3275 which is a deficiency in compiler-rt when features
do not include 32 bit integer division.

With this commit, RISC-V compiler-rt tests pass and Hello World works
both pure-zig and with musl libc.
2019-09-24 20:56:04 -04:00
Michael Dusan 9983501ff2 add VarDecl support for struct-method call syntax
implements #3306
2019-09-24 19:24:48 -04:00
LemonBoy 5fb7af26ab
Fix result loc unwrapping with optional in error union
Fixes #2899
2019-09-24 01:09:26 -04:00
LemonBoy 93367adaa7
Fix assignment to optional payload
Closes #3081
2019-09-24 00:31:35 -04:00
Jay Weisskopf 0bdc85181c Create user-specified `output-dir`
Fixes #2637
2019-09-24 00:20:29 -04:00
LemonBoy 663e665843
Prevent crash with invalid extern type
Fixes #3240
2019-09-23 17:30:28 -04:00
LemonBoy db988f42a7 Fix computation of switch coverage
Closes #3258
2019-09-23 16:13:28 -04:00
Andrew Kelley 53ae03ebe9
make type_allowed_in_extern more robust
Previously if the type parameter was a pointer, it would assert that the
size of the type was resolved. It used to be that the size of pointers was
always resolved, however with lazy values, pointers gained the
possibility of not having their size resolved.

Now, type_allowed_in_extern triggers the resolution of whether a pointer
is zero bits, and returns a possible error if the resolution fails.

This fixes a compiler assertion when building the
[zootdeck project](https://github.com/donpdonp/zootdeck). I do not have
a test case reduction for the issue.
2019-09-23 15:02:38 -04:00
Andrew Kelley 29b82d20a4 zig build: linkSystemLibrary integrates with pkg-config
* add -D CLI option for setting C macros
 * add std.ascii.allocLowerString
 * add std.ascii.eqlIgnoreCase
 * add std.ascii.indexOfIgnoreCasePos
 * add std.ascii.indexOfIgnoreCase
2019-09-23 14:45:14 -04:00
Andrew Kelley d6f7b573aa silence nonportable include path warnings when building glibc on windows 2019-09-22 18:15:30 -04:00
Andrew Kelley f14ba904d7
tolerate windows newlines in glibc text files 2019-09-22 18:14:53 -04:00
Andrew Kelley a239c7439f
more helpful error message when failing to parse glibc abi.txt 2019-09-22 17:41:15 -04:00
Andrew Kelley 31b72da84a
more info in assertion failures 2019-09-22 16:40:48 -04:00
Andrew Kelley 1d6d6d5228
remove redundant assert 2019-09-22 15:58:57 -04:00
Andrew Kelley ffef5d26b6
significantly increase test coverage
* add zig build option `-Dskip-libc` to skip tests that build libc
   (e.g. if you don't want to wait for musl to build)
 * add `-Denable-wine` option which uses wine to run cross compiled
   windows tests on non-windows hosts
 * add `-Denable-qemu` option which uses qemu to run cross compiled
   foreign architecture tests
 * add `-Denable-foreign-glibc=path` option which combined with
   `-Denable-qemu` enables running cross compiled tests that link
   against glibc. See
   https://github.com/ziglang/zig/wiki/Updating-libc#glibc for how to
   produce this directory.
 * the test matrix is done manually. release test builds are only
   enabled by default for the native target. this should save us some CI
   time, while still providing decent coverage of release builds.
   - add test coverage for `x86_64-linux-musl -lc` (building musl libc)
   - add test coverage for `x86_64-linux-gnu -lc` (building glibc)
   - add test coverage for `aarch64v8_5a-linux-none`
   - add test coverage for `aarch64v8_5a-linux-musl -lc` (building musl libc)
   - add test coverage for `aarch64v8_5a-linux-gnu -lc` (building glibc)
   - add test coverage for `arm-linux-none`
   - test coverage for `arm-linux-musleabihf -lc` (building musl libc) is
     disabled due to #3286
   - test coverage for `arm-linux-gnueabihf -lc` (building glibc) is disabled
     due to #3287
   - test coverage for `x86_64-windows-gnu -lc` (building mingw-w64) is
     disabled due to #3285
 * enable qemu testing on the Linux CI job. There's not really a good
   reason to enable wine, since we have a Windows CI job as well.
 * remove the no longer needed `--build-file ../build.zig` from CI
   scripts
 * fix bug in glibc compilation where it wasn't properly reading the abi
   list txt files, resulting in "key not found" error.
 * std.build.Target gains:
   - isNetBSD
   - isLinux
   - osRequiresLibC
   - getArchPtrBitWidth
   - getExternalExecutor
 * zig build system gains support for enabling wine and enabling qemu.
   `artifact.enable_wine = true;`, `artifact.enable_qemu = true;`. This
   communicates that the system has these tools installed and the build
   system will use them to run tests.
 * zig build system gains support for overriding the dynamic linker of
   an executable artifact.
 * fix std.c.lseek prototype. makes behavior tests for
   arm-linux-musleabihf pass.
 * disable std lib tests that are failing on ARM. See #3288, #3289
 * provide `std.os.off_t`.
 * disable some of the compiler_rt symbols for arm 32 bit. Fixes
   compiler_rt tests for arm 32 bit
 * add __stack_chk_guard when linking against glibc. Fixes std lib tests
   for aarch64-linux-gnu
 * workaround for "unable to inline function" using `@inlineCall`. Fixes
   compiler_rt tests for arm 32 bit.
2019-09-22 11:22:17 -04:00
Michael Dusan c5716715d5 stage1: fix lost argv[0]
- bug presented on FreeBSD when `/proc` filesystem is not mounted
- bogus `cc` was used as exename, causing incorrect executable spawn
- llvm::sys::fs::getMainExecutable() has platform-specific code
  to get exename and fallback is to use param argv0
- linux fallback is rare because `/proc` is usually mounted
- *BSD fallback is not rare because `/proc` is often not mounted
- macOS doesn't ever fallback: bug cannot present
- windows doesn't ever fallback: bug cannot present
- other Posix will always present
2019-09-22 11:21:22 -04:00
Andrew Kelley 4dd17a7c9e
zig test: don't skip execution when explicit command provided 2019-09-21 15:57:09 -04:00
Andrew Kelley 2c681d7ba1
add behavior test for float widening f16 to f128
it's disabled on aarch64, see #3282
2019-09-21 14:22:23 -04:00
Andrew Kelley f3a7c346dd
Merge pull request #3278 from LemonBoy/struct-gen
A few steps towards AArch64 & ARM passing the behavior tests
2019-09-21 13:46:13 -04:00
LemonBoy 093ffe9f16 Correct stack alignment for new stack 2019-09-21 11:39:50 +02:00
LemonBoy 75ec7e4e00 Fix generation of tail fields for packed struct 2019-09-21 11:39:43 +02:00
Andrew Kelley 3377044ebe
Merge pull request #3183 from LemonBoy/fix-3128
Don't forget to resolve the pointee type
2019-09-20 18:01:42 -04:00
Andrew Kelley 257fded70c
avoid setting `tail` for `@panic`
Currently, slices are passed via reference, even though it would be
better to pass the ptr and len as separate arguments (#561). This means
that any function call with a slice parameter cannot be a tail call,
because according to LLVM spec:

> Both [tail,musttail] markers imply that the callee does not access
> allocas from the caller

There was one other place we were setting `tail` and I made that
conditional on whether or not the argument referenced allocas in the
caller.

This was causing undefined behavior in the compiler when it hit asserts,
causing it to print garbage memory to the terminal. See #3262 for
example.
2019-09-20 17:48:24 -04:00
Sahnvour 74d0b5bf7c reject types of automatic container layout in packed unions 2019-09-20 13:25:32 -04:00
Timon Kruiper 3b4a6679a6 Fix comptime bitcast inside an expression 2019-09-20 13:13:26 -04:00
Michael Dusan d60f9d0d4b stage1: fix gcc 9.1.0 compiler error on archlinux 2019-09-19 23:30:48 -04:00
Andrew Kelley 8a30edcde8
Merge remote-tracking branch 'origin/master' into llvm9 2019-09-19 17:02:32 -04:00
daurnimator 3b297f58f7 src: use zig_panic rather than having LLVM abort 2019-09-19 11:51:39 -04:00
ScorrMorr 7ebb7ca580 pass param as ref in ZigList::append 2019-09-19 11:41:18 -04:00
Andrew Kelley 005a54a853
fixups for `@splat`
* Fix codegen for splat - instead of giving vectors of length N
   to shufflevector for both of the operands, it gives vectors of length
   1. The mask vector is the only one that needs N elements.
 * Separate Splat into SplatSrc and SplatGen; the `len` is not needed
   once it gets to codegen since it is redundant with the result type.
 * Refactor compile error for wrong vector element type so that the
   compile error message is not duplicated in zig source code
 * Improve implementation to correctly handle comptime values such as
   undefined and lazy values.
 * Improve compile error for bad vector element type to point to the
   correct place.
 * Delete dead code.
 * Modify behavior test to use an array cast instead of vector element
   indexing since I'm merging this splat commit out-of-order from
   Shawn's patch set.
2019-09-19 10:58:12 -04:00
Shawn Landden 01577a3af4
`@splat` 2019-09-19 10:11:06 -04:00
Andrew Kelley 380c8ec2c9
implement runtime `@byteSwap` and other fixups
* update docs for `@byteSwap`.
 * fix hash & eql functions for ZigLLVMFnIdBswap not updated to
   include vector len. this was causing incorrect bswap function
   being called in unrelated code
 * fix `@byteSwap` behavior tests only testing comptime and not
   runtime operations
 * implement runtime `@byteSwap`
 * fix incorrect logic in ir_render_vector_to_array and
   ir_render_array_to_vector with regards to whether or not to bitcast
 * `@byteSwap` accepts an array operand which it will cast to vector
 * simplify `@byteSwap` semantic analysis code and various fixes
2019-09-19 00:59:04 -04:00
Shawn Landden 76f5396077
@byteSwap on vectors 2019-09-18 16:49:14 -04:00
Andrew Kelley 2038f4d45a
rework the implementation
* update documentation
   - move `@shuffle` to be sorted alphabetically
   - remove mention of LLVM
   - minor clarifications & rewording
 * introduce ir_resolve_vector_elem_type to avoid duplicate compile
   error message and duplicate vector element checking logic
 * rework ir_analyze_shuffle_vector to solve various issues
 * improve `@shuffle` to allow implicit cast of arrays
 * the shuffle tests weren't being run
2019-09-18 16:15:19 -04:00
Shawn Landden 193604c837
stage1: add @shuffle() shufflevector support
I change the semantics of the mask operand, to make it a little more
flexible. There is no real danger in this because it is a compile-error
if you do it the LLVM way (and there is an appropiate error to tell you
this).

v2: avoid problems with double-free
2019-09-18 11:26:45 -04:00
Andrew Kelley 9e4065fa73
remove TODO regarding lazy values
The question was:

> // TODO do we need lazy values on vector comparisons?

Nope, in fact the existing code already was returning ErrorNotLazy
for that particular type, and would already goto
never_mind_just_calculate_it_normally. So the explicit check for
ZigTypeIdVector is not needed. I appreciate the caution though.
2019-09-18 10:54:45 -04:00
Shawn Landden 74ce5e9e13
stage1: proper return type on vector comparisons 2019-09-18 10:36:10 -04:00
Andrew Kelley 558b4ac1f0
adjust codegen of casting between arrays and vectors
* bitcasting is still better when the size_in_bits aligns with the ABI
   size of the element type. Logic is reworked to do bitcasting when
   possible
 * rather than using insertelement/extractelement to work with arrays,
   store/load elements directly. This matches codegen for arrays
   elsewhere.
2019-09-18 10:24:28 -04:00
Shawn Landden 0e3ca4c63e
Fix array->vector and vector->array for many types. Allow vector of bool.
Vectors do not have the same packing as arrays, and just bitcasting
is not the correct way to convert them.
2019-09-18 09:52:58 -04:00
Andrew Kelley 914ad1ec2e
fix peer result location with typed parent, ...
...runtime condition, comptime prongs.

closes #3244
2019-09-17 22:30:49 -04:00
Andrew Kelley c6e77f248d
fix tripping llvm assert
```
Assertion `!isa<DIType>(Scope) && "shouldn't
make a namespace scope for a type"
```

We've had this problem and solved it before; see #579.
2019-09-16 14:31:41 -04:00
Andrew Kelley 5e34fb3597
fix tripping llvm assert
```
Assertion `!isa<DIType>(Scope) && "shouldn't
make a namespace scope for a type"
```

We've had this problem and solved it before; see #579.
2019-09-16 14:02:00 -04:00
Jay Weisskopf cddd6b46d8 Fix typos: "seperate" to "separate"
Fixes #3236
2019-09-15 23:39:36 -04:00
Andrew Kelley c4416b224d
Merge remote-tracking branch 'origin/master' into llvm9 2019-09-15 20:59:53 -04:00
Andrew Kelley 8223aca09b
no-stack-arg-probe only for UEFI 2019-09-13 14:46:22 -04:00
Andrew Kelley 2b698888ce
fix regression from incorrect conflict resolution in prev commit
thanks for catching this LemonBoy
2019-09-13 14:42:30 -04:00
Andrew Kelley c15e464320
Merge branch 'uefi' of https://github.com/nrdmn/zig into nrdmn-uefi 2019-09-13 14:10:42 -04:00
LemonBoy eb7d36ae0d Make single-element enum default to u0
* Allow comptime_int as explicit enum tag type

Closes #2997
2019-09-13 15:13:10 -04:00
Andrew Kelley cf4bccf765
improvements targeted at improving async functions
* Reuse bytes of async function frames when non-async functions
   make `noasync` calls. This prevents explosive stack growth.
 * Zig now passes a stack size argument to the linker when linking ELF
   binaries. Linux ignores this value, but it is available as a program
   header called GNU_STACK. I prototyped some code that memory maps
   extra space to the stack using this program header, but there was
   still a problem when accessing stack memory very far down. Stack
   probing is needed or not working or something. I also prototyped
   using `@newStackCall` to call main and that does work around the
   issue but it also brings its own issues. That code is commented out
   for now in std/special/start.zig. I'm on a plane with no Internet,
   but I plan to consult with the musl community for advice when I get a
   chance.
 * Added `noasync` to a bunch of function calls in std.debug. It's very
   messy but it's a workaround that makes stack traces functional with
   evented I/O enabled. Eventually these will be cleaned up as the root
   bugs are found and fixed. Programs built in blocking mode are
   unaffected.
 * Lowered the default stack size of std.io.InStream (for the async
   version) to 1 MiB instead of 4. Until we figure out how to get
   choosing a stack size working (see 2nd bullet point above), 4 MiB
   tends to cause segfaults due to stack size running out, or usage of
   stack memory too far apart, or something like that.
 * Default thread stack size is bumped from 8 MiB to 16 to match the
   size we give for the main thread. It's planned to eventually remove
   this hard coded value and have Zig able to determine this value
   during semantic analysis, with call graph analysis and function
   pointer annotations and extern function annotations.
2019-09-12 01:40:58 -04:00
LemonBoy f36b8fd7b2 Recognize & skip the UTF-8 BOM 2019-09-11 15:20:18 -04:00
Andrew Kelley c9b2210fcf
async function calls re-use frame buffers
See #3069
2019-09-10 22:59:00 -04:00
Andrew Kelley 92a427437c
Merge remote-tracking branch 'origin/master' into llvm9 2019-09-10 16:53:11 -04:00
stratact a165cc0535 Get more of the tests passing for FreeBSD (#3197)
* Add missing <stdint.h> include for uint8_t type declaration

* Add needed FreeBSD check to link to libpthread

* Apply patch to enable more tests in the FreeBSD CI
2019-09-10 14:50:54 -04:00
Michael Dusan 68d159ea9d fix build on macOS + xcode + clang 2019-09-10 14:38:39 -04:00
LemonBoy 8b5cb8df99 Don't forget to resolve the pointee type
Fixes #3128
2019-09-10 19:07:04 +02:00
Andrew Kelley 185cb13278
Merge remote-tracking branch 'origin/master' into llvm9 2019-09-10 13:00:35 -04:00
LemonBoy ba4d83af3e Resolve lazy arguments passed to @compileLog
Closes #3193
2019-09-10 11:22:40 -04:00
LemonBoy e2c68fce89 Accept void argument for @cDefine value
Closes #2612
2019-09-10 11:16:50 -04:00
Andrew Kelley ff051f8f5d
-fstack-report outputs JSON
See #3069
2019-09-10 10:26:54 -04:00
Andrew Kelley 0489d06c24
make the std lib support event-based I/O
also add -fstack-report
2019-09-10 10:26:52 -04:00
LemonBoy 8fbae77770
Force LLVM to generate byte-aligned packed unions
Sometimes the frontend and LLVM would disagree on the ABI alignment of a
packed union. Solve the problem by telling LLVM we're gonna manage the
struct layout by ourselves.

Closes #3184
2019-09-10 10:07:32 -04:00
Sahnvour a06f84fcc6 forbid opaque types in function return types 2019-09-10 10:11:49 -04:00
Andrew Kelley 852679c369
fix a var decl in scope preventing for loop spills 2019-09-09 16:44:23 -04:00
Andrew Kelley a3993465fe
Merge pull request #3200 from LemonBoy/eq-tagged-union
Allow comparison between union tag and enum literal
2019-09-09 16:17:45 -04:00
Andrew Kelley f50bfb94b5
fix bad LLVM IR when for target expr needs to be spilled
Also reduce the size of ZigVar in memory by making the name
a `const char *` rather than a `Buf`.
2019-09-09 15:59:16 -04:00
LemonBoy 4b1cd45472 Comptime folding of enum/union comparisons 2019-09-09 19:09:56 +02:00
LemonBoy cc63760587 Allow comparison between union tag and enum literal
Closes #2810
2019-09-09 18:51:13 +02:00
Andrew Kelley f7721ac37c
implement spilling when returning error union async function call
closes #3190
2019-09-09 12:15:39 -04:00
Andrew Kelley 2482bdf22b
release builds of stage1 have llvm ir verification
the stage2 zig code however gets compiled in release mode,
and stripped.
2019-09-09 09:33:33 -04:00
Andrew Kelley 5dde3cd3bd
move logic for propagating framework dirs to zig cc 2019-09-08 15:09:05 -04:00
Gustav Olsson ec13fa3f4a forward framework dirs to embedded clang in addition to linker on osx 2019-09-08 14:46:25 +02:00
Andrew Kelley 229323e13a
fix suspensions inside for loops generating invalid LLVM IR
closes #3076
2019-09-07 17:37:17 -04:00
Andrew Kelley 9a18db8a80
properly spill expressions with async function calls 2019-09-07 00:27:45 -04:00
Andrew Kelley d1a98ccff4
implement spills when expressions used across suspend points
closes #3077
2019-09-07 00:13:12 -04:00
Andrew Kelley 9ca8d9e21a
fix await used in an expression generating bad LLVM 2019-09-07 00:13:12 -04:00
Andrew Kelley 7d303ae861
runtime safety for noasync function calls
See #3157
2019-09-06 13:08:44 -04:00
Andrew Kelley 0a3c6dbda9
implement `noasync` function calls
See #3157
2019-09-05 21:55:32 -04:00
Timon Kruiper ca70ca7e26 Add compiler error when negating invalid type 2019-09-05 15:27:50 -04:00
Andrew Kelley 4a5bc89862
add -l as an alias for --library 2019-09-05 15:17:23 -04:00
Andrew Kelley b564e7ca59
os: raise maximum file descriptor limit
Do a binary search for the maximum RLIMIT_NOFILE.

Patch lifted from node.js commit
6820054d2d42ff9274ea0755bea59cfc4f26f353
2019-09-05 15:09:13 -04:00
Andrew Kelley 2045b4d932
prefer result type casting to peer type resolution
See #2749
2019-09-05 14:56:52 -04:00
Andrew Kelley 8f0df86937
I'm pretty sure `sp` is the stack pointer on all ARM 2019-09-05 14:15:39 -04:00
Timon Kruiper 866c253e0e
Add compile error when shifting amount is not an int type 2019-09-05 13:10:39 -04:00
LemonBoy 8e3c56b912
Always resolve the struct field types
Packed structs used to skip the zero-sized types and trip some
assertions that expected the type reference not to be null.

Fixes #3143
2019-09-05 13:07:04 -04:00
LemonBoy 0107b19124 Resolve lazy values when checking for definedness
Fixes #3154
2019-09-05 13:09:43 -04:00
Jonathan Marler 9a358d2d33 Add Array support to @Type 2019-09-05 13:08:45 -04:00
Michael Dusan fe153ad2a4 stage1 enhance IR print
- print fn name in pass1
- replace scalar with enum IrPass for clarity
2019-09-05 13:06:10 -04:00
LemonBoy fabf45f5fc Add the noinline keyword for function declarations 2019-09-05 13:04:58 -04:00
Timon Kruiper e540e5b8ec
Implicit cast from enum literal to optional enum and implicit cast to payload of error union 2019-09-04 12:30:23 -04:00
Andrew Kelley ac7703f65f
fixups and add documentation for `@Type` 2019-09-04 11:12:14 -04:00
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
Sahnvour ce14c543d1 error message and test for alignment of variables of zero-bit types 2019-09-03 21:14:40 -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
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
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
Andrew Kelley 058050f22c
Merge remote-tracking branch 'origin/master' into llvm9 2019-09-02 20:56:31 -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 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 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
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
Andrew Kelley f7f8692730
fix not fully resolving debug info for structs causing llvm error 2019-08-29 10:24:24 -04:00
Andrew Kelley 928ce5e326
Merge remote-tracking branch 'origin/master' into llvm9 2019-08-28 16:59:35 -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 7139eef4cf
implement lazy values for error union types
closes #3129
2019-08-28 11:17:20 -04:00
Andrew Kelley f4519c520a
support self-referential struct through a slice of optional
by making optionals even more lazy

closes #1805
2019-08-27 16:55:58 -04:00
Andrew Kelley 428a2fdedd
better handle struct depends on itself via optional field
closes #1995
2019-08-27 13:59:18 -04:00
Andrew Kelley 35a374efe0
Merge pull request #3115 from ziglang/fix-field-alignment-kludge
fix field alignment kludge by implementing lazy values
2019-08-27 13:02:31 -04:00
Andrew Kelley d9ed55f017
fix not properly casting align values
and add check for alignment specified on enum fields
2019-08-27 12:54:50 -04:00
Andrew Kelley 7d34e55a71
add a TODO compile error for union field alignment syntax
See #3125
2019-08-27 10:45:28 -04:00
Andrew Kelley ffac0b02e7
implement and test struct field explicit alignment 2019-08-27 10:14:11 -04:00
Andrew Kelley a2e8ef77e2
fix regression in one of the doc examples 2019-08-26 22:50:12 -04:00
Andrew Kelley db50cf7049
fix more compile error regressions 2019-08-26 22:38:45 -04:00
Andrew Kelley 1df75da918
remove no longer needed gcc8 workaround. add gcc9 workaround
Occasionally LLVM headers generate warnings with newer gcc versions and
since we use -Werror this has to be worked around.
2019-08-26 21:40:44 -04:00
Andrew Kelley bad4b040cc
miscellaneous fixes regarding compile errors 2019-08-26 18:35:36 -04:00
Andrew Kelley ca145a6d5a
fix regression in ir_get_ref 2019-08-26 15:43:39 -04:00
Andrew Kelley ae65c236c5
fix regression with global variable assignment...
...with optional unwrapping with var initialized to undefined
2019-08-26 15:24:24 -04:00
Andrew Kelley d316f70450
fix regression on struct field with undefined type 2019-08-26 14:01:59 -04:00
Andrew Kelley 73a7747a9c
fix some compile error regressions 2019-08-26 12:43:36 -04:00
Andrew Kelley 6569bfc85e
fix some std lib dependency loops 2019-08-26 11:23:25 -04:00
Andrew Kelley e1a4bcbdfd
fix dependency loop errors with zig build 2019-08-26 10:43:07 -04:00
Andrew Kelley ede0c22a67
make `@alignOf` lazily evaluate the target type
this case works now:

```zig
const Foo = struct {
    field: Bar(@alignOf(*Foo)),
};
fn Bar(comptime alignment: u29) type {
    return struct {
        field: *align(alignment) Foo,
    };
}
```
2019-08-26 10:03:30 -04:00
Andrew Kelley b13af0750f
fix assertion tripped instead of reporting compile error 2019-08-25 21:45:11 -04:00
Andrew Kelley 720302a640
fix resolution detection of pointer types 2019-08-25 21:28:16 -04:00
Andrew Kelley a7f3158185
behavior tests passing 2019-08-25 21:16:03 -04:00
Andrew Kelley 64e9b0ee46
make the zero-bit-ness of pointers lazy
this case works now:

```zig
const Foo = struct {
    field: @typeOf(func).ReturnType,
};
fn func(self: *Foo) void {}
```
2019-08-25 20:27:56 -04:00
Andrew Kelley 8f41da2216
fix behavior test regressions with unions 2019-08-25 11:42:19 -04:00
Andrew Kelley fa6c20a02d
hook up unions with lazy values
this case works now:

```zig
const Expr = union(enum) {
    Literal: u8,
    Question: *Expr,
};
```
2019-08-25 11:34:07 -04:00
Jonathan Marler 1b19c28c79 Fix issue 3058: zig build segfault 2019-08-24 10:47:27 -06:00
Andrew Kelley e8bad1e12a
fix regression on `@ptrCast`
this case regressed and now fixed:

```zig
const a: ?*i32 = undefined;
const b: ?*f32 = @ptrCast(?*f32, a);
```
2019-08-23 17:39:56 -04:00
Andrew Kelley 101440c199
add lazy value support for optional types
this case works now:

```zig
const Node = struct {
    node: ?*Node,
};
```
2019-08-23 17:14:51 -04:00
Andrew Kelley f0034495fa
fix regression with simple pointer to self 2019-08-23 15:59:37 -04:00
Andrew Kelley ac4dd9d665
better handling of lazy structs
this case works now:

```zig
const A = struct {
    b_list_pointer: *const []B,
};
const B = struct {
    a_pointer: *const A,
};

const b_list: []B = [_]B{};
const a = A{ .b_list_pointer = &b_list };
const obj = B{ .a_pointer = &a };
```
2019-08-23 15:54:51 -04:00
Andrew Kelley be0a9a7277
pointer types lazily evaluate their element type 2019-08-23 15:05:15 -04:00
Andrew Kelley 1dd658d1d0
allow top level declarations to be lazy
this case now works:

```zig
const A = struct {
    b: B,
};
const B = fn (A) void;
```
2019-08-23 14:07:34 -04:00
Andrew Kelley 20049caaba
add lazy value for fn prototypes
this case now works:

```zig
const Node = struct {
    field: fn (*Node) *Node,
};
```
2019-08-23 13:28:26 -04:00
Andrew Kelley 3865b6ad8f
Merge remote-tracking branch 'origin/master' into fix-field-alignment-kludge 2019-08-23 11:43:37 -04:00
Andrew Kelley ec2f9ef4e8
Merge pull request #3114 from Tetralux/align-on-struct-fields
parsing and rendering of align(N) on struct fields
2019-08-23 11:19:27 -04:00
Jonathan Marler 9322eee80a Encapsulate bigint representation, assert on cast data loss 2019-08-23 11:14:08 -04:00
Tetralux 3ec10ea174
parsing of align(N) on struct fields 2019-08-22 22:58:02 +00:00
Andrew Kelley 79a4b7a236
fix regressions 2019-08-22 18:24:15 -04:00
Andrew Kelley 26b79ac90e
simple self-referential struct is working now 2019-08-22 14:46:26 -04:00
Andrew Kelley 0d6a6c76ea
add missing "referenced here" notes for lazy values 2019-08-22 12:56:35 -04:00
Andrew Kelley 8460d5617c
introduce lazy values
see #2174
2019-08-22 12:08:04 -04:00
Andrew Kelley efdbede7ab
breaking: remove field alignment kludge
This breaks behavior tests as well as compile error notes for generic
function calls. However it introduces better circular dependency compile
errors.

The next step is to add Lazy Values to fix the regressions.
2019-08-21 19:27:51 -04:00
Andrew Kelley ec7d7a5b14
Merge pull request #2991 from emekoi/mingw-ci
mingw improvements
2019-08-21 12:29:42 -04:00
Andrew Kelley 81c441f885
remove incorrect assert regarding 128-bit integers
LLVM incorrectly reports 8 as the alignment of i128 on x86_64 but it
correctly reports 16 as the alignment of i128 on aarch64.

closes #3101
2019-08-20 21:17:57 -04:00
Andrew Kelley 5f3d59f0ac
Merge branch 'master' into llvm9 2019-08-20 19:09:52 -04:00
Timon Kruiper 2addec8ea1
compiler error when variable in asm template cannot be found 2019-08-20 14:11:03 -04:00
Andrew Kelley 3dbed54294
fix @bitCast of packed struct literal
closes #3042
2019-08-19 17:50:37 -04:00
Andrew Kelley 6bc520ab95
solve it a slightly different way
the error handling of result locations is a bit awkward but it should
basically be the same everywhere
2019-08-19 17:35:19 -04:00
Michael Dusan 24deb1a7fe
fix @bitCast segfault with literal array param
closes #3010
2019-08-19 17:24:14 -04:00
Andrew Kelley d067a037cc
fix void array as a local variable initializer
Related: #1767
2019-08-19 15:58:31 -04:00
Andrew Kelley 44fb5275c1
fix array multiplication not setting parent value info
closes #3095
2019-08-19 14:46:12 -04:00
Andrew Kelley 3f7f520036
don't put libc on the elf linker line for objects
closes #3093
2019-08-19 12:33:36 -04:00
Nick Erdmann 5a0275c247 fix error message when dependency requires position independent code 2019-08-18 19:33:25 -04:00
Andrew Kelley ea1734773b
add compile error for async frames depending on themselves 2019-08-17 19:47:49 -04:00
Andrew Kelley 57b90d2d98
allow implicit cast of fn to async fn
it forces the fn to be async. closes #3079
2019-08-17 17:22:20 -04:00
Andrew Kelley 66a490c27c
detect non-async function pointer of inferred async function
closes #3075
2019-08-17 16:49:23 -04:00
Vexu 0ff396c34f add compile error for incorrect atomic ordering in fence #3082 2019-08-17 16:05:41 -04:00
Andrew Kelley 4d8a6f6fea
fix compiler not checking alignment of function frames
closes #3086
2019-08-17 13:04:50 -04:00
Andrew Kelley c39bb3ebc4
target: add missing switch case 2019-08-16 16:52:45 -04:00
Andrew Kelley 6529658ad8
Merge remote-tracking branch 'origin/master' into llvm9 2019-08-16 16:43:56 -04:00
Andrew Kelley bf7b6fbbdb
add missing compile error for fn call bad implicit cast
when the function's return type handle is a pointer but the result
location's result value type handle is not a pointer

closes #3055
2019-08-16 16:30:24 -04:00
Andrew Kelley 5a2cbe239f
fix and test case for returning from suspend block
See #3063
2019-08-16 13:07:07 -04:00
yvt 2cb1f93894 correct LLVM subarch names for arm 2019-08-16 08:46:18 -07: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 cba3b8291a
codegen: LLVMConstSub instead of LLVMBuildSub in one place 2019-08-16 11:19:01 -04:00
Andrew Kelley 1254a453b9
add compile error for @Frame() of generic function
See #3063
2019-08-16 10:44:51 -04:00
Vexu 2151f84d59 implement new async syntax in self-hosted compiler 2019-08-16 06:17:28 -07:00
Andrew Kelley 1e3b6816a8
note that -mllvm is unsupported
closes #3045
2019-08-15 22:57:06 -04:00
Andrew Kelley ff7e826b82
fix crash with sometimes type not being resolved 2019-08-15 18:54:23 -04:00
Andrew Kelley 0b08ae581e
add assertion about control flow to fix gcc warning 2019-08-15 18:38:20 -04:00
Andrew Kelley 55f5cee86b
fix error return traces for async calls of blocking functions 2019-08-15 15:06:05 -04:00
Andrew Kelley 13b5a4bf8c
remove `cancel` 2019-08-15 14:05:12 -04:00
Andrew Kelley 64c293f8a4
codegen for async call of blocking function 2019-08-14 12:52:20 -04:00
Andrew Kelley f3f838cc01
add compile error for await in exported function 2019-08-14 11:22:12 -04:00
Andrew Kelley 5749dc49d8
respect local variable alignment in async functions 2019-08-14 00:35:51 -04:00
Andrew Kelley dd8c8c0802
get_struct_type accepts field alignment overrides 2019-08-13 18:14:38 -04:00
Andrew Kelley 5092634103
avoid the word "coroutine", they're "async functions" 2019-08-13 14:14:19 -04:00
Andrew Kelley 82d4ebe53a
organize TODOs 2019-08-13 13:28:05 -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 8a9289996a
Merge remote-tracking branch 'origin/master' into rewrite-coroutines 2019-08-13 11:39:32 -04:00
Andrew Kelley 98183e4743
flip the order of fields in error unions
to prepare for fixing u128 alignment issues
2019-08-13 11:33:01 -04:00
Andrew Kelley 24d5ec0783
fix async function frames not aligned enough 2019-08-11 22:35:12 -04:00
Andrew Kelley 911b1a0428
fix no-longer-correct `nonnull` attribute on merge err ret traces fn 2019-08-11 22:05:09 -04:00
Andrew Kelley 62c5bc6058
fix cancel invoking branch on undefined memory 2019-08-11 21:14:19 -04:00
Andrew Kelley 4d8d513e16
all tests passing 2019-08-11 19:53:10 -04:00
Andrew Kelley af8c6ccb4b
fix canceling async functions which have error return tracing 2019-08-11 14:26:34 -04:00
Andrew Kelley b87686dfa0
fix enum with one member and custom tag type 2019-08-11 13:43:44 -04:00
Andrew Kelley 1b83ee78a4
allow comptime_int to implicit cast to comptime_float 2019-08-11 12:01:02 -04:00
Nick Erdmann a9b3700c6e
src/codegen: configure stack probes explicitly 2019-08-11 00:29:24 +02:00
Andrew Kelley 77d098e92d
fix returning a const error from async function 2019-08-10 17:23:45 -04:00
Andrew Kelley 22428a7546
fix try in an async function with error union and non-zero-bit payload 2019-08-10 15:20:08 -04:00
Andrew Kelley b9d1d45dfd
fix combining try with errdefer cancel 2019-08-09 21:49:40 -04:00
Andrew Kelley 2e7f53f1f0
fix cancel inside an errdefer 2019-08-09 17:34:06 -04:00
Andrew Kelley 614cab5d68
fix passing string literals to async functions 2019-08-08 19:08:41 -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 bfa1d12fba
better compile errors when frame depends on itself 2019-08-08 13:44:57 -04:00
Andrew Kelley 8be95af480
add compile error for unable to determine async fn frame 2019-08-08 13:07:05 -04:00
Andrew Kelley 8d4cb85285
async functions in single threaded mode do not use atomic ops 2019-08-08 12:30:22 -04:00
Andrew Kelley d813805f77
more debuggable safety for awaiting twice 2019-08-08 12:02:56 -04:00
Andrew Kelley 34bfdf193a
cancel, defer, errdefer all working as intended now 2019-08-08 11:37:49 -04:00
Sam Tebbs 8621e3b5bd Don't emit clang error if source or filename pointer is null 2019-08-07 14:11:18 -07:00
Ryan Saunderson 8fcf21fefc modify header precedence for zig cc, resolves intrinsics issues (#3027) 2019-08-07 10:51:30 -07:00
Andrew Kelley e11cafbd4f
cancel works on non-pointers 2019-08-07 10:56:37 -04:00