Commit Graph

61 Commits (5f28a9d23851d94edc2b24e549b7c5abbbf23f68)

Author SHA1 Message Date
Andrew Kelley 643ab90ace add maximum value for @setAlignStack 2017-10-23 22:33:00 -04:00
Andrew Kelley e3ad13e054 fix windows argument parsing 2017-10-15 20:19:15 -04:00
Andrew Kelley b4e42042cf fix compiler crash when invalid value used
closes #527
2017-10-06 12:41:14 -04:00
Andrew Kelley f1bd02e6f4 add @setAlignStack builtin 2017-10-03 00:29:27 -04:00
Marc Tiehuis 9dfe217be3 Allow 128-bit hex float literals
Closes #499.
2017-09-28 23:33:36 +13:00
Andrew Kelley dbc202cc6a add test for struct with invalid field
see #468
2017-09-17 23:21:22 -04:00
Andrew Kelley 011df61f8a fix not verifying GlobalLinkage and AtomicOrder types
thanks to aep4Ayai on IRC
2017-09-10 14:04:19 -04:00
Andrew Kelley bc0a60c7a6 more compile errors for non-const variables of things
closes #456
2017-09-09 22:46:08 -04:00
Andrew Kelley 3ff465e288 add OpaqueType builtin
closes #326
2017-09-05 18:51:07 -04:00
Andrew Kelley c42e809f13 setEvalBranchQuota must be called from top of comptime stack 2017-08-31 16:54:20 -04:00
Andrew Kelley 67b6dd28ec allow array literals to have size and fix comptime bug 2017-08-31 16:30:46 -04:00
Andrew Kelley 052b4ae941 align syntax: align(4) instead of align 4
closes #37
2017-08-30 04:54:33 -04:00
Andrew Kelley e9280c86a1 compile error for not-aligned-enough pointer to cmpxchg
See #37
2017-08-30 02:56:42 -04:00
Andrew Kelley b35dad88b4 add tests for function alignment handling
See #37
2017-08-30 00:06:14 -04:00
Andrew Kelley 898d65baa9 more alignment improvements
* add alignment capability for fn protos
 * add @alignCast
 * fix some ast rendering code
 * fix some ir rendering code
 * add error for pointer cast increasing alignment
 * update allocators in std to correctly align

See #37
2017-08-29 23:33:25 -04:00
Andrew Kelley 910a96f046 fix tests 2017-08-29 17:10:11 -04:00
Andrew Kelley 816689a3b1 ptrCast gives compile error for increasing alignment
See #37
2017-08-29 16:52:31 -04:00
Andrew Kelley be94299666 prevent implicitly increasing pointer alignment
See #37
2017-08-29 15:19:15 -04:00
Andrew Kelley c5c9d98065 introduce align keyword
* remove `@setGlobalAlign`
 * add align keyword for setting alignment on functions and
   variables.
 * loads and stores use alignment from pointer
 * memcpy, memset use alignment from pointer
 * add syntax for pointer alignment
 * slices can have volatile
 * add u2, i2 primitives
 * ignore preferred align and use abi align everywhere
 * back to only having alignOf builtin.
   preferredAlignOf is too tricky to be useful.
   See #432. Partial revert of
   e726925e80.

See #37
2017-08-29 07:51:34 -04:00
Andrew Kelley cd2f65ff6a add compile error for globally shadowing a primitive type
closes #423
2017-08-19 02:02:25 -04:00
Andrew Kelley 987768778a bit shifting safety
* add u3, u4, u5, u6, u7 and i3, i4, i5, i6, i7
 * shift operations shift amount parameter type is
   integer with log2 bit width of other param
   - This enforces not violating undefined behavior on
     shift amount >= bit width with the type system
 * clean up math.log, math.ln, math.log2, math.log10

closes #403
2017-08-19 01:43:43 -04:00
Andrew Kelley 35d3444e27 more intuitive left shift and right shift operators
Before:
 * << is left shift, not allowed to shift 1 bits out
 * <<% is left shift, allowed to shift 1 bits out
 * >> is right shift, allowed to shift 1 bits out

After:
 * << is left shift, allowed to shift 1 bits out
 * >> is right shift, allowed to shift 1 bits out
 * @shlExact is left shift, not allowed to shift 1 bits out
 * @shrExact is right shift, not allowed to shift 1 bits out

Closes #413
2017-08-09 10:09:38 -04:00
Andrew Kelley 54675b060a add ptrToInt builtin, remove usize(ptr) cast
closes #415
2017-08-08 17:38:25 -04:00
Andrew Kelley 2234788fa8 add ability to explicitly cast float to integer
closes #414
2017-08-07 15:57:41 -04:00
Marc Tiehuis 0705b711f8 Correct floating-point literal allowed ranges
The exponent range for floating-point values is [-1022, 1023].

Fixes #399.
2017-08-07 18:08:09 +12:00
Andrew Kelley ad9f48b74b fix initializing undefined and crash when casting to invalid type
closes #408
2017-08-05 16:54:50 -04:00
Andrew Kelley 6a93dda3e1 progress toward windows hello world working 2017-06-14 00:04:34 -04:00
Andrew Kelley e5b90651ba compileError builtin includes "referenced by" notes
to help track down the cause

closes #278
2017-06-03 15:09:40 -04:00
Andrew Kelley c42c91ee7c fix segfault with array of generic functions
closes #377
2017-05-26 14:39:18 -04:00
Andrew Kelley fcdd808c5c fix segfault with array of variadic functions
closes #377
2017-05-25 13:48:10 -04:00
Andrew Kelley 1c8fee41c2 add compile error for goto leaving defer expression
closes #284
2017-05-21 10:59:09 -04:00
Andrew Kelley 9f3cca8615 add error for break/continue exiting defer expression
See #284
2017-05-21 10:44:55 -04:00
Andrew Kelley 1c6f415a64 fix compiler crash when indexing types
closes #376
2017-05-21 09:50:15 -04:00
Andrew Kelley 29b488245d add setFloatMode builtin and std.math.floor
* skip installing std/rand_test.zig as it's not needed beyond running
   the std lib tests
 * add std.math.floor function
 * add setFloatMode builtin function to choose between
   builtin.FloatMode.Optimized (default) and builtin.FloatMode.Strict
   (Optimized is equivalent to -ffast-math in gcc)
2017-05-20 23:06:32 -04:00
Andrew Kelley 051ee8e626 change slicing syntax from ... to ..
See #359
2017-05-19 10:39:59 -04:00
Andrew Kelley 9851a943ed add compile error for compile-time integer cast truncating bits
closes #371
2017-05-16 17:04:35 -04:00
Andrew Kelley a7570186eb add compile error for comptime division by zero
closes #372
2017-05-14 13:07:45 -04:00
Andrew Kelley 63f6676fee add compile error for casting negative value to...
...unsigned integer at compile-time
2017-05-10 00:21:27 -04:00
Andrew Kelley 7261cd19b7 detect duplicate switch value even when else prong present
closes #43
2017-05-07 13:40:35 -04:00
Andrew Kelley 818a0a2629 switch expression - add compile errors
* for duplicate integer value
   * for missing integer values
   * for missing else prong

see #43
2017-05-07 12:07:35 -04:00
Andrew Kelley 29beb603b7 allow division and remainder operators sometimes
when the values are comptime known and the result would be the same,
allow `/` and `%` for signed integers and floats.

closes #365
2017-05-06 23:59:57 -04:00
Andrew Kelley 157af4332a builtin functions for division and remainder division
* add `@divTrunc` and `@divFloor` functions
 * add `@rem` and `@mod` functions
 * add compile error for `/` and `%` with signed integers
 * add `.bit_count` for float primitive types

closes #217
2017-05-06 23:13:12 -04:00
Andrew Kelley 866c841dd8 add compile error when unable to inline a function
See #38
2017-05-04 15:11:24 -04:00
Andrew Kelley 20b1491e6b implement while for nullables and error unions
See #357
2017-05-04 10:28:00 -04:00
Andrew Kelley 698829b772 change while syntax
Old:

```
while (condition; expression) {}
```

New:

```
while (condition) : (expression) {}
```

This is in preparation to allow nullable and
error union types as the condition. See #357
2017-05-03 18:12:07 -04:00
Andrew Kelley 644ea2dde9 remove test and try expressions in favor of if expressions
See #357
2017-05-03 17:23:11 -04:00
Andrew Kelley 0940d46c01 add compile error for shadowing variable
closes #360
2017-05-03 16:13:57 -04:00
Andrew Kelley 6756c27ca4 zig build: cache_root is relative to build_root 2017-05-03 16:13:57 -04:00
Andrew Kelley 17b935325e `@import("builtin")` instead of `@compileVar`
See #226
Closes #220
2017-05-01 13:12:38 -04:00
Andrew Kelley 458afb0ef9 phi instruction retains stack ptr hint 2017-04-27 23:40:43 -04:00