11437 Commits

Author SHA1 Message Date
LemonBoy
c6c25a1c09 stage1: Fix undefined assignment for bitfields
Prevents silent memory corruption.

Closes #7055
2020-11-18 22:51:34 -07:00
Frank Denis
3f134cfe5e edwards25519 - skip useless operations and duplicate lookup table
Just some trivial changes; no functional changes.

Skip useless nul additions and multiplications and comptime the
basepoint multiples only once.
2020-11-18 21:45:42 -08:00
breakin
e814f71052 Change seed for Murmur2_64 from u32 to u64 2020-11-18 18:06:04 -07:00
Veikka Tuominen
50269f2315 Merge pull request #6649 from Rocknest/verparse
make Version.parse less strict
2020-11-18 17:47:43 -07:00
Vexu
8af0a1987b make help in commands more consistent
Closes #7101

Co-authored-by: pfg <pfg@pfg.pw>
2020-11-18 17:37:14 -07:00
Timon Kruiper
b498d26376 Allow Zig to be built with clang 11 and -Werror
This was brought to the horizon when using zig-bootstrap to cross compile
Zig for windows-gnu.
2020-11-18 17:32:48 -07:00
LemonBoy
d3f1a4edce stage1: Add architecture-specific clobbers to asm()
We're basically following Clang's lead, add the necessary clobbers to
minimize the risk of generating wrong code.
2020-11-18 17:32:41 -07:00
Veikka Tuominen
1add7c616f Merge pull request #7084 from xackus/mem-volatile
std.mem: make sliceAsBytes, etc. respect volatile
2020-11-18 17:31:11 -07:00
Frank Denis
5f9a664de9
STAGE1_SOURCES: In 0.7.x, leb128.zig is in std/debug (#7148)
* STAGE1_SOURCES: In 0.7.x, leb128.zig is in std/debug

* codegen/aarch64.zig doesn't exist in 0.7.x

Co-authored-by: Frank Denis <github@purftpd.org>
2020-11-18 14:53:47 -05:00
LemonBoy
1c8cd268be stage1: Fix asyncCall with non-abi-aligned arguments
Make the code used to calculate the variable slot index into the frame
match what's done during the structure layout calculation.

Prevents a few nasty LLVM errors when such types are passed around.
2020-11-17 16:55:44 -07:00
Andrew Kelley
eea4cd2924 cli: make -h, --help consistent in usage text and parsing
also trivial fixes in the general usage text
2020-11-17 16:54:15 -07:00
Guoxin Yin
4d44a813de Add -h alias for --help 2020-11-17 11:39:42 -07:00
johnLate
51ffb0548d CMake: properly detect when to rebuild zig1.o
This is andrewrk's patch from ziglang#6724 (rebased)

CMake: Fix dependency problem

I don't know whether the error was expected cmake behavior or a bug.
This change seems to fix the issue. See ziglang#6724 for details.

cmake: add the correct set of zig stage2 sources
2020-11-16 18:04:54 -07:00
Alex Cameron
5b42704ea7 Prevent double file close in MachO linking 2020-11-16 15:00:22 -07:00
Frank Denis
c8b6e407ba Enable loop interleaving when unrolling is enabled
This mimics clang's default behavior.
2020-11-16 15:00:16 -07:00
LemonBoy
9e1e91dafc std: Make windows.ReadFile allow short reads
Make it behave like the read() wrapper for unix systems.
Reading the whole buffer breaks some use-cases like buffered readers
over sockets.

Closes #7121
2020-11-16 14:35:28 -07:00
LemonBoy
6624f9cd5c stage1: Fix generation of pass-by-value args in async fns
The mismatch between the argument slot type in the frame structure and
the one used in the store operation made the generated code write
garbage over the nearby fields.

Fixes #7104
2020-11-16 11:37:49 -07:00
Andrew Kelley
7d0c461b77 std.fs.path.dirname: return null when input path is root
This intentionally diverges from the unix dirname command, as well as
Python and Node.js standard libraries, which all have this edge case
return the input path, unmodified. This is a footgun, and nobody should
have ever done it this way.

Even the man page contradicts the behavior. It says:
"strip last component from file name". Now consider, if you
remove the last item from an array of length 1, then you
have now an array of length 0. After you strip the last component, there
should be no components remaining. Clearly, returning the input parameter
unmodified in this case does not match the documented behavior. This is
my justification for taking a stand on this API design.

closes #6746
closes #6727
closes #6584
closes #6592
closes #6602
2020-11-15 10:53:06 -07:00
LemonBoy
2d280825cd stage1: Disambiguate Wasm imports with same name
Closes #7088
2020-11-13 14:33:20 -07:00
LemonBoy
10617593f8 stage1: Resolve ErrorUnion children types
Since the code is accessing the abi_size field compute the full type
size for both err_set_type and payload_type, not only for the latter.
2020-11-13 14:29:38 -07:00
LemonBoy
10b1001a12 stage1: Ask LLVM to produce compact code in ReleaseSize mode
Let's follow what Clang does for -Oz and apply the `minsize` and
`optsize` attributes by default.

Closes #7048
Supersedes #7077
2020-11-13 10:27:26 -07:00
Hubert Jasudowicz
eaa1db2002 std: Fix code model argument 2020-11-11 19:33:10 -07:00
Vexu
1aec406311 std: fix HashMap.clearRetainingCapacity 2020-11-11 19:33:03 -07:00
Vexu
b6350a2b3f std: fix HashMap.putAssumeCapacity 2020-11-11 19:32:58 -07:00
Vexu
8c62733927 ensure TypeInfo payload is not undefined 2020-11-11 19:32:30 -07:00
LemonBoy
aa6fc29744 stage1: Fix crash in comptime struct generation
Using the gen_index rather than the src_index is needed to handle
structures containing zero-sized or comptime only types.

Closes #7027
2020-11-11 19:14:03 -07:00
Jonas Carpay
01a927a0cb Fix backticked code in langref 2020-11-11 19:13:52 -07:00
LemonBoy
7d3c5f207a stage1: Avoid resolving type entry in [0]T
The logic was already there but this rule was only applied in some
places, apply it in the remaining code paths.

Closes #7058
2020-11-11 19:13:04 -07:00
Andrew Kelley
0405698696 add missing -m<os>-version-min CLI args to clang
This fixes some code generation issues when targeting macOS and
compiling C/C++ code.
2020-11-10 15:24:57 -07:00
Andrew Kelley
73455eaf42 std.Target: bump default version max for macos 2020-11-10 15:24:51 -07:00
LemonBoy
85665386c6 stage1: Fix comparison of unions containing zero-sized types
The code tried to be too smart and skipped the equality (returning true)
if the payload type was zero-sized.
This optimization is completely wrong when the union payload is a
metatype!

Fixes #7047
2020-11-10 15:24:41 -07:00
Andrew Kelley
2c0caa8533 main: updateModule returns an error when there are any compile errors
closes #6976
2020-11-09 20:52:08 -07:00
daurnimator
904c513a1e Fix json parser close tracking (#6865)
* std: fix json parsing with unmatched closing tokens

* std: fix swapped json parsing errors
2020-11-09 16:29:22 -07:00
LemonBoy
0e2eb6eb65 stage1: Print correct error message for vector @intCast 2020-11-09 16:25:47 -07:00
Frank Denis
c2c3177d82 Don't prevent compilation on platforms where debug info is unsupported
We don't support debug information on platforms that are not tier-1,
but it shouldn't be a hard error that completely prevents compilation.
2020-11-09 16:23:27 -07:00
Alexandros Naskos
a28c244afb Windows TLS startup symbols are already provided by libcrt when linking against libc 2020-11-09 15:47:37 -07:00
Andrew Kelley
97ec177953 std.ResetEvent: disable flaky test on Windows
See #7009
2020-11-09 15:36:51 -07:00
data-man
810c03f426 Fix reduce documentation 2020-11-09 15:36:46 -07:00
Andrew Kelley
0f4b893d6d langref: add 0.7.0 link 2020-11-09 15:36:36 -07:00
Frank Denis
61507d95d8 Bump Zig version to 0.7.0 2020-11-09 15:36:26 -07:00
Andrew Kelley
0c90ccc297 Release 0.7.0 0.7.0 2020-11-08 12:02:09 -07:00
joachimschmidt557
03ae77b8b0 stage2 ARM: miscellaneous improvements 2020-11-07 17:27:23 +01:00
Alexandros Naskos
5430642fa0
Merge pull request #7008 from xackus/minor-fixes
change debug.assert to testing.expect in tests
2020-11-07 11:34:51 +02:00
Andrew Kelley
67ea47babd Revert "update runtime safety test case - unsigned-signed vector cast"
This reverts commit 663f0b399c5f4e2528a969fba6cd58d8f9784f5a.

The behavior appears to be inconsistent between running locally and on
the CI.

I suspect it could be based on what vector CPU features are available.
2020-11-06 18:58:10 -07:00
Andrew Kelley
663f0b399c update runtime safety test case - unsigned-signed vector cast
now it returns "integer cast truncated bits" instead of "attempt to cast
negative value to unsigned integer" which I think is correct.
2020-11-06 17:15:05 -07:00
Andrew Kelley
ceaa569bfa disable flaky file locking test on Windows
See #7010
2020-11-06 17:00:51 -07:00
Andrew Kelley
c923f74fc9 std.ResetEvent: disable flaky test on macOS
See #7009
2020-11-06 16:46:30 -07:00
xackus
c9fa57541b remove outdated comment 2020-11-06 22:58:58 +01:00
xackus
5c8f7f81cd change debug.assert to testing.expect in tests 2020-11-06 22:48:54 +01:00
Andrew Kelley
e5fab3ba68 update musl sources to 1.2.1 2020-11-06 14:13:57 -07:00