Vexu
13e472aa2a
translate-c: add return if one is needed
2020-08-13 18:40:14 +03:00
Ian Simonson
70cc1751ca
Translate-c fix rhs not cast on array access
...
Closes #5671 . Checks if the rhs is integral and of
differing or the same signedness. If they are different
does an @intCast to the lhs type
2020-07-02 14:05:12 +00:00
Vexu
cd5b7b9e1d
translate-c: use correct scope in for loop condition
2020-05-27 14:14:17 +03:00
Vexu
c0b269bf46
translate-c: small patch to fix bultin type detection
2020-05-06 11:48:46 +03:00
Matthew Knight
db4833d4d6
moved duplicated code to common functions
2020-05-04 23:45:31 -07:00
Matthew Knight
c5198bd76f
added scoped typedef to translate-c
2020-05-02 20:22:43 -07: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
Andrew Kelley
9e60c89601
Revert "Translate C: Group generated casts"
...
This reverts commit 895672b3f9
.
2020-03-08 03:53:06 -04:00
Lachlan Easton
895672b3f9
Translate C: Group generated casts
...
Translate C: Put an alignCast in c style pointer casts to allow opaque types to cast properly in C macros
Translate C: add test case for aligning opaque types in pointer casts
Translate C: Fix @typeId -> @typeInfo
Add test case to run_translated_c for casting from pointer to opaque type
2020-03-07 03:26:42 -05:00
LemonBoy
c944865fc7
Generate compilable code for array inits
...
The compiler still doesn't like too much the newfangled anonymous arrays
so let's use the old-style declarations.
Closes #4181
2020-01-30 19:45:08 +01:00
LemonBoy
570ffc470e
Handle forward-declared functions
...
Closes #4130
2020-01-10 16:34:40 -05:00
travisstaloch
3f98756f85
Fix translation of signed array indices ( #4113 )
...
* cast only if the index is long long or signed
* cast long long to usize rather than c_uint
closes #4075
2020-01-10 00:08:24 -05:00
Rocknest
4613e4d15f
Fix C struct with function pointer member and typedefs mistranslated ( #4122 )
...
fixes #4118
2020-01-09 13:38:31 -05:00
LemonBoy
6a72eb1541
Use abort() instead of assert()
...
Let's see if the Windows/MacOS CI like this more...
2020-01-08 10:31:11 +01:00
LemonBoy
5b34697b21
Cast integer literals to their specified type
2020-01-08 10:19:04 +01:00
LemonBoy
fd7e69a2c0
More translate-c fixes
...
* Translate OpaqueValueExpr
* Translate BinaryConditionalOperator
* Fix translation of boolean->int casts
* Reoder some tokens to avoid rendering errors
2020-01-08 08:43:37 +01:00
via
9390e8b848
Preserve packed attribute in C translated struct ( #4085 )
...
* Preserve packed attribute in C translated struct
* Add tests for packed C struct
2020-01-07 02:36:07 -05:00
LemonBoy
7e7d0e1ffa
Better handling of decayed arrays to pointers
2020-01-06 19:32:53 -05:00
Andrew Kelley
baaef7ed97
Merge pull request #4083 from LemonBoy/better-stdbool
...
Better _Bool translation
2020-01-06 19:21:55 -05:00
LemonBoy
62413da9d3
Add run-translated-c test & fix one more edge case
2020-01-06 19:17:47 -05:00
Tadeo Kondrak
f83b02a581
translate-c: use @intToPtr to cast away qualifiers
2020-01-06 19:09:49 -05:00
LemonBoy
eca294cd23
Add run-translated-c test
2020-01-06 00:18:26 +01: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
Andrew Kelley
695c8f756b
add test harness for "run translated C" tests
2020-01-03 00:26:12 -05:00