Commit graph

12170 commits

Author SHA1 Message Date
LemonBoy
4420afe64d tests: Use {s} instead of {} when formatting strings 2021-01-02 17:12:57 -07:00
LemonBoy
1c13ca5a05 stage2: Use {s} instead of {} when formatting strings 2021-01-02 17:12:57 -07:00
LemonBoy
dd973fb365 std: Use {s} instead of {} when printing strings 2021-01-02 17:12:57 -07:00
LemonBoy
5a06fdfa55 Use same brace pairs for arrays/slices/vectors 2021-01-02 17:12:57 -07:00
LemonBoy
d4a8fc8b67 Small cleanup 2021-01-02 17:12:57 -07:00
data-man
2b5e93fd3e Add formatting for arrays 2021-01-02 17:12:57 -07:00
LemonBoy
6f53653db1 std: Refactor the slice formatting code
Also fix the `*` specifier for more types, print an error message if we
can't show the value address.
2021-01-02 17:12:57 -07:00
ryuukk
5275280ede Formatting fix 2021-01-02 17:12:57 -07:00
ryuukk
1d97747665 Pretty print Slices
This code is adapted from pixelherodev paste from IRC

I have added a new fmt option to handle printing slice values ``{v}`` or ``{V}``

While i think it can be made the default, i want your opinion about it

```zig
    var slicea = [0]u32{};
    var sliceb = [3]u32{ 1, 2, 3 };

    std.log.info("Content: {v}", .{slicea});
    std.log.info("Content: {v}", .{sliceb});
```

will print:

```
info: Content: []
info: Content: [1, 2, 3]
```

Question:

Should we drop ``{v}`` and make it the default behavior?
2021-01-02 17:12:57 -07:00
Cameron Conn
db1e97d4b1
Improve documentation for ArrayList, ArrayListUnmanaged, etc. (#7624)
* Improve ArrayList & co documentation

- Added doc comments about the validity of references to elements in
an ArrayList and how they may become invalid after resizing operations.
- This should help users avoid footguns in future.

* Improve ArrayListUnmanaged & co's documentation

- Port improved documentation from ArrayList and ArrayList aligned to
  their unmanaged counterparts.
- Made documentation for ArrayListUnmanaged & co more inclusive and
  up-to-date.
- Made documentation more consistent with `ArrayList`.

* Corrections on ArrayList documentation.

- Remove incorrect/unpreferred wording on ArrayList vs
  ArrayListUnmanaged.
- Fix notes about the alignment of ArrayListAligned
- Be more verbose with warnings on when pointers are invalidated.
- Copy+paste a few warnings

* add warning to replaceRange

* revert changes to append documentation
2021-01-02 19:06:51 -05:00
LemonBoy
1856dfea6b stage1: Use correct format specifier for size_t parameters
Use `Iu` on Windows, the integer width depends on the target being
a 32bit or a 64bit one.
2021-01-02 16:04:34 -08:00
Sizhe Zhao
af8eab546e Fix usage message 2021-01-02 16:03:41 -08:00
Andrew Kelley
44c9bf559b std: disable a couple tests on windows
They are passing but we're hitting OOM on the Windows CI server. This is
to buy us more time until stage2 rescues us from the CI memory crisis.
2021-01-02 12:21:19 -07:00
Jakub Konka
5a6579611f
Merge pull request #7506 from kubkon/fix-6923
zig cc: detect framework include paths when native
2021-01-02 20:08:37 +01:00
Jakub Konka
763d807377 Duplicate OSAtomic.h between aarch64 and x86_64
The reason this is required is for two reasons: 1) the libc
targeting `aarch64` macOS is slightly newer than that targeting
`x86_64`, and 2) `OSAtomic.h` uses relative imports rather than
system-wide imports for accompanying headers which clearly is an
oversight on Apple's part. Until such time when `libkern` headers
between `x86_64` and `aarch64` are identical, this will require a
manual intervention to duplicate the relevant headers between the
respective architectures.
2021-01-02 15:30:14 +01:00
Jakub Konka
91a35e1a92 Detect native iframework dirs on macOS
This commit adds default search paths for system frameworks
on macOS while also adding `-isysroot` for OS versions at least BigSur.
Since BigSur (11.0.1), neither headers nor libs exist in standard
root locations (`/usr/include`, `/System/Library/Frameworks`). Instead, they
are now exclusively part of the installed developer toolchain (either
via XCode.app or CLT), and specifying `-isysroot` allows us to keep
using universal search paths such as `/System/Library/Frameworks` while
only changing the include flag from `-iframework` to
`-iframeworkwithsysroot`.
2021-01-02 15:29:05 +01:00
Sébastien Marie
a9c75a2b48 openbsd: add pollfd interface 2021-01-01 20:05:19 -08:00
Andrew Kelley
ca0b03f7b5 Merge branch 'jayschwa-ci-deep-clone'
closes #7629
2021-01-01 21:03:35 -07:00
Andrew Kelley
ec8c25fd8f Restore the reverted semantic versioning commits
restore "Comply with semantic versioning pre-release format"
restore "stage2: SemVer compliance for development builds"
restore "Remove 'g' prefix from commit hash in Zig semver"

This reverts commit d96d8639e5.
This reverts commit e8810f5794.
This reverts commit 9afe5859a3.
2021-01-01 21:02:32 -07:00
Jay Petacat
993f4b5a06 ci: fix git describe
git describe is used for version string creation, but it had to be
reverted in commit 69da6ba because it was broken in CI builds.
Azure Pipelines and Drone perform shallow clones by default.
This change reconfigures them to fetch history and tags. It adds tens of
seconds, which is negligible compared to overall build and test time.

Related: #6466, #6509, #7601
2021-01-01 20:41:39 -07:00
Isaac Freund
d3ecbbebd3 std/build: assert that install paths are relative
If absolute paths are passed they will work unless $DESTDIR is set,
which causes subtly broken build.zig's.
2021-01-01 18:57:23 -08:00
Andrew Kelley
3dafc5b9a3 Merge branch 'daurnimator-meta.fields'
closes #7420
2021-01-01 16:01:27 -07:00
daurnimator
bbab5e19b4 std: loop in trailer flags can be indexing operation 2021-01-01 15:48:48 -07:00
daurnimator
4387e50d4f std: use FieldEnum from TrailerFlags 2021-01-01 15:48:48 -07:00
daurnimator
9c97a07f18 std: have std.meta.fieldInfo take an enum rather than a string 2021-01-01 15:48:46 -07:00
daurnimator
73bf2e1525 std: add std.meta.FieldEnum 2021-01-01 15:48:04 -07:00
joachimschmidt557
c5ec096b2f stage2 AArch64: add logical (shifted register) instructions 2021-01-01 14:43:12 -08:00
Andrew Kelley
6c0c275b27 Merge branch 'LemonBoy-panicthreadid'
closes #6869
2021-01-01 14:57:03 -07:00
Andrew Kelley
c24540d263 std.debug: adjust panic message
also extern "c" instead of extern "pthread"
2021-01-01 14:56:26 -07:00
LemonBoy
c9756ca0e1 std: Show the panicking thread ID
Annotate the panic message with the thread ID to know who's the culprit.
2021-01-01 14:54:53 -07:00
Sizhe Zhao
3bce5b2f30 Fix ssize_t definition 2021-01-01 13:47:18 -08:00
Andrew Kelley
99203e4177
Merge pull request #7578 from vrischmann/walker
fix segfault in std.fs.Walker
2021-01-01 13:28:01 -08:00
Andrew Kelley
4cc374c639
Merge pull request #7634 from daurnimator/packed-init-all-to
Add PackedIntArray .initAllTo function
2021-01-01 13:23:18 -08:00
Andrew Kelley
dfacac916f
Merge pull request #7565 from joachimschmidt557/stage2-arm
stage2 ARM: add conditional branches
2021-01-01 13:19:11 -08:00
Jakub Konka
5dfeb6cbc8
macho: unblock stage2 on 32bit platforms (#7632)
* macho: unblock stage2 on 32bit platforms

Unblocks compilation of stage2 on 32bit platforms, and fixes #7630.

* Use libstd convention: reads - usize, writes - u64
2021-01-01 21:28:52 +01:00
Andrew Kelley
1cef0be01b
Merge pull request #7640 from daurnimator/use-markInvalidUserInput
Don't process.exit() on invalid option use .markInvalidUserInput
2021-01-01 11:48:36 -08:00
daurnimator
aa631cfd1f
Build errors should be followed by two newlines 2021-01-02 04:13:08 +11:00
daurnimator
b3c9dfc9cc
Don't process.exit() on invalid option use .markInvalidUserInput 2021-01-02 04:09:59 +11:00
daurnimator
ad1780959d
std/build.zig: use (existing) warn function alias 2021-01-02 04:01:21 +11:00
daurnimator
03e2c53747
Add workaround in PackedIntArray .initAllTo for #7635 2021-01-02 01:10:47 +11:00
daurnimator
31ba9d569b
Add PackedIntArray .initAllTo function 2021-01-02 00:52:47 +11:00
joachimschmidt557
a2ab2fb9b0
stage2 ARM: Add simple tests for conditional branching 2021-01-01 12:22:17 +01:00
joachimschmidt557
c52ca0b178
stage2 ARM: implement genSetReg with compare_flags 2021-01-01 12:22:16 +01:00
joachimschmidt557
85e1b47c40
stage2 ARM: implement genCondBr for compare_flags 2021-01-01 12:22:16 +01:00
joachimschmidt557
4d2919a1ee
stage2 ARM: implement genCondBr 2021-01-01 12:22:14 +01:00
Andrew Kelley
93bb1d93cd
Merge pull request #7616 from ziglang/stage2-inferred-vars
stage2: inferred local variables
2020-12-31 16:28:08 -08:00
Andrew Kelley
982acc22fd stage2: compile error for invalid var type 2020-12-31 17:25:42 -07:00
Andrew Kelley
79a9391414 stage2: no Payload for Type.Tag.inferred_alloc
Simpler, less memory usage. The Value has all the info needed.
2020-12-31 16:51:40 -07:00
Frank Denis
6c2e0c2046 Year++ 2020-12-31 15:45:24 -08:00
Andrew Kelley
69da6ba14d Merge branch 'revert-semver'
Updating the download page is stuck because in all cases
`zig version` is outputting 0.8.0 rather than e.g.
0.8.0-dev.716+fbf269cc4.

See #6466
2020-12-31 16:41:54 -07:00