100 Commits

Author SHA1 Message Date
jdmichaud
49c9975484
zig fmt: respect trailing commas in inline assembly 2021-08-29 11:57:32 +02:00
Andrew Kelley
d29871977f remove redundant license headers from zig standard library
We already have a LICENSE file that covers the Zig Standard Library. We
no longer need to remind everyone that the license is MIT in every single
file.

Previously this was introduced to clarify the situation for a fork of
Zig that made Zig's LICENSE file harder to find, and replaced it with
their own license that required annual payments to their company.
However that fork now appears to be dead. So there is no need to
reinforce the copyright notice in every single file.
2021-08-24 12:25:09 -07:00
Andrew Kelley
a98fa56ae9 std: [breaking] move errno to become an nonexhaustive enum
The primary purpose of this change is to eliminate one usage of
`usingnamespace` in the standard library - specifically the usage for
errno values in `std.os.linux`.

This is accomplished by truncating the `E` prefix from error values, and
making errno a proper enum.

A similar strategy can be used to eliminate some other `usingnamespace`
sites in the std lib.
2021-08-24 01:23:28 -04:00
Andrew Kelley
7a595f2e6c remove unused parameters 2021-06-21 17:03:03 -07:00
Jacob G-W
9fffffb07b fix code broken from previous commit 2021-06-21 17:03:03 -07:00
Jacob G-W
641ecc260f std, src, doc, test: remove unused variables 2021-06-21 17:03:03 -07:00
Veikka Tuominen
e63ff4f1c1 add ast-check flag to zig fmt, fix found bugs 2021-06-14 00:16:40 +03:00
LemonBoy
7babff0bc6 compiler-rt: Fix __floatunsitf signature
The function transforms an unsigned integer into a f128.

Closes #8996
2021-06-05 13:32:41 -04:00
Isaac Freund
608bc1cbd5
stage2: disallow 1.e9 and 0x1.p9 as float literals
Instead require `1e9` and `0x1p9`, disallowing the trailing dot.

This change to the grammar is consistent with forbidding `1.` and `0x1.`
as float literals and ensures there is only one way to do things here.
2021-05-31 19:51:11 +00:00
Michael Dusan
0f26120377 overhaul elf csu (c-runtime startup) logic
- more support for linux, android, freebsd, netbsd, openbsd, dragonfly
- centralize musl utils; musl logic is no longer intertwined with csu
- fix musl compilation to build crti/crtn for full archs list
- fix openbsd to support `zig build-lib -dynamic`
- initial dragonfly linking success (with a warning)

ancillary:

- fix emutls (openbsd) tests to use `try`
2021-05-23 15:38:57 -04:00
Andrew Kelley
84fdeb47a3 compiler-rt: fix usage of builtin
In this branch std.builtin and `@import("builtin")` are rearranged, fix
a trivial compile error due to the conflict with master.
2021-05-17 14:18:30 -07:00
Andrew Kelley
597082adf4 Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgen
Conflicts:
 * build.zig
 * src/Compilation.zig
 * src/codegen/spirv/spec.zig
 * src/link/SpirV.zig
 * test/stage2/darwin.zig
   - this one might be problematic; start.zig looks for `main` in the
     root source file, not `_main`. Not sure why there is an underscore
     there in master branch.
2021-05-15 21:44:38 -07:00
Andrew Kelley
826d833416
Merge pull request #8746 from koachan/sparc64-fixes
Various Linux/SPARCv9 fixes
2021-05-14 15:21:17 -04:00
LemonBoy
5185b5619a compiler-rt: Fix signedness mismatch in f128 mul impl
The `1 - shift` expression was computed using small unsigned types and
then casted to i32, producing either an underflow error or an incorrect
result.

Reported by `@notviri` in #8733
2021-05-14 15:11:54 -04:00
Koakuma
9e67c062c4 Add missing f128 compiler-rt shim 2021-05-12 20:13:29 +07:00
Andrew Kelley
5619ce2406 Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgen
Conflicts:
 * doc/langref.html.in
 * lib/std/enums.zig
 * lib/std/fmt.zig
 * lib/std/hash/auto_hash.zig
 * lib/std/math.zig
 * lib/std/mem.zig
 * lib/std/meta.zig
 * test/behavior/alignof.zig
 * test/behavior/bitcast.zig
 * test/behavior/bugs/1421.zig
 * test/behavior/cast.zig
 * test/behavior/ptrcast.zig
 * test/behavior/type_info.zig
 * test/behavior/vector.zig

Master branch added `try` to a bunch of testing function calls, and some
lines also had changed how to refer to the native architecture and other
`@import("builtin")` stuff.
2021-05-08 14:45:21 -07:00
Andrew Kelley
b6bb0ee1ac Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgen
Conflicts:
 * lib/std/os/linux/tls.zig
 * test/behavior/align.zig
 * test/behavior/atomics.zig
 * test/behavior/vector.zig
2021-05-08 10:53:22 -07:00
Veikka Tuominen
7fe39c4e96 update usage of std.testing in compiler_rt 2021-05-08 15:15:30 +03:00
Veikka Tuominen
fd77f2cfed std: update usage of std.testing 2021-05-08 15:15:30 +03:00
LemonBoy
4bf093f1a0 compiler-rt: Better selection of __clzsi implementation
To be honest all this detection logic is starting to become a real PITA,
the ARM32 version can be possibly removed as the generic version
optimizes pretty well...
2021-05-04 18:45:52 +02:00
Andrew Kelley
e86cee258c Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgen
In particular I wanted the change that makes `suspend;` illegal in the
parser.
2021-04-24 10:44:41 -07:00
Andrew Kelley
93d1c2d6d4 std: fix compile errors caught by stage2 AstGen
Follow-up from 507a8096d2f9624bafaf963c3e189a477ef6b7bf
2021-04-22 19:32:57 -07:00
Andrew Kelley
429cd2b5dd std: change @import("builtin") to std.builtin 2021-04-15 19:06:39 -07:00
LemonBoy
bd4421befe compiler-rt: Don't pass f16 around as arguments
Fixes some failures on AArch64.
f16 was a mistake.
2021-04-15 21:52:08 +02:00
LemonBoy
5bc1dc59e6 compiler-rt: Implement __trunctfhf2 2021-04-15 18:23:09 +02:00
LemonBoy
b29677dd12 compiler-rt: Implement __extendhftf2 2021-04-15 18:21:58 +02:00
LemonBoy
8e0b2f0e52 compiler-rt: Fix typo in implementation of fp truncation ops
The problem went unnoticed for years, yay.
2021-04-15 18:14:25 +02:00
Andrew Kelley
5f35dc0c0d zig fmt the std lib 2021-02-24 21:29:23 -07:00
LemonBoy
134f5fd3d6 std: Update test "" to test where it makes sense 2021-01-22 15:46:58 +01:00
Koakuma
1d67ab8823 Fix _Qp_cmp definition 2021-01-15 19:07:39 +07:00
Koakuma
bbb58b10f6 Add compiler-rt stub for SPARC CPUs 2021-01-15 19:07:38 +07:00
Sébastien Marie
d7aa7dbab2 implement emutls in compiler_rt 2021-01-12 05:39:46 +00:00
Frank Denis
6c2e0c2046 Year++ 2020-12-31 15:45:24 -08:00
LemonBoy
afd491c07e compiler-rt: Fix compilation of clzsi for armv6 targets 2020-12-09 16:48:02 +01:00
LemonBoy
518168edb2 compiler-rt: Avoid exposing atomic builtins when not supported
Let's a void any kind of compilation/LLVM errors for niche targets such
as AVR/MSP430 or ARM v6m. By not exporting any atomic builtin anymore
the user is free to provide their own implementation (that disable the
IRQs) or to provide the --single-threaded switch and forget about this.
2020-12-09 16:33:53 +01:00
Jan Prudil
aadccc4206 Make std.meta.Int accept a signedness parameter 2020-10-17 14:09:59 +02:00
Vignesh Rajagopalan
2ab0c7391a Rename .macosx to .macos 2020-10-12 18:56:25 -04:00
Vexu
1df0f3ac24
update uses of deprecated type field access 2020-09-03 18:10:40 +03:00
LemonBoy
e355bcce36 compiler-rt: Add missing floatdisf routine
Add __floatdisf and __aeabi_l2f

Closes #6188
2020-08-30 00:28:18 -04:00
Andrew Kelley
4a69b11e74 add license header to all std lib files
add SPDX license identifier
copyright ownership is zig contributors
2020-08-20 16:07:04 -04:00
Andrew Kelley
d159ba9295 zig fmt 2020-08-04 23:04:20 -07:00
Vexu
1f8f434b9c
compiler_rt: add floatditf 2020-07-29 18:03:44 +03:00
xackus
b8553b4813 compiler-rt: fix bugs uncovered by previous commit 2020-07-05 20:44:08 +02:00
Tadeo Kondrak
350b2adacd
std.meta.IntType -> std.meta.Int 2020-04-28 19:11:31 -06:00
Tadeo Kondrak
f977155fdb
@Vector -> std.meta.Vector 2020-04-28 00:47:13 -06:00
LemonBoy
a0b73c9f02 compiler-rt: Separate max size allowed for load/store and CAS
The v6m ISA has no way to express a CAS loop natively without turning
off the interrupts or using the kernel cmpxchg harness.

On such a platform the user has to provide a few __sync_* builtins to
satisfy the linker.
2020-04-06 12:52:53 -04:00
daurnimator
e9e43ed0d3
compiler_rt/atomics: be consistent with const value 2020-04-05 14:08:25 +10:00
daurnimator
f947444362
Tidy up compiler_rt/atomics 2020-04-05 14:06:12 +10:00
Andrew Kelley
e03cbb117e
compiler-rt: don't forget to export these functions 2020-04-03 16:07:32 -04:00
LemonBoy
ed69821f5b
compiler-rt: Add the __atomic family of builtins
The implementation was checked against a few files using std::atomic and
compiled using zig c++.

Closes #4887
2020-04-03 16:04:44 -04:00