Andrew Kelley
890bf001db
os_rename uses MoveFileEx on windows
2018-01-19 16:53:08 -05:00
Andrew Kelley
9f5c0b6e60
windows-compatible os_rename function
...
windows libc rename() requires destination file path to not exist
2018-01-19 16:31:21 -05:00
Andrew Kelley
ea623f2d39
all doc code examples are now tested
...
improve color scheme of docs
make docs depend on no external files
fix broken example code in docs
closes #465
2018-01-19 03:21:47 -05:00
Andrew Kelley
4b64c777ee
add compile error for shifting by negative comptime integer
...
closes #698
2018-01-18 17:47:21 -05:00
Andrew Kelley
0fc645ab70
emit a compile error for @panic called at compile time
...
closes #706
2018-01-18 17:15:36 -05:00
Andrew Kelley
0b8f19fcba
fix null debug info for 0-length array type
...
closes #702
2018-01-18 15:08:20 -05:00
Jimmi Holst Christensen
fa2c3be341
More tests, and fixed none negative bigint xor
2018-01-17 14:31:47 +01:00
Jimmi Holst Christensen
db0fc32ab2
fixed xor with zero
2018-01-17 14:00:27 +01:00
Andrew Kelley
4bdfc8a10a
fix error return traces pointing to off-by-one source line
...
See #651
2018-01-17 00:22:53 -05:00
Andrew Kelley
ee9ab15679
Merge pull request #695 from Hejsil/tranlate-c-fixes
...
Tranlate c fixes - undefined variable initialization and non-bool if statements
2018-01-16 10:32:37 -05:00
Jimmi Holst Christensen
3974b7d31d
translate_c can now translate if statements on integers and floats
2018-01-16 15:48:28 +01:00
Jimmi Holst Christensen
821cbd7a1b
Output "undefined" on uninitialized variables
2018-01-16 15:01:02 +01:00
Andrew Kelley
6a95b88d1b
fix bigint remainder division
...
See #405
2018-01-16 03:09:44 -05:00
Andrew Kelley
84d8584c5b
implement bigint div and rem
...
See #405
2018-01-16 02:22:19 -05:00
Andrew Kelley
92fc5947fc
fix compiler crash related to @alignOf
2018-01-15 20:44:21 -05:00
Andrew Kelley
c9ac607bd3
add builtin.have_error_return_tracing
2018-01-15 00:14:14 -05:00
Andrew Kelley
7b57454cc1
clean up error return tracing
...
* error return tracing is disabled in release-fast mode
* add @errorReturnTrace
* zig build API changes build return type from `void` to `%void`
* allow `void`, `noreturn`, and `u8` from main. closes #535
2018-01-15 00:01:02 -05:00
Andrew Kelley
d973b40884
stack traces are a variable number of frames
2018-01-14 19:40:02 -05:00
Andrew Kelley
f0df2cdde9
error return traces use a zig-provided function to save binary size
2018-01-14 16:26:06 -05:00
Andrew Kelley
fa024f8092
error return trace pointer prefixes other params
...
instead of being last. This increases the chances that it can
remain in the same register between calls.
2018-01-14 14:35:43 -05:00
Andrew Kelley
4551489b92
typecheck the panic function
2018-01-13 01:00:50 -05:00
Andrew Kelley
32ea6f54e5
*WIP* proof of concept error return traces
2018-01-12 02:12:11 -05:00
Andrew Kelley
7ec783876a
functions which can return errors have secret stack trace param
...
See #651
2018-01-11 23:04:08 -05:00
Andrew Kelley
3268276b58
the same string literal codegens to the same constant
...
this makes it so that you can send the same string literal
as a comptime slice and get the same type
2018-01-11 21:02:30 -05:00
Andrew Kelley
3c094116aa
remove %% prefix operator
...
See #632
closes #545
closes #510
this makes #651 higher priority
2018-01-09 00:51:51 -05:00
Andrew Kelley
598170756c
a catch unreachable generates unwrap-error code
...
See #545
See #510
See #632
2018-01-07 18:13:54 -05:00
Andrew Kelley
632d143bff
replace a %% b with a catch b
...
See #632
better fits the convention of using keywords for control flow
2018-01-07 17:28:20 -05:00
Andrew Kelley
66717db735
replace %return with try
...
See #632
better fits the convention of using keywords for control flow
2018-01-07 16:53:13 -05:00
Andrea Orru
de1f57926f
Merge branch 'master' of github.com:zig-lang/zig
2018-01-07 04:43:15 -05:00
Andrea Orru
3182857224
Adding zen support
2018-01-07 04:43:08 -05:00
Andrew Kelley
bb39e503c0
fix struct inside function referencing local const
...
closes #672
the crash and compile errors are fixed but structs
inside functions still get named after the functions
they're in. this will be fixed later.
2018-01-07 00:28:37 -05:00
Andrea Orru
e932919e68
Darwin -> MacOSX, added Zen. See #438
2018-01-06 23:10:53 -05:00
Andrew Kelley
17e68c4a11
disable NewGVN
...
closes #673
2018-01-06 00:15:37 -05:00
Andrew Kelley
2c35e24bd9
workaround for microsoft releasing windows SDK with wrong version
2018-01-05 11:35:46 -05:00
Andrew Kelley
1b120d1e49
update windows build to llvm 5.0.1
...
llvm-config.exe does not handle diaguids.lib for us so we have to
duplicate the work.
2018-01-04 22:46:26 -05:00
Andrew Kelley
477e3f64fc
self-hosted build: use llvm-config from stage1
2018-01-03 21:32:50 -05:00
Andrew Kelley
5a800db48c
build: std files and c header files are only specified once
...
In the CMakeLists.txt file. And then we communicate the list
to the zig build.
2018-01-03 19:39:04 -05:00
Andrew Kelley
5b156031e9
enum tag values are expressions so no parentheses needed
2018-01-03 16:05:37 -05:00
Andrew Kelley
36ff26609b
fix self hosted compiler on windows
2018-01-03 04:55:49 -05:00
Andrew Kelley
0ea50b3157
ir: new pass iteration strategy
...
Before:
* IR basic blocks are in arbitrary order
* when doing an IR pass, when a block is encountered, code
must look at all the instructions in the old basic block,
determine what blocks are referenced, and queue up those
old basic blocks first.
* This had a bug (See #667 )
Now:
* IR basic blocks are required to be in an order that guarantees
they will be referenced by a branch, before any instructions
within are referenced.
ir pass1 is updated to meet this constraint.
* When doing an IR pass, we iterate over old basic blocks
in the order they appear. Blocks which have not been
referenced are discarded.
* After the pass is complete, we must iterate again to look
for old basic blocks which now point to incomplete new
basic blocks, due to comptime code generation.
* This last part can probably be optimized - most of the time
we don't need to iterate over the basic block again.
closes #667
2018-01-02 21:08:12 -05:00
Andrew Kelley
6fece14cfb
self-hosted: build against zig_llvm and embedded LLD
...
Now the self-hosted compiler re-uses the same C++ code for interfacing
with LLVM as the C++ code.
It also links against the same LLD library files.
2017-12-26 19:44:08 -05:00
Andrew Kelley
2a25398c86
fix segfault when passing union enum with sub byte...
...
...field to const slice parameter
we use a packed struct internally to represent a const array
of disparate union values, and needed to update the internal
getelementptr instruction to recognize that.
closes #664
2017-12-24 04:11:58 -05:00
Andrew Kelley
9dae796fe3
translate-c: set up debug scope for translated functions
2017-12-23 22:14:35 -05:00
Andrew Kelley
760b307e8a
fix endianness of sub-byte integer fields in packed structs
...
closes #307
2017-12-22 18:27:33 -05:00
Andrew Kelley
d917815d81
explicitly return from blocks
...
instead of last statement being expression value
closes #629
2017-12-22 00:50:30 -05:00
Andrew Kelley
8bc523219c
add labeled loops, labeled break, labeled continue. remove goto
...
closes #346
closes #630
regression: translate-c can no longer translate switch statements.
after #629 we can ressurect and modify the code to utilize arbitrarily
returning from blocks.
2017-12-20 23:00:19 -05:00
Andrew Kelley
d686113bd2
fix crash when implicitly casting array of len 0 to slice
...
closes #660
2017-12-19 22:38:02 -05:00
Andrew Kelley
1cc450e6e7
fix assert when wrapping zero bit type in nullable
...
closes #659
2017-12-19 18:21:42 -05:00
Andrew Kelley
9d9201c3b4
bring back code that uses export and fix tests
...
partial revert of 1fdebc1dc4881a00766f7c2b4b2d8ee6ad6e79b6
2017-12-19 02:39:43 -05:00
Andrew Kelley
27ba4f0baf
export keyword works again
2017-12-19 01:49:42 -05:00