Commit Graph

264 Commits (0ac502f37257c607fc835840d02f0401c5e59442)

Author SHA1 Message Date
joachimschmidt557 3fd38429e4 Enable formatting in std.big.Int.format 2020-04-15 12:51:43 -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
Andrew Kelley 3c34c313cf revert Translate C: Add comment containing c source location for failed decls
This reverts 0db108101a.

Unfortunately this caused a regression. Closes #5007.
2020-04-11 17:56:48 -04:00
Auguste Rame df14578c9d
Merge branch 'master' into nameless-fields 2020-04-10 11:49:50 -04:00
Lachlan Easton d7902707bc
Translate C: Allow casting literal ints to pointers 2020-04-08 14:11:01 -04:00
Vexu 7b5fb79b5b
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
2020-04-08 14:11:01 -04:00
SuperAuguste 882aa86843 more fixes 2020-04-07 15:08:46 -04:00
Vexu adaf7ad672
Merge pull request #4684 from LakeByTheWoods/comment_failed_decls
Translate C: Add comment containing c source location for failed decls
2020-04-07 21:47:32 +03:00
SuperAuguste f21ac0220a msvc fix 2020-04-07 14:39:24 -04:00
SuperAuguste 9298d38cee remove debug statement 2020-04-07 13:33:01 -04:00
SuperAuguste 94841d0292 Nameless struct field consistency 2020-04-07 13:26:17 -04:00
Vexu c5ced0d74a
Merge pull request #4939 from SuperAuguste/master
translate-c: Properly translate C multicharacter literals
2020-04-06 10:31:17 +03:00
SuperAuguste 6106cf4419 fixes 2020-04-05 19:06:43 -04:00
Vexu 6ef15fc8d0
Merge pull request #4901 from phase/feature/translate-c-remassign
translate-c: RemAssign and DivAssign
2020-04-05 21:05:18 +03:00
Jadon Fowler ae376e0758 translate-c: remove unneeded semicolon
Signed-off-by: Jadon Fowler <j@jadon.io>
2020-04-05 10:44:42 -04:00
SuperAuguste 027e2a1673 fix multichar literals in translate_c 2020-04-04 17:56:25 -04:00
Jadon Fowler 391ee996a5 translate-c: account for signedness when translating div & mod
Signed-off-by: Jadon Fowler <j@jadon.io>
2020-04-04 02:16:30 -04:00
xackus 7a28c644aa new ArrayList API: fix everything else 2020-04-02 16:12:08 +02:00
Jadon Fowler a255b0f842 translate-c: translate DivAssign & RemAssign
Closes #4790

Signed-off-by: Jadon Fowler <j@jadon.io>
2020-04-01 14:23:26 -04:00
Andrew Kelley 2e806682f4
(breaking) std.Buffer => std.ArrayListSentineled(u8, 0)
This new name (and the fact that it is a function returning a type) will
make it more clear which use cases are better suited for ArrayList and
which are better suited for ArrayListSentineled.

Also for consistency with ArrayList,
 * `append` => `appendSlice`
 * `appendByte` => `append`

Thanks daurnimator for pointing out the confusion of std.Buffer.
2020-04-01 13:30:07 -04:00
Andrew Kelley 553f0e0546
fixups and revert a few things 2020-04-01 11:56:39 -04:00
daurnimator 3fb030e78a
std: use std.ArrayList(u8) instead of std.Buffer in src-self-hosted/translate_c.zig 2020-04-01 10:36:38 -04:00
Andrew Kelley 839d85e440 fixes to 32-bit handling, to support 32-bit arm 2020-03-31 10:10:31 -04:00
Andrew Kelley 9e7ae06249
std lib API deprecations for the upcoming 0.6.0 release
See #3811
2020-03-30 14:23:22 -04:00
Layne Gustafson 2a05ca1c94 Conv macro string concat to ++ 2020-03-28 20:40:13 -04:00
Andrew Kelley 53b5aa812b
Merge remote-tracking branch 'origin/master' into llvm10 2020-03-19 22:19:24 -04:00
Andrew Kelley 8ea0a00f40
improve std lib code for the new semantics 2020-03-19 09:53:54 -04:00
Andrew Kelley 656ba530d8
Merge remote-tracking branch 'origin/master' into llvm10 2020-03-13 15:17:53 -04:00
Andrew Kelley 4905102901
fix all the TODOs from the pull request
* `std.Buffer.print` is removed; use `buffer.outStream().print`
 * `std.fmt.count` returns a `u64`
 * `std.Fifo.print` is removed; use `fifo.outStream().print`
 * `std.fmt.bufPrint` error is renamed from `BufferTooSmall`
   to `NoSpaceLeft` to match `std.os.write`.
 * `std.io.FixedBufferStream.getWritten` returns mutable buffer
   if the buffer is mutable.
2020-03-13 12:02:58 -04:00
Andrew Kelley 2dd920ee39
Merge branch 'format-stream' of https://github.com/fengb/zig into fengb-format-stream 2020-03-13 11:31:11 -04:00
Benjamin Feng 4aae55b4cc Replace fmt with new fmtstream 2020-03-12 10:41:09 -05:00
Benjamin Feng 4023ed56d4 Convert translate-c to fmtstream 2020-03-12 10:41:09 -05:00
Vexu 02c491e42a
translate-c fix order of tokens 2020-03-12 17:14:01 +02:00
Vexu dda711ba0d
translate-c treat c bools as ints 2020-03-12 14:40:47 +02:00
Vexu cb4c488cbd
translate-c support struct field alignment 2020-03-10 15:57:57 +02:00
Vexu 4cace8f7c3
properly mangle shadowed primitive types 2020-03-10 15:52:54 +02:00
Vexu baec74645d
translate-c add daurnimator's pointer check to macro cast 2020-03-10 15:52:03 +02:00
Lachlan Easton 0db108101a Translate C: Add comment containing c source location for failed decls 2020-03-09 18:10:41 +11:00
Vexu 692a974c3e
translate-c reject structs with VLAs 2020-03-08 12:11:37 +02:00
Vexu 5aa993cd61
translate-c fix nested loops without blocks. 2020-03-08 11:26:53 +02:00
Andrew Kelley 9e60c89601
Revert "Translate C: Group generated casts"
This reverts commit 895672b3f9.
2020-03-08 03:53:06 -04:00
Andrew Kelley 8b80cb3072
Revert "translate-c remove redundant grouping, fix nested loops without blocks."
This reverts commit abe7305e16.
2020-03-08 03:52:52 -04:00
Andrew Kelley 96c07674fc
Merge remote-tracking branch 'origin/master' into llvm10 2020-03-07 12:18:41 -05:00
Vexu abe7305e16 translate-c remove redundant grouping, fix nested loops without blocks. 2020-03-07 12:14:44 -05: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
Vexu 83d27f71ef translate-c more macro ops 2020-03-06 17:34:37 -05:00
Vexu eaccfffe56 translate-c: default initialize non-extern variables to undefined 2020-03-06 00:06:45 -05:00
Vexu ad27041de9 translate-c demote struct to opaque if unable to translate type 2020-03-05 10:55:32 -05:00
Vexu e063854563
translate-c correct assumption about macros 2020-03-05 12:23:32 +02:00