Commit Graph

3855 Commits (a983a0a59b348a885f24656a8646707554170574)

Author SHA1 Message Date
Andrew Kelley 073f7ebb0e
fix formatInt to handle upcasting to base int size 2018-09-20 13:46:20 -04:00
Andrew Kelley 9c8dfadbb1
add compile error for casting const array to mutable slice
See #1565
2018-09-20 12:24:51 -04:00
Andrew Kelley f8fe517d12
better string literal caching implementation
We were caching the ConstExprValue of string literals,
which works if you can never modify ConstExprValues.
This premise is broken with `comptime var ...`.

So I implemented an optimization in ConstExprValue
arrays, where it stores a `Buf *` directly rather
than an array of ConstExprValues for the elements,
and then similar to array of undefined, it is
expanded into the canonical form when necessary.
However many operations can happen directly on the
`Buf *`, which is faster.

Furthermore, before a ConstExprValue array is expanded
into canonical form, it removes itself from the string
literal cache. This fixes the issue, because before an
array element is modified it would have to be expanded.

closes #1076
2018-09-20 11:04:31 -04:00
Andrew Kelley 492821781d
add workaround for `llvm-config --system-libs`
not handling static libs correctly
2018-09-19 18:28:50 -04:00
Andrew Kelley f9bf04c38b
travis: build zig with gcc to match what llvm was built with
from #llvm IRC:

<andrewrk> does llvm 7 as a .so have some kind of new initialization
requirement? I'm getting a segfault in llvm::DIBuilder::createFile
(with valid non-null parameters), when linking my frontend against
llvm-7.so but not when linking against llvm .a libraries

<d0k> we have an ABI bug in LLVM 7 when the .so is built with gcc
but your program is build with clang. I'm sorry for that.
2018-09-19 17:15:33 -04:00
Andrew Kelley 287f5cce50
build: fix finding llvm and clang 7 2018-09-19 15:38:36 -04:00
Andrew Kelley e3d8cae35a
travis: fix llvm apt package names 2018-09-19 14:54:32 -04:00
Andrew Kelley 6d23619cce
fix typo from previous commit 2018-09-19 13:53:47 -04:00
Andrew Kelley f418a943cc
travis: fix package names 2018-09-19 13:46:20 -04:00
Andrew Kelley d4cb373024
travis: update apt repo url 2018-09-19 13:25:11 -04:00
Andrew Kelley 69c876cc87
appveyor: remove old cache file 2018-09-19 12:58:58 -04:00
Andrew Kelley 15301504e2
Merge remote-tracking branch 'origin/llvm7' 2018-09-19 12:57:58 -04:00
Christian Wesselhoeft 5eeef1f5ed std/index.zig: Fix import
BufferOutStream is defined in io.zig
2018-09-18 19:01:35 -04:00
Andrew Kelley 6dd93ee5d9
fix regression from previous commit 2018-09-18 18:56:29 -04:00
Andrew Kelley 21328e0036
zig fmt: handle shebang lines
closes #1546
2018-09-18 18:36:39 -04:00
Andrew Kelley 345f8db1c4
fix optional pointer to empty struct incorrectly being non-null
closes #1178
2018-09-18 17:51:50 -04:00
Andrew Kelley 0ab7cfa023
appveyor: use MSVC 2017 2018-09-18 16:36:31 -04:00
Andrew Kelley c1af360532
add compile error for slice.*.len
closes #1372
2018-09-18 16:32:40 -04:00
Andrew Kelley 84b963cb1b
Merge remote-tracking branch 'origin/master' into llvm7 2018-09-18 15:39:05 -04:00
Andrew Kelley 148fe2e999
stage1 caching: don't write manifest until cache release
this prevents the situation where we determine the cache
manifest and write it, but then crash or otherwise error out
before putting the artifacts in the proper place.

now the artifacts will be in place because cache_release
happens after that step is done.
2018-09-18 15:35:03 -04:00
Andrew Kelley 275b4100c0
remove unnecessary setFloatMode calls
Now that Strict is the default, these calls only add noise.
2018-09-18 15:15:03 -04:00
Andrew Kelley 4b2719b51d
Merge remote-tracking branch 'origin/master' into llvm7 2018-09-18 15:05:47 -04:00
Andrew Kelley 8c77c5705f
implementation for bitcasting extern enum type to c_int
closes #1036
2018-09-18 15:00:14 -04:00
Andrew Kelley 5fd3af9dc6
fix implicit cast of packed struct field to const ptr
closes #966
2018-09-18 14:34:30 -04:00
Andrew Kelley 1fc2019031
fix @embedFile reading garbage memory
closes #1547
2018-09-18 10:25:57 -04:00
Andrew Kelley 93ff5024a4
minor cleanups from 68c1d05917 2018-09-18 10:17:48 -04:00
Andrew Kelley d353d5aef8
fix @bytesToSlice on a packed struct
closes #1551
2018-09-18 09:49:57 -04:00
emekoi 68c1d05917 compiling on mingw is now supported (#1542)
* compiles on mingw-w64
* fixed error in os_file_overwrite on windows
* fixed windows hello_world example
2018-09-18 00:13:17 -04:00
Josh Wolfe 13645585fe link to #1544 2018-09-17 21:25:37 -04:00
Josh Wolfe 8f0618a5b1
Merge pull request #1543 from ziglang/bit_shifting
somewhat realistic usecase test for shifting strange integer sizes
2018-09-17 21:07:01 -04:00
Josh Wolfe d7492b2c22 somewhat realistic usecase test for shifting strange integer sizes 2018-09-17 20:49:23 -04:00
Andrew Kelley bfcfaaf5bd
fix codegen for @intCast to u0 2018-09-17 20:33:42 -04:00
Andrew Kelley 15e59eb142
remove deprecated, unused windows functions
* `CryptAcquireContextA`
 * `CryptReleaseContext`
 * `CryptGenRandom`

See https://github.com/ziglang/zig/issues/534#issuecomment-422208368
2018-09-17 20:07:48 -04:00
Andrew Kelley b16229da1d
add compile error for @ptrCast 0 bit type to non-0 bit type 2018-09-17 19:41:11 -04:00
Andrew Kelley 78a9a465a3
add compile error for non-optional types compared against null
closes #1539
2018-09-17 18:58:50 -04:00
Andrew Kelley 6c71e9a54d
fix crash when bit shifting a u1 2018-09-17 18:44:45 -04:00
Andrew Kelley cf9200b815
dereferencing a *u0 is comptime-known to be 0 2018-09-17 18:13:38 -04:00
Andrew Kelley 4c6f1e614a
remove `zig build --init`. add `zig init-lib` and `zig init-exe`
init-lib creates a working static library with tests, and
init-exe creates a working hello world with a `run` target.

both now have test coverage with the new "cli tests" file.

closes #1035
2018-09-17 17:11:18 -04:00
Andrew Kelley 9c9eefc841
allow extern structs to have stdcallcc function pointers
closes #1536
2018-09-17 11:22:30 -04:00
Andrew Kelley dd5b2d1b04
fix crash when pointer casting a runtime extern function 2018-09-16 11:23:38 -04:00
Andrew Kelley a2abdb185f
Merge remote-tracking branch 'origin/master' into llvm7 2018-09-16 10:51:58 -04:00
Andrew Kelley 780e567446
add docs for `@This()` 2018-09-15 10:14:50 -04:00
Andrew Kelley 3f776af3fa
fix alignment of structs
closes #1248
closes #1052
closes #1154
2018-09-14 19:08:59 -04:00
Andrew Kelley 639c381128
fix coroutine alignment
zig returned the wrong alignment for coroutine promises
in some cases
2018-09-14 13:55:45 -04:00
Wink Saville 82af31ce36 Fix additional regressions calling FileOutStream/FileInStream init()
This is caused by change 686663239a and not
fixed in 832caefc2a.
2018-09-14 12:07:21 -04:00
Andrew Kelley 5e39328542
docs: more syntax highlighting 2018-09-14 10:35:03 -04:00
Andrew Kelley 3d38feded9
fix tagged union with all void payloads but meaningful tag
closes #1322
2018-09-14 00:38:22 -04:00
Andrew Kelley 1e03cf1739
fix assertion failure on compile-time `@intToPtr` of function 2018-09-13 19:12:25 -04:00
Andrew Kelley c06a61e9bf
remove `this`. add `@This()`.
closes #1283
2018-09-13 16:34:33 -04:00
Andrew Kelley 7c3636aaa3
remove the scope parameter of setFloatMode
also document that scopes inherit this value. See #367
See #1283
2018-09-13 15:46:34 -04:00