Commit Graph

8767 Commits

Author SHA1 Message Date
xackus
d3ab0eb28d new ArrayList API: fix ArrayList.shrink 2020-04-02 15:15:20 +02:00
xackus
93a20f2e82 new ArrayList API: fix std.ArrayListSentineled 2020-04-02 15:14:28 +02:00
xackus
dd570dbc0d new ArrayList API, fix enough std lib to test 2020-04-02 15:14:18 +02:00
daurnimator
34524a1792
std: add LinearFifo().inStream 2020-04-02 21:14:15 +11:00
daurnimator
2a031c8825
std: LinearFifo matches ArrayList in always having outStream method 2020-04-02 21:07:44 +11:00
Michael Dusan
f6d384450f add compile-error test: bitcast
Issue fixed by an unknown commit.

closes #3818
2020-04-01 18:07:45 -04:00
Andrew Kelley
4848b28ec8
zig cc: detect -mcpu, -march, -mtune
However these are all treated like zig's -mcpu parameter.

See #4784
2020-04-01 18:06:04 -04:00
Timon Kruiper
eefb0a36c0 Fix CrossTarget.parse test on platforms where abi != gnu
Closes #4902
2020-04-01 18:05:49 -04:00
Rejean Loyer
2b6dfdd3d4 zig cc: add support for -L linker arguments 2020-04-01 17:21:11 -04:00
Andrew Kelley
783f73c7e3
zig cc properly handles -S flag and .ll, .bc extensions 2020-04-01 16:01:06 -04:00
LemonBoy
6695fa4f32 ir: Fix comparison of ?T values
The code assumed that every ?T had a pointer child type T, add some more
checks to make sure the type is effectively a pointer.

Closes #4789
2020-04-01 15:56:38 -04:00
Michael Dusan
212e2354b8 stage1: make C++ switch fallthrough an error
Make fallthrough an error when compiler supports it. This requires a new
macro that is defined with such compilers to be used as a statement, at
all fallthrough sites:

    switch (...) {
        case 0:
            ...
            ZIG_FALLTHROUGH;
        case 1:
            ...
            break;
        default:
            ...
            break;
    }

If we ever move to C++17 as minimal requirement, then the macro can be
replaced with `[[fallthrough]];` at statement sites.
2020-04-01 15:56:00 -04:00
Andrew Kelley
0f1f56bb69
Merge pull request #4896 from FireFox317/fix-arm32-stuff
fix some nullptr dereferences on arm-linux-musleabhif
2020-04-01 15:55:31 -04:00
Andrew Kelley
c211b8f91d
fix regressions from previous commit 2020-04-01 15:02:31 -04:00
Timon Kruiper
d33766e6c7 Make sure that ZigTypeVector and ZigTypeArray have the same memory layout
Throughout the stage1 code it is assumed that these have the same layout,
but that was not the case. This caused an issue on 32-bit hardware.
2020-04-01 20:50:13 +02:00
Timon Kruiper
ae6965a4e7 Fix undefined behavior when shift amount is 64 2020-04-01 20:50:09 +02:00
Timon Kruiper
d9cf779b47 Fix some nullptr dereferences on arm-linux-musleabhif 2020-04-01 20:38:32 +02:00
Jadon Fowler
b9cb1e0d83 translate-c: add tests for div & rem assignment
Signed-off-by: Jadon Fowler <j@jadon.io>
2020-04-01 14:28:21 -04: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
c2e8788259
Merge branch 'daurnimator-less-buffer'
closes #4665
2020-04-01 13:44:19 -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
7eb938c909
Use length field as passed in stage2 libc_installation instead of relying on zero termination 2020-04-01 10:36:38 -04:00
daurnimator
e535057364
std: use std.ArrayList(u8).OutStream instead of std.Buffer.OutStream 2020-04-01 10:36:38 -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
daurnimator
37e6a64690
std: use Buffer.outStream in std/child_process.zig 2020-04-01 10:36:38 -04:00
daurnimator
ecbc235403
std: use std.ArrayList(u8) instead of std.Buffer in std/build.zig 2020-04-01 10:36:38 -04:00
daurnimator
bb5383cf00
std: don't return sentinel slices from cross_target functions 2020-04-01 10:36:38 -04:00
daurnimator
0ee2462a31
std: add std.ArrayList(u8).outStream() 2020-04-01 10:36:38 -04:00
Andrew Kelley
e8a1e2a1d8
Merge pull request #4894 from LemonBoy/netbsd-p2
More NetBSD bits
2020-04-01 10:24:54 -04:00
Andrew Kelley
0628c2e2ba
Merge pull request #4895 from vrischmann/fix-io-tests
Fix io tests
2020-04-01 10:21:27 -04:00
Andrew Kelley
d23f9a164e
Remove unneeeded address-of operator 2020-04-01 10:21:17 -04:00
Vincent Rischmann
748b2c72a3
io: fix COutStream test 2020-04-01 13:13:47 +02:00
LemonBoy
5047cd3d78 Workaround for #4789 2020-04-01 12:46:16 +02:00
Vincent Rischmann
f46121b8fc
io: fix serialization compilation and tests 2020-04-01 12:37:02 +02:00
Vincent Rischmann
eddf491bf4
io: fix PeekStream compilation 2020-04-01 12:26:49 +02:00
Vincent Rischmann
318abaad02
io: test all files under std/io 2020-04-01 12:24:09 +02:00
LemonBoy
4209ab90a8 std: Use the versioned libc symbols if needed
Many symbols on NetBSD and some on OSX require the definition of an
alias.
2020-04-01 12:23:18 +02:00
LemonBoy
070ace4b22 std: Fix more NetBSD bits
Fix some more libc definitions.
2020-04-01 12:11:19 +02:00
Michaël Larouche
a5af78c376 Fix porting of zlib alder32 with large input 2020-03-31 20:08:42 -04:00
Michael Dusan
e3d12471a2 add compile-error test for #2687
Issue fixed by an unknown commit.

closes #2687
2020-03-31 20:08:00 -04:00
Timon Kruiper
9e019ed26b Fix possible unaligned ptr from getauxval
This caused SIGILL on armv7a-linux
2020-03-31 15:26:06 -04:00
Andrew Kelley
c7a3796734
ci: export master branch version for update-download-page 2020-03-31 14:54:13 -04:00
Bodie Solomon
9bb76f8ce0 Use correct compiler flags in MSVC bootstrap builds of Zig
https://github.com/ziglang/zig/issues/4877

The CMake build of Zig from C++ uses hand-set compiler flags which are
not compatible with the Microsoft C/C++ Optimizing Compiler (cl.exe)
used by Visual Studio.

This commit attempts to conform them to match the Clang/GCC options
under MSVC builds.

Note that CL does not have a concept of C99 or "-O3", and may imply
other optimizations in "/O2" than are implied by Clang/GCC "-O3".

Visual Studio 2019 documentation for cl.exe's optimization options:
https://docs.microsoft.com/en-us/cpp/build/reference/o-options-optimize-code?view=vs-2019

Visual Studio 2019 doc for cl.exe's C++ standard options:
https://docs.microsoft.com/en-us/cpp/build/reference/std-specify-language-standard-version?view=vs-2019
2020-03-31 14:23:34 -04:00
Andrew Kelley
d34a3c66b3
Merge pull request #4543 from daurnimator/cleanup-json
std.json improvements
2020-03-31 12:07:25 -04:00
Andrew Kelley
28b7306a31
Merge pull request #4880 from daurnimator/use-spanZ
Take advantage of mem.spanZ accepting null
2020-03-31 11:57:31 -04:00
Andrew Kelley
d9d8c42426
remove unnecessary inline
works around a bug triggered by previous commit
2020-03-31 11:18:11 -04:00
Andrew Kelley
47a0e3ec5e
Merge pull request #4871 from boothby/issue4769
Address bugs when //, /// or //! are immediately followed by EOF
2020-03-31 10:56:21 -04:00
daurnimator
3cf302a71d
Tidy up some mem.spanZ use-sites now that null is accepted 2020-04-01 01:50:34 +11:00
Andrew Kelley
6d25e45123
Merge branch 'LemonBoy-more-cache' 2020-03-31 10:49:06 -04:00