4415 Commits

Author SHA1 Message Date
LemonBoy
6d2f103bfb stage1: Fix crash in comptime struct value copy
Comptime fields are never materialized in the ZigValue so pay attention
when iterating over the fields array.

Fixes #6800
2020-10-28 21:13:32 +02:00
Andrew Kelley
e1ca6946be rename ZigClangFloatingLiteral_getValueAsApproximateDouble 2020-10-27 14:16:43 -07:00
Andrew Kelley
e2caf57527 Merge branch 'frmdstryr-import-empty-file' 2020-10-26 16:07:46 -07:00
Andrew Kelley
435c8ad703 non-hacky workaround for the empty file bug
See #3328
2020-10-26 16:06:14 -07:00
Andrew Kelley
c1ae9f40c7 stage1: support "native" as the OS string in -target
This should help for bootstrapping purposes, intending to fix the macOS
CI.
2020-10-26 15:48:48 -07:00
frmdstryr
1ce0994897 Fix @import of empty file 2020-10-26 13:29:32 -07:00
mlarouche
e3fed3c814 Temp Fix for deadlock in C compilation, found and tested on Windows 2020-10-25 21:33:46 -04:00
Jakub Konka
872bc787b5 cc: fix regression on macOS after adding libc headers
Signed-off-by: Jakub Konka <kubkon@jakubkonka.com>
2020-10-24 17:32:50 +02:00
Timon Kruiper
4b48fccadd When checking a cache hit, make sure to handle a (re)moved source file
When a file cannot be found in the cache, it is not a hit.

Closes #6729
2020-10-23 01:01:37 -04:00
Andrew Kelley
e6ac082437
Merge pull request #6744 from LemonBoy/intcast-vec
stage1: Implement `@intCast` between vectors
2020-10-22 17:36:18 -04:00
Andrew Kelley
78199a684f stage2 LLD .ar linking: fix wrong object file path
closes #6721
closes #6722
2020-10-22 14:33:46 -07:00
Jakub Konka
7d0acacfc3 Add minimal set of macOS libc headers
Signed-off-by: Jakub Konka <kubkon@jakubkonka.com>
2020-10-21 19:45:21 -07:00
LemonBoy
44f8e6a534 stage1: Fix edge case in Union ZigValue generation
Unions that passed the one_possible_value check were incorrectly
generated, none of their internal fields were initialized.

Fixes #6758
2020-10-21 22:42:03 -04:00
xackus
36d586336c std docs: print bool values 2020-10-20 23:27:12 +03:00
LemonBoy
2f465761bb stage1: Implement @intCast between vectors
Explicit and implicit integer casts on vector types are now supported
and follow the same rules as their scalar counterparts.

Implicit float casts are accidentally supported, `@floatCast` is still
not vector-aware.
2020-10-19 20:05:09 +02:00
Andrew Kelley
919dcc5104 coff: link in CRT for DLLs that want -lc
see #5748
closes #5870
2020-10-17 20:35:44 -07:00
LemonBoy
2a256d5ea0 stage1: Fix type-checking of unary neg for vector types
Validate the vector element type as done for the scalar case.

Fixes #6708
2020-10-17 21:08:39 -04:00
Andrew Kelley
e51bc19e4a
Merge pull request #6394 from Vexu/fmt
std.fmt add specifier for printing Zig identifiers
2020-10-17 21:06:54 -04:00
Andrew Kelley
05b1a7414e code cleanups
* in selfExePath, return errors instead of defaulting to bogus data
 * less invasive edits to the logic of link/Elf.zig
 * less indentation
2020-10-17 17:52:09 -07:00
Andrew Kelley
03f7cffce9 Merge branch 'openbsd-minimal' of https://github.com/semarie/zig into semarie-openbsd-minimal 2020-10-17 17:34:43 -07:00
Frank Denis
fa17447090 std/crypto: make the whole APIs more consistent
- use `PascalCase` for all types. So, AES256GCM is now Aes256Gcm.
- consistently use `_length` instead of mixing `_size` and `_length` for the
constants we expose
- Use `minimum_key_length` when it represents an actual minimum length.
Otherwise, use `key_length`.
- Require output buffers (for ciphertexts, macs, hashes) to be of the right
size, not at least of that size in some functions, and the exact size elsewhere.
- Use a `_bits` suffix instead of `_length` when a size is represented as a
number of bits to avoid confusion.
- Functions returning a constant-sized slice are now defined as a slice instead
of a pointer + a runtime assertion. This is the case for most hash functions.
- Use `camelCase` for all functions instead of `snake_case`.

No functional changes, but these are breaking API changes.
2020-10-17 18:53:08 -04:00
Vexu
e8ca1b254d
std: remove renderStringLiteral in favor of std.fmt specifier 2020-10-17 23:20:38 +03:00
Sebastien Marie
35a7247a2c
Merge branch 'master' into openbsd-minimal 2020-10-17 17:38:23 +02:00
Vexu
2c294676b5
use new format specifier in translate-c and std lib 2020-10-17 10:27:19 +03:00
Andrew Kelley
245d98d32d
Merge pull request #6291 from pixelherodev/cbe_arithmetic
CBE: addition and subtraction
2020-10-17 01:00:38 -04:00
vegecode
0456b2145d byteOffsetOf rounds up using bit offset in host integer 2020-10-16 20:04:42 -07:00
LemonBoy
d44486b274 std: Add libssp implementation for GNU/Windows targets
Unlike glibc and musl, MinGW provides no libssp symbols leading to
countless compile errors if FORTIFY_SOURCE is defined.

Add a (incomplete) implementation of libssp written in Zig so that
linking succeeds.

Closes #6492
2020-10-16 21:22:14 -04:00
Isaac Freund
0e4c3934a0 zig fmt: write modified files to stdout not stderr 2020-10-16 20:23:18 -04:00
Andrew Kelley
8364417c8f trivial refactor to remove redundant function call 2020-10-16 16:15:50 -07:00
Jakub Konka
abd72781a3 Allow linking with dynamic libraries in main CLI 2020-10-16 19:14:42 -04:00
LemonBoy
f78380b936 stage1: Don't ask LLVM to emit misaligned memcpy
Pay close attention to the RHS type alignment when rendering an
assignment op as it may differ from the LHS pointer one.

This problem was noticed when debugging a CI failure in #6648: due to
sheer luck the misalignment caused a segfault on macos that was also
reproduced locally.

I tried to write a small test case but it turned out to be a daunting
task as I couldn't manage to trigger the problem consistently (and stop
the optimizer from simplifying everything). Patches welcome.
2020-10-16 18:39:48 -04:00
LemonBoy
2a62d4b20b stage1: Expand undefined struct/arrays when indexed
Fixes #6693
2020-10-16 17:13:38 +03:00
Andrew Kelley
d87bd3d8af fixups regarding windows wide strings
* remove GetModuleHandleA from kernel32.zig. use of A functions
   considered harmful.
 * make it a compile error to expose WinMain instead of wWinMain. same
   thing.
 * start code declares wWinMainCRTStartup instead of WinMainCRTStartup
   when it has the choice.
2020-10-15 19:37:55 -07:00
Andrew Kelley
09a250c531 adjust error message of zig run with no args
previously it said "one source file" which was not correct
2020-10-15 17:44:10 -07:00
g-w1
dfce396cf8 friendly error message for zig run with no args 2020-10-15 17:43:44 -07:00
Andrew Kelley
43c2ce10a1 fixups
* extract logic into a `os_can_execve` and use it in the other place
   that we execve
 * outdent some code by introducing `run_or_test` variable
 * delete unnecessary and wasteful memory management logic
 * better error message for when execve fails
 * add comment to explain why we do not execve for `zig test`
2020-10-15 17:18:40 -07:00
g-w1
1c36680928 stage2: use execve where available for zig test and zig run
closes #6531
2020-10-15 16:54:50 -07:00
LemonBoy
ab585c680b stage1: Off-by-one error in int to float conversion
The base is 2^64 and not 2^64-1.

Closes #6683
2020-10-15 21:25:59 +03:00
Andrew Kelley
2f52f95b92
Merge pull request #6669 from ifreund/color-fixes
std/build: support --color
2020-10-14 21:35:43 -04:00
Andrew Kelley
816304e7e1 add .tbd to usage text 2020-10-14 18:22:50 -07:00
Frank Denis
c0e9d3fb86 Classify .tbd files as shared libraries
On macOS, a .tbd ("text-based dylib definition") file is a shared library
stub, allowing symbols to be defined only once for all the architectures
the library was compiled for.

.tbd files can be linked like .dylib files.
2020-10-14 18:19:57 -07:00
Andrew Kelley
0f4386875f stage2: support ZIG_LIBC env var and detect self as system C compiler 2020-10-14 02:05:56 -07:00
Jakub Konka
68b31c59a6
Merge pull request #6650 from kubkon/macho-incremental
stage2: enable incremental MachO linking
2020-10-14 08:20:33 +02:00
LemonBoy
0570df69b1 stage1: Fix missing runtime safety check for intToPtr
Elide the alignment check if the pointer alignment is one, the null
check must be preserved as it depends on the pointer type.

Fixes #6667
2020-10-14 00:05:50 -04:00
Isaac Freund
6ba1fdf7e0
stage2: use meta.stringToEnum for Color parsing
This requires renaming the variants to be snake_case, which is the new
recommended style anyways.
2020-10-13 20:17:30 +02:00
Jakub Konka
adfd298e44 Do not rewrite paths to dyld and libSystem unless changed 2020-10-13 08:38:17 +02:00
Jakub Konka
951721343f Reuse text blocks; enable all incremental tests 2020-10-13 08:38:17 +02:00
Jakub Konka
ecd480fe93 Fix writing of load cmds headers *after* symtab update 2020-10-13 08:38:17 +02:00
Jakub Konka
fc660af077 Update allocateTextBlock to use node free list 2020-10-13 08:38:17 +02:00
Jakub Konka
78ec7b671d Add mechanism for growing/shrinking text blocks 2020-10-13 08:38:17 +02:00