Commit Graph

1393 Commits (85d188537538cdb7929ac05d7960d6b724676d7f)

Author SHA1 Message Date
Andrew Kelley 5eaead6a56
implement allowzero pointer attribute
closes #1953

only needed for freestanding targets.

also adds safety for `@intToPtr` when the address is zero.
2019-03-25 12:55:45 -04:00
Andrew Kelley 3306e43984
add compile error test for invalid enum literal implicit cast
See #683
2019-03-24 18:51:24 -04:00
Andrew Kelley da9d8a6ecf
implement peer type resolution for enum literals
See #683
2019-03-24 18:47:36 -04:00
Andrew Kelley aff7b38838
make switch expressions allow enum literal types
See #683
2019-03-24 01:15:21 -04:00
Andrew Kelley a736dfe6a1
implement implicit cast from enum literal to enum
See #683
2019-03-24 00:55:55 -04:00
Andrew Kelley d0551db5cd
introduce the enum literal type
see #683
2019-03-24 00:44:18 -04:00
Andrew Kelley 64dddd7afe
add compile error for ignoring error
closes #772
2019-03-23 19:33:00 -04:00
Andrew Kelley 6a9c32f759
add regression tests for a bug fixed by an older commit
closes #1914
2019-03-23 19:01:51 -04:00
Andrew Kelley 4d50bc3f8d
add peer type resolution for `*const T` and `?*T`
closes #1298
2019-03-23 18:48:12 -04:00
Andrew Kelley 89953ec83d
character literals: allow unicode escapes
also make the documentation for character literals more clear.
closes #2089

see #2097
2019-03-23 17:35:21 -04:00
Andrew Kelley 3e9697bb35
remove octal and hex floats from the language
closes #2093

This is technically a breaking change but I would be
surprised if anyone was actually using this feature.
2019-03-23 14:04:52 -04:00
Andrew Kelley 4615ed5ea0
float literals now parse using musl's 128 bit float code
fixes float literals not having 128 bit precision
2019-03-22 14:56:03 -04:00
Andrew Kelley 127bb124a0
Merge pull request #2091 from ziglang/bigint-print-fix
Fix bigint_append_buf
2019-03-22 10:23:18 -04:00
Marc Tiehuis a3f42a5fe1 Fix compile-error test case for large integer type 2019-03-23 00:20:03 +13:00
Marc Tiehuis e3b70fe4ba Simplify hex-float parsing code 2019-03-22 17:11:57 +13:00
Andrew Kelley d04a1456df
hex float parsing: solve another case
this works now: 0x1.edcb34a235253948765432134674fp-1
2019-03-21 16:35:18 -04:00
Andrew Kelley af509c68b0
fix parsing of large hex float literals
closes #2083
2019-03-21 16:17:29 -04:00
Andrew Kelley 15c316b0d8
add docs for assembly and fix global assembly parsing
Previously, global assembly was parsed expecting it to have
the template syntax. However global assembly has no inputs,
outputs, or clobbers, and thus does not have template syntax.
This is now fixed.

This commit also adds a compile error for using volatile
on global assembly, since it is meaningless.

closes #1515
2019-03-20 19:00:23 -04:00
Andrew Kelley 3c7555cb67
Merge remote-tracking branch 'origin/llvm8' 2019-03-20 13:34:07 -04:00
Andrew Kelley 2fdf69bc40
Merge pull request #2079 from Sahnvour/issue-2050
Fixes c_ABI tests on windows
2019-03-20 00:11:11 -04:00
Sahnvour d669db7673 c_abi: activate tests on windows 2019-03-19 22:41:27 +01:00
Sahnvour 27d5e1f36c c_abi: add some tests for int and float parameter passing potentially using both registers and stack 2019-03-19 22:09:12 +01:00
Andrew Kelley 85256521ba
fix translate-c regression 2019-03-18 20:09:27 -04:00
Andrew Kelley a581f4f0e2
Merge remote-tracking branch 'origin/master' into llvm8 2019-03-18 20:03:23 -04:00
Andrew Kelley a17bf219c6
Merge pull request #2069 from ziglang/glibc-assert-translation
Implemented enough of translate-c to translate assert
2019-03-18 14:43:17 -04:00
Jimmi Holst Christensen 9171e7a7c1 More work on ignoring values correctly 2019-03-18 14:55:57 +01:00
Andrew Kelley 6abe6dbfe4 enable issue_339 test on macos
closes #1126
2019-03-16 01:18:46 -04:00
Andrew Kelley 6d6195424d
add regression test for invalid multiple dereferences
closes #1042
2019-03-16 00:23:18 -04:00
Andrew Kelley c40448eb9a
add compile error for wrong type with `use`
closes #1557
2019-03-16 00:18:10 -04:00
Andrew Kelley 4a5cd0b895
fix while continue block not checking for ignored expression
closes #957
2019-03-15 23:52:11 -04:00
Andrew Kelley 9c13e9b7ed
breaking changes to std.mem.Allocator interface API
Before, allocator implementations had to provide `allocFn`,
`reallocFn`, and `freeFn`.

Now, they must provide only `reallocFn` and `shrinkFn`.
Reallocating from a zero length slice is allocation, and
shrinking to a zero length slice is freeing.

When the new memory size is less than or equal to the
previous allocation size, `reallocFn` now has the option
to return `error.OutOfMemory` to indicate that the allocator
would not be able to take advantage of the new size.

For more details see #1306. This commit closes #1306.

This commit paves the way to solving #2009.

This commit also introduces a memory leak to all coroutines.
There is an issue where a coroutine calls the function and it
frees its own stack frame, but then the return value of `shrinkFn`
is a slice, which is implemented as an sret struct. Writing to
the return pointer causes invalid memory write. We could work
around it by having a global helper function which has a void
return type and calling that instead. But instead this hack will
suffice until I rework coroutines to be non-allocating. Basically
coroutines are not supported right now until they are reworked as
in #1194.
2019-03-15 17:57:21 -04:00
Jimmi HC 5ae400fb39 fixed void cast and added the last tests 2019-03-15 19:11:46 +01:00
Andrew Kelley 4090fe81f6
Merge pull request #2068 from ziglang/workaround-for-2043
workaround for #2043
2019-03-15 11:19:21 -04:00
Jimmi Holst Christensen a77b2a0810 Implemented enough of translate-c to translate assert
This required the following
* __extention__
* ({})
* Fixing if (0) ; else ;
2019-03-15 16:12:41 +01:00
Jimmi Holst Christensen 3ef9b899e4 workaround for #2043 2019-03-15 11:17:21 +01:00
Andrew Kelley 080dd27157
breaking: fix @typeInfo handling of global error set type
`builtin.TypeInfo.ErrorSet` is now `?[]Error`
instead of `struct{errors:[]Error}`.

closes #1936
2019-03-14 11:57:56 -04:00
Andrew Kelley 20c36949e1
fix target_requires_pic and reloc_mode
disable failing thread local variable test.
see #2063
2019-03-13 23:15:34 -04:00
Andrew Kelley 54edbc6815 Merge remote-tracking branch 'origin/master' into llvm8 2019-03-13 12:56:58 -04:00
LemonBoy 49838a9f3e
Fix generation of comptime slices
By erasing the global_refs field we'd trip any codepath using
const_values_equal_ptr to figure if two slices were different.
2019-03-13 11:35:05 -04:00
Andrew Kelley 761356209b
add test cases to cover switching on u0 values
closes #1563
2019-03-11 19:42:07 -04:00
Sahnvour 9b99356551 translate-c: additional test case for integer suffixes on 0 2019-03-11 16:36:27 -04:00
Andrew Kelley f2ca2ace09
zig build: do a better job of detecting system paths
See #2041
2019-03-11 15:22:05 -04:00
Andrew Kelley 80e5af2be2
Merge pull request #2049 from ziglang/problematic-mtime-detection
stage1 caching system: detect problematic mtimes
2019-03-11 12:47:55 -04:00
Andrew Kelley 9efa18f687 enable C ABI tests on macOS 2019-03-11 12:21:30 -04:00
Andrew Kelley e1fbb24d64
add test for spawning child process with empty environment
thanks to BenoitJGirard for pointing out the child process
implementation needs 3 extra null bytes in #2031
2019-03-11 11:56:08 -04:00
Jimmi Holst Christensen 357813b193
added tests 2019-03-11 10:55:43 -04:00
Andrew Kelley 6a5c2b249d
Revert "use unique test source names for test-gen-h"
This reverts commit 264b03d570.

This workaround is no longer necessary.
2019-03-11 10:35:39 -04:00
Andrew Kelley 4cb55d3af6 Merge remote-tracking branch 'origin/master' into llvm8 2019-03-10 18:07:28 -04:00
Sahnvour fa9fcab620 translate-c: add support for integer suffixes on 0 (zero) litteral inside macro definitions 2019-03-10 14:56:35 -04:00
Andrew Kelley 3cdd2c0bdd Merge remote-tracking branch 'origin/master' into llvm8 2019-03-10 13:48:06 -04:00