Commit Graph

3525 Commits

Author SHA1 Message Date
Andrew Kelley
baaef7ed97 Merge pull request #4083 from LemonBoy/better-stdbool
Better _Bool translation
2020-01-06 19:21:55 -05:00
LemonBoy
1dc25d7550 Translate anonymous union/struct 2020-01-06 19:17:47 -05:00
Andrew Kelley
be2483c576 fix test suite regressions 2020-01-06 18:20:31 -05:00
Andrew Kelley
3b5c71d2a5 fix regression with @TypeInfo 2020-01-06 17:13:45 -05:00
Andrew Kelley
5951b79af4 remove stdcallcc, extern, nakedcc from stage1; zig fmt rewrites 2020-01-06 15:23:05 -05:00
Andrew Kelley
0a9daeb37e Merge branch 'cc-work' of https://github.com/LemonBoy/zig into LemonBoy-cc-work 2020-01-06 14:07:56 -05:00
LemonBoy
cd39f6df95 Better _Bool translation 2020-01-06 00:12:18 +01:00
LemonBoy
6ff70d3c31 Better InitListExpr translation 2020-01-05 17:39:29 -05:00
Andrew Kelley
a0ca34979e Merge pull request #4053 from ziglang/test-run-translated-c
add test harness for "run translated C" tests
2020-01-05 14:50:02 -05:00
Andrew Kelley
14fcfe2981 translate-c supports --cache on
this will be used to provide a zig build step
2020-01-03 22:11:19 -05:00
LemonBoy
b91eaba38c Correct evaluation of optional type alignment
The lazy logic was too oversimplified and produced a different result
than the one computed later causing all kinds of problems.

Closes #4013
2020-01-03 17:41:55 -05:00
Haze Booth
f40b6b85f1 Remove translate-c-2 from zig help 2020-01-03 02:17:08 -05:00
Andrew Kelley
695c8f756b add test harness for "run translated C" tests 2020-01-03 00:26:12 -05:00
Andrew Kelley
a90fa45ae1 Merge pull request #4027 from ziglang/fix-float-ops
fix float ops with respect to vectors
2020-01-02 16:10:41 -05:00
LemonBoy
b0fa2ff853 Translate struct/union initializer expressions 2020-01-02 14:16:39 -05:00
Andrew Kelley
213ff939f1 fix comptime vector float ops and add test coverage
also rename `@ln` to `@log` to match libc convention.
2020-01-02 14:01:48 -05:00
LemonBoy
435528a7c5 Use the LLVM C++ API 2020-01-02 18:57:09 +01:00
LemonBoy
0ccac79c8e Implement Thiscall CC 2020-01-02 18:57:08 +01:00
LemonBoy
271fc6a247 Catch more errors during the type resolution phase
Returning the uninitialized/stale error condition made the compiler turn
a blind eye to some problems.
2020-01-02 18:53:20 +01:00
LemonBoy
563d9ebfe5 Implement the callconv() annotation 2020-01-02 18:53:16 +01:00
LemonBoy
d908ca4823 Translate align attribute 2020-01-02 12:33:19 -05:00
LemonBoy
8e89bdfe99 Translate linksection attribute 2020-01-02 12:32:51 -05:00
LemonBoy
1e61e5f404 Don't ptrCast a result-location assignment to _
After #4010 doing `_ = @bitCast(...)` triggered a nonsensical compiler
error.
2020-01-02 10:41:11 -05:00
Andrew Kelley
cb56b26900 fix float ops with respect to vectors
also remove the redundant type parameter
2020-01-01 23:27:43 -05:00
Andrew Kelley
576320e6d5 Merge pull request #4025 from ziglang/Vexu-stage-2-cimport
Use self hosted translate-c for cImport
2020-01-01 22:46:46 -05:00
Andrew Kelley
88c5e2a96e translate-c: don't export inline functions 2020-01-01 20:54:17 -05:00
Vexu
1b64a5f5f0 fix segfault in bit shift safety check 2020-01-01 13:11:42 -05:00
Andrew Kelley
39ee3bc0ec Merge branch 'stage-2-cimport' of https://github.com/Vexu/zig into Vexu-stage-2-cimport 2019-12-31 16:55:41 -05:00
Andrew Kelley
73e535e112 Merge pull request #3683 from Vexu/atomic-float
Support floats with some atomic operations
2019-12-30 19:19:05 -05:00
LemonBoy
cbfd66f68a Don't crash when parsing invalid files 2019-12-30 19:17:19 -05:00
Andrew Kelley
a05150e92d fix comparing comptime_int against undefined literal
closes #4004
2019-12-30 19:08:57 -05:00
LemonBoy
28a8ded95a Resolve more types as needed
Closes #3994
2019-12-30 17:45:09 -05:00
LemonBoy
c1ee846c22 Fix ptrCast of zero-sized type
Closes #2431
2019-12-30 17:43:58 -05:00
Vexu
fceda07f94 use self hosted translate-c for cimports 2019-12-29 11:04:45 +02:00
Vexu
ab7fc33c83 add zig llvm wrapper for atomicrmw 2019-12-23 11:55:00 +02:00
Vexu
8bb1e04449 support some atomic operations with floats 2019-12-23 11:54:47 +02:00
Andrew Kelley
ad92227516 report compile errors instead of crashing when frame is invalid 2019-12-22 17:09:11 -05:00
Andrew Kelley
28dbdba37e Merge pull request #3935 from Vexu/translate-c-2
Translate-c-2 the rest
2019-12-22 16:12:56 -05:00
Andrew Kelley
ce444771c5 fix incorrect @typeInfo for sentinels 2019-12-21 13:25:05 -05:00
Andrew Kelley
8d73703d52 fix safety for sentinel-slicing floats 2019-12-20 18:28:59 -05:00
Andrew Kelley
8918cb06fc sentinel slicing improvements
* add runtime safety for slicing pointers, arrays, and slices.
 * slicing without a sentinel value results in non-sentineled slice
 * improved `std.debug.panic` handling of panic-during-panic
2019-12-20 18:28:59 -05:00
Andrew Kelley
26f3c2d061 fix std.mem.addNullByte and implement sentinel slicing
see #3770
2019-12-20 18:28:56 -05:00
LemonBoy
51cbd96820 Fix sentinel value of opaque pointers in typeInfo
Fixes #3888
2019-12-20 15:48:34 -05:00
LemonBoy
f077c3c4cc Fix comptime evaluation of runtime array access
Fix #3951
2019-12-20 15:47:43 -05:00
Vexu
122a9bad39 translate-c-2 fix some casts 2019-12-19 01:38:42 +02:00
LemonBoy
d8499f7abe Make sure the fields array is always non-null
Fixes #3497
2019-12-17 15:45:22 -05:00
Vexu
daa22d42b0 translate-c-2 floats 2019-12-17 11:28:56 +02:00
Andrew Kelley
b242c2ac10 avoid using undefined value
closes #3933
2019-12-16 22:47:19 -05:00
Andrew Kelley
13cdc137e6 Merge pull request #3570 from ziglang/c-sanitize-undef
use -fsanitize=undefined for C code in safe build modes
2019-12-16 16:17:52 -05:00
LemonBoy
de0d8885b4 Fix alignment query on unresolved types
Fixes #3919
2019-12-16 15:54:06 -05:00