Andrew Kelley
80983ca1ca
fixups to the previous commit
2019-05-16 16:37:58 -04:00
Shawn Landden
1fdb24827f
breaking changes to all bit manipulation intrinsics
...
* `@clz`, `@ctz`, `@popCount`, `@bswap`, `@bitreverse` now
have a type parameter
* rename @bitreverse to @bitReverse
* rename @bswap to @byteSwap
Closes #2119
Closes #2120
2019-05-16 16:37:58 -04:00
Andrew Kelley
057a5d4898
slice types no longer have field access
...
* fix crash when doing field access of slice types. closes #2486
* remove the deprecated Child property from slice types
* add -Dskip-non-native build option to build script
2019-05-14 21:21:59 -04:00
Andrew Kelley
e93a05b6e4
switching on error sets makes new error set for capture values
...
closes #769
2019-05-14 19:11:37 -04:00
Andrew Kelley
df4f77024e
else value when switching on error set has
...
optional capture value which is subset.
see #769
2019-05-14 18:06:57 -04:00
LemonBoy
b05e8d46ec
Change the enum value allocation strategy
2019-05-11 21:29:53 +02:00
LemonBoy
c766f3f9ca
Support signed types as enum tags
2019-05-11 21:28:58 +02:00
Jimmi Holst Christensen
6cf7fb1177
fixes #2235
2019-05-11 20:51:59 +02:00
Jimmi Holst Christensen
fb3b943b07
added tests for global variable declaration syntax
2019-05-11 20:11:56 +02:00
Andrew Kelley
a4aee8b24d
C pointers support if and orelse
...
See #1967
2019-05-08 18:47:14 -04:00
Andrew Kelley
0099583bd3
C pointers support .? operator
...
see #1967
2019-05-08 17:39:00 -04:00
Andrew Kelley
50bbb34594
C pointers support null
...
See #1967
2019-05-08 16:06:34 -04:00
Andrew Kelley
9dfd24a334
add test case to cover solved bug
...
closes #2114
2019-04-30 14:17:16 -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
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
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
Jimmi HC
1a2e02e267
fixed #2356
...
const_ptr_pointee_unchecked did not take into account that if the
pointer is zero sized, then const_val->data.x_ptr.special would be
ConstPtrSpecialInvalid. This commit fixes this by also checking
that the child type of the pointer only have one possible value
and just returns that value.
2019-04-24 15:04:58 +02:00
Michael Dusan
611d4bc6a1
stage1: const_values_equal support tagged union
2019-04-16 13:55:23 -04:00
LemonBoy
8f5753ba9f
Fix normalization of right-shifted BigInt at CT
...
The pointer value for the `digits` field was being treated as if it were
a limb.
Fixes #2225
2019-04-11 03:49:15 -04:00
Andrew Kelley
a4c7e4c4eb
__muloti4 does not need the ABI workaround on Windows
...
Fixes 128-bit integer multiplication on Windows.
closes #2250
2019-04-10 22:33:33 -04:00
Jimmi Holst Christensen
f86ea797ba
Import 1607.zig to behavior.zig
2019-04-08 05:30:27 +02:00
Jimmi Holst Christensen
7c38651a65
Merge branch 'master' of github.com:ziglang/zig
2019-04-07 03:19:08 +02:00
Jimmi Holst Christensen
6960cd156a
Added regression test for #1607 . fixes #1607
2019-04-07 03:18:51 +02:00
Jimmi Holst Christensen
65cf5a8e44
removed todo comment and added test
2019-04-06 11:04:55 +02:00
Andrew Kelley
1dc6751721
fix NaN comparing equal to itself
...
This was broken both in comptime code and in runtime code.
closes #1174
2019-04-04 22:07:15 -04:00
Andrew Kelley
be0f656c21
fix @divFloor returning incorrect value and add __modti3
...
Closes #2152
See #1290
2019-04-04 15:45:37 -04:00
Andrew Kelley
c195d645e4
add regression test for #1025
...
closes #1025
2019-04-04 01:45:18 -04:00
Andrew Kelley
e4d595a8ba
fix thread local variables for non- position independent code
...
This fixes comes thanks to Rich Felker from the musl libc project,
who gave me this crucial information:
"to satisfy the abi, your init code has to write the same value
to that memory location as the value passed to the [arch_prctl]
syscall"
This commit also changes the rules for when to build statically
by default. When building objects and static libraries, position
independent code is disabled if no libraries will be dynamically
linked and the target does not require position independent code.
closes #2063
2019-04-04 01:08:26 -04:00
Andrew Kelley
5aee17e888
regression fixes and fix packed struct abi size
2019-04-02 18:31:19 -04:00
emekoi
b7aa289ae4
fixed broken casts in std
2019-03-31 16:47:34 -05:00
Andrew Kelley
25ac2fe8cd
fix anon enum literal used with switch on union(enum)
...
closes #2141
closes #2142
2019-03-31 12:43:21 -04:00
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
da9d8a6ecf
implement peer type resolution for enum literals
...
See #683
2019-03-24 18:47:36 -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
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
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
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
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