Commit Graph

18395 Commits

Author SHA1 Message Date
Andrew Kelley
0cd43b0f86 runtime safety tests only on the native target
This matches master branch. We can look into adding more target coverage
as we switch to stage2. As it stands, this works around having to
duplicate the "Executor" logic to figure out when to not run the tests
due to them being non-native.
2022-05-13 17:59:06 -07:00
Andrew Kelley
7d8b90b905 test harness: actually run the stage1 "run" tests 2022-05-13 17:32:23 -07:00
Andrew Kelley
c30edd78f9 std.Progress: activate() calls maybeRefresh()
This makes the progress bar display the ongoing operation in the case
that the API user calls activate().
2022-05-13 14:31:30 -07:00
Andrew Kelley
b986fcfc99 test-cases: honor -Dtest-filter argument from zig build 2022-05-13 14:31:02 -07:00
Andrew Kelley
f6e9b6620d build.zig: rename a local variable 2022-05-13 14:30:43 -07:00
Andrew Kelley
915032715f test harness: dump stderr when compiler crashes 2022-05-13 14:03:20 -07:00
Andrew Kelley
7755f7863a disable a runtime safety test that is failing on WASI 2022-05-13 14:03:20 -07:00
Andrew Kelley
66f3efb63b migrate runtime safety tests to the new test harness
* migrate runtime safety tests to the new test harness
   - this required adding compare output / execution support for stage1
     to the test harness.
 * rename `zig build test-stage2` to `zig build test-cases` since it now
   does quite a bit of stage1 testing actually. I named it this way
   since the main directory in the source tree associated with these
   tests is "test/cases/".
 * add some documentation for the test manifest format.
2022-05-13 14:03:20 -07:00
Andrew Kelley
f32928c50d
Merge pull request #11641 from erikarvstedt/fixup_rand_float_improvement
Minor fixes for random float generation
2022-05-13 16:50:18 -04:00
Kirk Scheibelhut
24633b5613 zig fmt: make --exclude ignore missing dirs 2022-05-13 16:45:00 -04:00
Koakuma
fb0692334e target: Rename sparcv9 -> sparc64
Rename all references of sparcv9 to sparc64, to make Zig align more with
other projects. Also, added new function to convert glibc arch name to Zig
arch name, since it refers to the architecture as sparcv9.

This is based on the suggestion by @kubkon in PR 11847.
(https://github.com/ziglang/zig/pull/11487#pullrequestreview-963761757)
2022-05-13 16:43:59 -04:00
Jonathan Marler
aceb7e18bd std.os.linux: fix signature of setgroups
the list parameter should be a multi-item pointer rather than a single-item
pointer. see: https://linux.die.net/man/2/setgroups

> setgroups() sets the supplementary group IDs for the calling process...
> the size argument specifies the number of supplementary group IDs in the buffer pointed to by list.
2022-05-13 17:46:56 +02:00
Andrew Kelley
537f905216 fix bad runtime safety test cases
The "slicing operator with sentinel" runtime safety test cases should
all have been compile errors in their current forms. In this commit I
adjust them to use runtime-known slices before triggering the runtime
safety.

Furthermore the test cases did not actually have unique names.
2022-05-12 21:15:41 -07:00
Travis Staloch
974af5f291 add std.math.sign 2022-05-12 16:09:09 -04:00
Erik Arvstedt
23ef7a8060 std.rand.float: simplify leading zero calculations
This saves a `bitwise or` operation in the common case and
removes the (slightly magic) mask constants.
2022-05-12 16:23:39 +02:00
Erik Arvstedt
1d5ea10bee std.rand: fixup 'improve random float generation'
- Test: Fix bucket counting. Previously, the first hit was not counted.
  This off-by-one error slightly increased the mean of `*_total_variance`,
  which decreased the acceptance rate for a particular random seed
  from 95% to 92.6%. (Irrelevant for test failure because the seed is fixed.)
- Improve comments
2022-05-12 15:39:19 +02:00
Andrew Kelley
5c20c7036b
Merge pull request #10796 from marler8997/envmap
Envmap
2022-05-12 02:49:11 -04:00
Jonathan Marler
aef642fc07 remove RtlUpcaseUnicodeString, no longer needed 2022-05-11 18:43:41 -06:00
Jonathan Marler
2ddfe16e1e fix ntdll extern casing
Co-authored-by: Veikka Tuominen <git@vexu.eu>
2022-05-11 18:41:54 -06:00
Jonathan Marler
a38e6a64d3 document that on Windows, all key arguments in EnvMap must be valid utf8 2022-05-11 18:41:23 -06:00
Jonathan Marler
8492ced075 incorporate review changes from squeek 2022-05-11 18:41:23 -06:00
Jonathan Marler
71f69190ef some fixes to the EnvMap HashContext 2022-05-11 18:41:23 -06:00
Jonathan Marler
1c874a871f reverse some of the now unneeded changes from squeek 2022-05-11 18:41:23 -06:00
Jonathan Marler
e65d8f82c5 add unicode support 2022-05-11 18:41:23 -06:00
Jonathan Marler
69f0a5587d remove extra storage from EnvMap on windows 2022-05-11 18:40:53 -06:00
Ryan Liptak
e70cb04f89 EnvMapWindows: Fix putUtf8 not uppercasing keys 2022-05-11 18:40:53 -06:00
Ryan Liptak
b2b48fbf2c Set EnvMap.Size to BufMap.BufMapHashMap.Size
Now that BufMap.BufMapHashMap is pub, we can just get Size directly
2022-05-11 18:40:53 -06:00
Ryan Liptak
a2069612a5 Fix regression in RunStep.addPathDir
`key` was never being given a value, caused by b83cea12f3
2022-05-11 18:40:53 -06:00
Ryan Liptak
a65be05a6e Make the BufMap.count return value match its underlying HashMap's Size
Fixes a process.EnvMap compile error on 32-bit architectures
2022-05-11 18:40:53 -06:00
Jonathan Marler
9e89000ffc Update usages of process.getEnvMap and change BufMap -> EnvMap where applicable
# Conflicts:
#	lib/std/build/RunStep.zig
2022-05-11 18:40:53 -06:00
Ryan Liptak
15d5988e69 Add process.EnvMap, a platform-independent environment variable map
EnvMap provides the same API as the previously used BufMap (besides `putMove` and `getPtr`), so usage sites of `getEnvMap` can usually remain unchanged.

For non-Windows, EnvMap is a wrapper around BufMap. On Windows, it uses a new EnvMapWindows to handle some Windows-specific behavior:

- Lookups use Unicode-aware case insensitivity (but `get` cannot return an error because EnvMapWindows has an internal buffer to use for lookup conversions)
- Canonical names are returned when iterating the EnvMap

Fixes #10561, closes #4603
2022-05-11 18:40:53 -06:00
Andrew Kelley
d383b940c2 Revert "add std.rand.RomuTrio"
This reverts commit d1f1f5124f.

The unit tests did not pass on `-target mips-linux`.
2022-05-11 13:50:14 -07:00
Francesco Alemanno
d1f1f5124f add std.rand.RomuTrio 2022-05-11 15:52:38 -04:00
Meghan
3a64693db3
std: add http definitions for Method and Status (#10661) 2022-05-11 15:43:18 -04:00
Andrew Kelley
19003de64c
Merge pull request #10595 from squeek502/getenvW-case
os.getenvW: Fix case-insensitivity for Unicode env var names
2022-05-11 15:33:04 -04:00
Veikka Tuominen
090461a695
Merge pull request #11618 from arBmind/json-stringify-patch
JSON stringify string setting affects keys
2022-05-11 19:20:19 +03:00
Jakub Konka
6608fa1353
Merge pull request #11628 from ziglang/x64-shifts 2022-05-11 08:24:03 +02:00
Andrew Kelley
b33c8b0b06 Sema: comptime float negation supports negative zero
When handling the `negate` ZIR instruction, Zig now checks for a
comptime operand and handles it as a special case rather than lowering
it as `0 - x` so that the expression `-x` where `x` is a floating point
value known at compile-time, will get the negative zero bitwise
representation.
2022-05-10 21:50:55 -07:00
Andrew Kelley
f5edf78eea
Merge pull request #10143 from nuald/single-threaded-cpp1
Normalized C++ compilation options for single-threaded targets
2022-05-10 23:38:44 -04:00
Andrew Kelley
458943e324
Merge pull request #9831 from mathetake/llvmvisibility
Stage1: Add Visibility field to ExportOptions.
2022-05-10 22:04:30 -04:00
Andrew Kelley
ed63d6c7fd
Merge pull request #10428 from mrakh/rand_float_improvement
Improve stdlib's random float generation
2022-05-10 22:03:29 -04:00
Andrew Kelley
7bedeb9659 std.rand: move tests to a separate test file 2022-05-10 19:02:03 -07:00
Mahdi Rakhshandehroo
550888e2ac std: improve random float generation 2022-05-10 18:50:12 -07:00
Silver
e0a514df41 std: make IntegerBitSet and ArrayBitSet have defined memory layout
This is useful for wrapping C libraries and native interfaces that make use of bit sets
2022-05-10 21:30:58 -04:00
Andrew Kelley
45415093c6 reduce the scope of this branch
* back out the changes to RunStep
 * move the disabled test to the .cpp code and avoid a confusing
   name-collision with the _LIBCPP macro prefix
 * fix merge conflict with the edits to the same test that ensure global
   initializers are called.

Now this branch is only concerned with single-threaded targets and
passing the correct macro defines to libc++.
2022-05-10 17:31:54 -07:00
Andrew Kelley
1ff9a18cd3 stage1: back out the broken visibility changes
```
$ valgrind ./zig test ../test/behavior.zig -target powerpc-linux-musl -lc -I../test
==2828778== Invalid read of size 1
==2828778==    at 0x6EA0265: LLVMSetVisibility (in /home/andy/Downloads/zig/build/zig)
==2828778==    by 0x1BCE60B: do_code_gen(CodeGen*) (codegen.cpp:9031)
==2828778==    by 0x1BD51E2: codegen_build_object(CodeGen*) (codegen.cpp:10610)
==2828778==    by 0x1BA5C17: zig_stage1_build_object (stage1.cpp:132)
==2828778==    by 0xE61E24: Module.build_object (stage1.zig:149)
==2828778==    by 0xC3D4CE: Compilation.updateStage1Module (Compilation.zig:5025)
==2828778==    by 0xC3117E: Compilation.performAllTheWork (Compilation.zig:2691)
==2828778==    by 0xC2A3ED: Compilation.update (Compilation.zig:2098)
==2828778==    by 0xBB9D1F: main.updateModule (main.zig:3104)
==2828778==    by 0xB16B75: main.buildOutputType (main.zig:2793)
==2828778==    by 0xAD0526: main.mainArgs (main.zig:225)
==2828778==    by 0xACFCB9: main (stage1.zig:48)
```

Since the plan is to ship stage3 for Zig 0.10.0, the stage1
implementation of this hardly matters.
2022-05-10 16:43:51 -07:00
Alexander Slesarev
3997828a61 Added _LIBCPP_HAS_NO_THREADS for single_threaded binaries linked with libcxx.
Fixed single-threaded mode for Windows.
2022-05-10 16:40:48 -07:00
Andrew Kelley
c4c5020f02 fixups to the previous commit
* Rename std.builtin.GlobalVisibility to std.builtin.SymbolVisibility
 * Add missing compile error. From the LLVM language reference: "A
   symbol with internal or private linkage must have default
   visibility."
2022-05-10 15:44:40 -07:00
Takeshi Yoneda
9654a54d4a Add Visibility field to ExportOptions.
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2022-05-10 15:21:48 -07:00
Kirk Scheibelhut
67c4b16d6e docs: T.bit_count -> @typeInfo(T).Int.bits
bit_count was removed in #6246
2022-05-10 17:28:44 -04:00