Commit Graph

8865 Commits

Author SHA1 Message Date
Ian Simonson
a2c3ebb756 Use transCreateNodeInfixOp instead of maybeSuppressResult 2020-04-30 19:10:10 +10: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
Michael Dusan
a08675723c
Merge pull request #5219 from mikdusan/qemu
ci linux: bump qemu 5.0.0-rc4 → 5.0.0
2020-04-29 19:20:20 -04:00
Michael Dusan
e97181e362
ci linux: bump qemu 5.0.0-rc4 → 5.0.0 2020-04-29 17:01:12 -04:00
Vexu
15141d865a
Merge pull request #5210 from tadeokondrak/IntType-to-Int
std.meta.IntType -> std.meta.Int
2020-04-29 11:01:19 +03:00
Tadeo Kondrak
350b2adacd
std.meta.IntType -> std.meta.Int 2020-04-28 19:11:31 -06:00
Tadeo Kondrak
eb183ad9fe
rename std.meta.IntType to std.meta.Int
Closes https://github.com/ziglang/zig/issues/5194
2020-04-28 19:11:18 -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
Vexu
db25c78413
Merge pull request #5201 from tadeokondrak/mangle-field-names-locally
Mangle field names with a local counter in records (translate-c)
2020-04-28 23:18:36 +03:00
Tadeo Kondrak
0cf129689e
Fix/add translate-c tests for previous commit 2020-04-28 08:45:52 -06:00
Tadeo Kondrak
83d2d7ab8a
Mangle field names with a local counter in records
See https://github.com/ifreund/river/issues/17 for an issue that occurs
because the field names are mangled globally. When using the generated
bindings, you have no choice but to use the unstable names or redeclare
the entire struct. This commit changes the behaviour to use a local
counter per record declaration, so the names are predictable each time.
2020-04-28 08:45:51 -06:00
Tadeo Kondrak
0673a8d576
Update language reference for std.meta.Vector 2020-04-28 00:47:14 -06:00
Tadeo Kondrak
f977155fdb
@Vector -> std.meta.Vector 2020-04-28 00:47:13 -06:00
Tadeo Kondrak
ee5b358d71
add std.meta.Vector to replace @Vector 2020-04-28 00:24:46 -06:00
Tadeo Kondrak
249938dde0
Validate vector types for @Vector 2020-04-28 00:24:45 -06:00
Tadeo Kondrak
2ef0795bfb
Update language reference for recent @Type changes 2020-04-28 00:02:14 -06:00
Tadeo Kondrak
17e41f6cd3
@OpaqueType -> @Type(.Opaque) 2020-04-28 00:02:13 -06:00
wozeparrot
01605a7742 add missing const to pkg dependencies 2020-04-27 18:29:55 -04:00
Andrew Kelley
ecdf75d04e
Merge pull request #5187 from ziglang/squeek502-windows-fmt-relative
zig fmt: Fix relative paths with . and .. on Windows as well as forward slashes
2020-04-27 18:28:53 -04:00
Tadeo Kondrak
45f4a1124f implement @Type() for more types 2020-04-27 14:37:18 -04:00
Andrew Kelley
1e04e85200 std: support / in Windows paths 2020-04-27 13:39:06 -04:00
Andrew Kelley
41e17106cd zig fmt: still print the relative path
The previous commit made zig fmt print absolute paths; this commit keeps
the absolute path resolution but still prints the relative paths to
stdout.
2020-04-27 13:38:19 -04:00
Ryan Liptak
fdff381a56 fmt: Fix relative paths with . and .. on Windows
This is a band-aid fix due to NtCreateFile failing on paths with . or .. in them.
2020-04-27 13:35:59 -04:00
Auguste Rame
0df82889cf
Fix issue with std.json incorrectly replacing forward slashes with a backslash (#5167)
* fix breaking typo in json.zig

* add tests
2020-04-27 12:22:43 -04:00
George Roman
a17eb15e11 Add missing state to C object cache 2020-04-27 12:21:48 -04:00
Andrew Kelley
c22b54c9d8 stage2 zir: remove dead code
this was part of the live coding stream and I forgot to delete it before
committing
2020-04-26 17:37:04 -04:00
Henry Nelson
83b0f9c6f7 Fix unfortunate typo 2020-04-26 17:33:04 -04:00
Andrew Kelley
6aeceec1f2 add CLI option -Bsymbolic for binding global references locally 2020-04-26 15:30:52 -04:00
Nick Appleton
28c31a8429
Fix f64 variants of math.cosh and math.sinh to accept negative inputs. (#5172)
* add tests for negative inputs to cosh32 and cosh64. fix bug in cosh64 for negative inputs.

* fix problem with negative input with f64 sinh and add tests
2020-04-26 14:03:19 -04:00
Andrew Kelley
d44c9bdbd9 ir: elemptr and add instructions 2020-04-26 01:20:58 -04:00
Andrius Mitkus
6481b02fdc std: fix posix Thread.spawn to accept all startFn types 2020-04-25 16:15:25 -04:00
George Roman
0c037a8561 Pass each target feature flag separately 2020-04-25 15:54:02 -04:00
LemonBoy
a7a8c433d0 stage1: Prevent the creation of illegal ptr types
Closes #5140
2020-04-24 15:55:32 -04:00
Andrew Kelley
7634e67ba5
Merge pull request #5158 from ziglang/zir-to-elf
beginnings of (non-LLVM) self-hosted machine code generation and linking
2020-04-24 15:37:21 -04:00
Andrew Kelley
9ebf25d145 link: change default executable mode to 0o777
Jonathan S writes:

On common systems with a 022 umask, this will still result in a
file created with 755 permissions, but it works appropriately if the
system is configured more leniently. (As another data point, C's fopen
seems to open files with the 666 mode.)
2020-04-24 15:36:08 -04:00
Timon Kruiper
c829f2f7b7 Add mips support to standard library 2020-04-24 15:28:55 -04:00
Andrew Kelley
058937e44d bug fixes to make it work 2020-04-24 02:09:30 -04:00
Andrew Kelley
229e99ca37 codegen: write the updated code size to PT_LOAD section header 2020-04-23 23:53:52 -04:00
Andrew Kelley
2d35f71fa9 codegen rdx set immediate 2020-04-23 20:30:20 -04:00
Andrew Kelley
757d13d784 codegen supports embedded-in-code constants
also coerce no longer requires a bitcast
2020-04-23 20:23:16 -04:00
Andrew Kelley
0ac502f372 codegen for setting rax and rdi registers 2020-04-23 19:40:17 -04:00
Andrew Kelley
63b54bcf51 codegen for inline assembly 2020-04-23 18:58:47 -04:00
Andrew Kelley
99ec614b71 codegen for const ints and string literals 2020-04-23 17:46:01 -04:00
Andrew Kelley
24a01eed90 basics of writing ELF and machine code generation 2020-04-23 16:41:20 -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
a3dfe36ca1 zir-to-elf skeleton 2020-04-22 23:42:58 -04:00
Michael Dusan
58d5c37409
Merge pull request #5139 from mikdusan/qemu-5.0.0-rc4
Qemu 5.0.0 rc4
2020-04-22 20:41:16 -04:00
Michael Dusan
79809a0e54
ci: bump static-qemu 5.0.0-rc3 → 5.0.0-rc4 2020-04-22 18:02:50 -04:00