Commit Graph

2406 Commits (f1e5a4f1639d4c571bfc26610593a15f9e0e2cf3)

Author SHA1 Message Date
xackus 2c9effc101 stage1: handle all cases of invalid struct field default value 2020-05-07 16:39:16 -04:00
Andrew Kelley ba43492c0e
Merge pull request #5268 from tadeokondrak/remove-callconv-redundant-syntax
Remove syntax redundant with callconv
2020-05-07 12:42:26 -04:00
Vexu 06e6d39c6c
Merge pull request #5257 from matt1795/scoped-typedef
Add scoped typedef to translate-c
2020-05-06 12:28:30 +03:00
Vexu c0b269bf46
translate-c: small patch to fix bultin type detection 2020-05-06 11:48:46 +03:00
Tadeo Kondrak 84a0a9688c
update docs/tests for async/extern fn removal 2020-05-05 10:31:32 -06:00
Tadeo Kondrak 6745a6f6f6
zig fmt 2020-05-05 09:38:02 -06:00
Andrew Kelley e6955688ac
Merge pull request #5272 from tadeokondrak/noasync-to-nosuspend
Noasync to nosuspend
2020-05-05 11:21:02 -04:00
Tadeo Kondrak 2c9204032d
update tests for nosuspend 2020-05-05 05:55:26 -06:00
Tadeo Kondrak af00afed98
zig fmt 2020-05-05 05:55:25 -06:00
Matthew Knight db4833d4d6 moved duplicated code to common functions 2020-05-04 23:45:31 -07:00
Vexu f127dee474
Merge pull request #5267 from Vexu/const-call
Fix missing compile error on call assigned to const
2020-05-04 21:45:15 +03:00
Vexu adc444ceeb
fix missing compile error on call assigned to const 2020-05-04 14:28:58 +03:00
Matthew Knight c5198bd76f added scoped typedef to translate-c 2020-05-02 20:22:43 -07:00
Andrew Kelley b7914d901c add test coverage for top level fields
closes #2022
2020-05-02 14:53:20 -04:00
Andrew Kelley 1d202008d8 add ZIR transform test case 2020-05-01 06:47:20 -04:00
Andrew Kelley 56a024bbfc disable stage2 zir tests on not-yet-supported archs 2020-05-01 06:47:20 -04:00
Andrew Kelley 6e6d0eb690 disable stage2 zir tests on not-yet-supported OS's 2020-05-01 06:47:20 -04:00
Andrew Kelley 2bae942800 add ZIR compare output test case to test suite 2020-05-01 06:47:20 -04:00
Ian Simonson e6fa0beb33 Translate-C convert bools to int in complex expressions
Pre-requisite for having a test case for #5062
In complex C statements which are outside of macros,
it is valid C to perform e.g. a bitor between an
integer and a boolean `5 | (8 == 9)`

Currently this results in a zig error after translating
as `c_int | bool` is invalid Zig.

Detects if a sub-expression of a numeric operator is
boolean and if so converts it to int
2020-04-30 12:48:27 +10:00
Tadeo Kondrak 350b2adacd
std.meta.IntType -> std.meta.Int 2020-04-28 19:11:31 -06:00
Andrew Kelley 5929e5ca0e
Merge pull request #5196 from tadeokondrak/@vector-to-@type-vector
`@Vector` -> `@Type(.Vector)`
2020-04-28 16:25:40 -04:00
Andrew Kelley 03dd1fca94
Merge pull request #5195 from tadeokondrak/opaquetype-to-type-opaque
@OpaqueType -> `@Type(.Opaque)
2020-04-28 16:21:07 -04:00
Tadeo Kondrak 0cf129689e
Fix/add translate-c tests for previous commit 2020-04-28 08:45:52 -06:00
Tadeo Kondrak f977155fdb
@Vector -> std.meta.Vector 2020-04-28 00:47:13 -06:00
Tadeo Kondrak 17e41f6cd3
@OpaqueType -> @Type(.Opaque) 2020-04-28 00:02:13 -06:00
Tadeo Kondrak 45f4a1124f implement @Type() for more types 2020-04-27 14:37:18 -04:00
LemonBoy a7a8c433d0 stage1: Prevent the creation of illegal ptr types
Closes #5140
2020-04-24 15:55:32 -04:00
Timon Kruiper c829f2f7b7 Add mips support to standard library 2020-04-24 15:28:55 -04:00
xackus a9eb4a6740 stage1: fix crash on accessing an array of size zero with runtime index 2020-04-23 12:45:32 -04:00
LemonBoy e6428f9401
stage1: Fix bitcast of immediate to ptr type (#5131)
Consider a (legal according to the `@bitCast` rules) conversion from u16
to [2]u8: since the former is a scalar and the latter is a pointer
(arrays are represented at pointers in the codegen phase) we have to
allocate a temporary slot on the stack and then bitcast the resulting
pointer to the desired destination type.

Beware that this means the lifetime of the resulting value is the same
of the function it's contained in and for all intents and purposes
should be regarded as a local (eg. it should not escape).

Closes #4395
Closes #5121
2020-04-23 12:44:16 -04:00
Andrew Kelley e8545db9d4
Merge pull request #5130 from ziglang/stage2-ir
beginnings of non-LLVM self-hosted backend
2020-04-22 14:42:46 -04:00
LemonBoy b5e72c0148 stage1: Prevent the creation of illegal pointer types
Changing the pointer length from Unknown to Single/C now resets the
sentinel value too.

Closes #5134
2020-04-22 14:40:57 -04:00
elucent 48dc3b6fe9 Added peer type resolution for [*]T and *[N]T. 2020-04-21 18:09:03 -04:00
Andrew Kelley cc1c2bd568 simplify ZIR spec; separate parsing/rendering from analysis 2020-04-20 19:21:03 -04:00
Andrew Kelley f92ccf365b generic ir parsing framework 2020-04-19 19:31:50 -04:00
Andrew Kelley bd4280decf beginnings of zig ir parser 2020-04-19 19:31:50 -04:00
Vexu b6fe839248
update std lib to decls being disallowed between fields 2020-04-18 23:56:05 +03:00
Vexu fff00c3bbb
disallow declarations between container fields 2020-04-18 23:56:03 +03:00
Vexu 4f02cf32b4
fix typeInfo tests 2020-04-18 11:39:52 +03:00
Vexu 1afaf42525
add error for non-exter variadic functions 2020-04-17 22:02:49 +03:00
Vexu c026a9f6d2 fix missing compile errors on builtin cast functions 2020-04-17 14:22:20 -04:00
LemonBoy 8e96922f31 stage1: Fix several bugs in constant generation
The codegen would sometimes change the LLVM type for some constants to
an unnamed structure in order to accomodate extra padding. This is fine
as long as the alignment of each field is still respected and it was not
the case for structure types, leading to ill-formed constants being
generated.

Optional types suffer from this to a lower extent as their layout is
quite lucky, the only missing piece was the tail padding.

Closes #4530
Closes #4594
Closes #4295
Closes my will to live
2020-04-17 13:42:23 -04:00
Vexu ca3bf6e6ad
translate-c cleanup and zig fmt 2020-04-15 15:15:32 +03:00
Vexu a016fb8c62
translate-c: correct invalid shortcut 2020-04-15 15:14:10 +03:00
foobles 022a71ca7d
Shift error message now says "fixed-width integer type" instead of just "integer type" (#5028)
* error message of ir_analyze_bit_shift now more accurate/specific

* fixed compile error test to match bit shift error message
2020-04-14 16:19:45 -04:00
LemonBoy ce21a784a4 stage1: More fixes for BE targets
* Fix packed struct alignment
* Adjust some tests
2020-04-13 17:35:14 -04:00
xackus dbc00e2424 ArrayList: remove old (before span) API 2020-04-11 20:40:34 -04:00
Vexu 1b1cbd9358
Merge pull request #4973 from SuperAuguste/nameless-fields
Nameless fields
2020-04-10 21:31:32 +03:00
Auguste Rame df14578c9d
Merge branch 'master' into nameless-fields 2020-04-10 11:49:50 -04:00
Vexu f60e7348d5
add error message for invalid assignment 2020-04-09 11:50:32 +03:00