Commit graph

4160 commits

Author SHA1 Message Date
Jonathan Marler
cadf32d745 Expose mechanism to convert log level to text 2021-06-24 04:30:05 -06:00
Jonathan Marler
642f5df0ab Expose default std.log implementation
This allows root.log implementations to capture log messages, process them, and forward them to the default implementation if desired.
2021-06-24 04:11:28 -06:00
Jonathan Marler
0134cb0214 nice error for unsupported async sockets on Windows 2021-06-23 12:54:20 +03:00
Evan Haas
0e7897a9a2 translate-c: Remove usage of extern enum
Translate enum types as the underlying integer type. Translate enum constants
as top-level integer constants of the correct type (which does not necessarily
match the enum integer type).

If an enum constant's type cannot be translated for some reason, omit it.

See discussion https://github.com/ziglang/zig/issues/2115#issuecomment-827968279

Fixes #9153
2021-06-23 08:44:25 +03:00
Luna
d1f99eabb7 add compile error if root.log is not a function 2021-06-22 16:38:18 +03:00
Andrew Kelley
7bebb24838 fix unused locals from merge conflict 2021-06-21 17:09:22 -07:00
Andrew Kelley
d279a23c93 mips: fix syscall_pipe
Previously the fd parameter was ignored and so the result would not get
populated. Now it passes the fd pointer to the inline assembly so that
the results can be observed.
2021-06-21 17:03:04 -07:00
Andrew Kelley
7a595f2e6c remove unused parameters 2021-06-21 17:03:03 -07:00
Andrew Kelley
3d8aa97165 std.os.linux.bpf: fix incorrect usage of unexpectedErrno 2021-06-21 17:03:03 -07:00
Andrew Kelley
59d6b7bbb9 std.os.linux: fix splitValueBE64 2021-06-21 17:03:03 -07:00
Andrew Kelley
f21a3ed540 std.TrailerFlags: remove superfluous parameter 2021-06-21 17:03:03 -07:00
Andrew Kelley
98b10d94bf std.crypto.p256: fix neg function compile error
There was a typo here and the neg function referenced a non-existent
variable.
2021-06-21 17:03:03 -07:00
Andrew Kelley
2551598013 std: ArrayHashMap remove unused parameter 2021-06-21 17:03:03 -07:00
Jacob G-W
d14272ab68 std: fix code unblocked by previous commit 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
Jacob G-W
18c1007a34 stage2 tests: remove unused vars 2021-06-21 17:03:03 -07:00
Jacob G-W
796b420092 std.enums: make code correct zig and not stage1 2021-06-21 17:03:02 -07:00
Veikka Tuominen
8a6de78e07
Merge pull request #8717 from mchudleigh/dwarf-on-windows
Dwarf on windows
2021-06-21 18:48:59 +03:00
Andrew Kelley
fc1feebdc0
Merge pull request #9168 from LemonBoy/fix-pie
std: Fix PIE startup sequence
2021-06-20 20:01:39 -04:00
Dmitry Matveyev
00982f75e9
stage2: Remove special double ampersand parsing case (#9114)
* Remove parser error on double ampersand

* Add failing test for double ampersand case

* Add error when encountering double ampersand in AstGen

"Bit and" operator should not make sense when one of its operands
is an address.

* Check that 2 ampersands are adjacent to each other in source string

* Remove cases of unused variables in tests
2021-06-20 21:04:14 +03:00
LemonBoy
e4225ca5f7 std: Make copy_file_range checks run at compile-time
* Avoid emitting the copy_file_range symbol at all to prevent link-time
  errors.
* Fix a bug in the check logic, the has_copy_file_range_syscall was
  set to the wrong value in case of ENOSYS
* If link_libc is true don't fall-back to the raw syscall approach,
  there's no policy about what to do in this case but let's follow what
  the other impls do.

Fixes #9146
2021-06-20 20:58:10 +03:00
mason1920
37a1028b6e Bring your own MAX_PATH_BYTES
Previous to #7082, users could overwrite PATH_MAX in the root file to support std.os.toPosixPath, permitting the "bring your own operating system" layer to implement the POSIX API for opening files. Unfortunately that is no longer the case.

This commit intends to fix what is arguably a regression from 0.7 in a way that doesn't break any code targeting 0.8.0, making it suitable to be included in a 0.8 patch release.
However in a future release that permits breaking changes, I am of the opinion that it would be beneficial to overwrite the value, even for "supported" operating systems. Same for all the other POSIX/BYOOS functions and values. However this is beyond the scope of this commit. Further discussion of this will be made into an issue in due time.
2021-06-20 19:49:48 +03:00
LemonBoy
fd6d5f1609 std: Fix PIE startup sequence
* Don't skip the TLS initialization (Fixes #9083)
* Add a test case where a PIE program is built and run
* Refactor the common initialization code in the Linux startup
  sequence.
2021-06-19 18:02:51 +02:00
Matt Chudleigh
24b1a0027f Fix crash when compiling with cygwin/msys on windows 2021-06-18 16:19:20 -07:00
Matt Chudleigh
a6c2e44ae7 Add support for reading DWARF debug information from COFF files 2021-06-18 16:19:20 -07:00
Matt Chudleigh
2dcdaa7668 Support long section names in COFF files 2021-06-18 16:19:20 -07:00
Matt Chudleigh
fac0c6f25d Convert remaining addresses to u64 from usize in dwarf.zig 2021-06-18 16:19:20 -07:00
hadroncfy
1f29b75f08
HashMap.getOrPutAssumeCapacityAdapted should set key to undefined (#9138)
* std.hash_map.HashMap: getOrPutAssumeCapacityAdapted should set key to undefined

* add test for std.hash_map.HashMap.getOrPutAdapted
2021-06-18 08:52:30 +03:00
d18g
0e71e6ee0f
Fix lakemont CpuModel (#9099)
Lakemont has no x86, no MMX, no SSE and no way of handling any fp-math. In theory LLVM is able to implicitly use the soft-float emulation library calls to legalize any such operation but, given Zig's use of many non-standard features, sometimes we hit a weak spot in the X86 codegen backend.

Consider this as a work-around for this LLVM problem, fixing the problem in LLVM is not so high in my todo list as the target is pretty niche and Intel axed it in '19.

(Commit message by @LemonBoy)
2021-06-17 16:37:38 -04:00
Michael Dusan
bfe3558efe netbsd: add more std.os.bits 2021-06-16 14:46:25 -04:00
Isaac Freund
db08d4c3d6 zig build: add --libc general option
This new option sets a default libc paths file to be used for all
LibExeObjSteps. Setting LibExeObjStep.libc_file overrides this default.

This is required to allow users to cross compile projects linking system
libraries without needing to patch the build.zig.
2021-06-15 08:01:26 +03:00
Veikka Tuominen
97946e2a41
Merge pull request #9091 from Vexu/translate-c
Translate-c: move utility functions to a separate namespace
2021-06-15 07:59:46 +03:00
Björn Linse
ac42503266 std: don't reference non-existant ComptimeStringHashMap type 2021-06-15 07:57:07 +03:00
Andrew Kelley
7d5538c32b zig build: rename --lib-dir, --include-dir, --exe-dir
To --prefix-lib-dir, --prefix-include-dir, --prefix-exe-dir,
respectively.
2021-06-14 11:56:58 -07:00
Andrew Kelley
193c529b8c CLI: rename --override-lib-dir to --zig-lib-dir
This breaking change disambiguates between overriding the lib dir when
performing an installation with the Zig Build System, and overriding the
lib dir that the Zig installation itself uses.
2021-06-14 11:33:27 -07:00
Jan200101
5a4249fa25 specify the output lib, exe and include paths with flags 2021-06-14 20:26:54 +03:00
Veikka Tuominen
6dbdac4b60 replace usage of meta.cast with builtins
You weren't supposed to use these >:(
2021-06-14 20:13:39 +03:00
Veikka Tuominen
699b6cdf01 translate-c: move utility functions to a separate namespace 2021-06-14 20:13:34 +03:00
Veikka Tuominen
4173a2bc24 add a test for dup and dup2 2021-06-14 12:17:12 +03:00
Samadi van Koten
ee048d6569 Add std.os.dup() 2021-06-14 12:17:12 +03:00
Isaac Freund
2d4c439652 std: fix auto hash of tagged union with void field 2021-06-14 12:14:04 +03:00
Veikka Tuominen
e63ff4f1c1 add ast-check flag to zig fmt, fix found bugs 2021-06-14 00:16:40 +03:00
jacob gw
b9f07b7ac2 format zig files and add formatting check to ci 2021-06-13 22:33:39 +03:00
Veikka Tuominen
37f36da391
Merge pull request #9092 from xackus/translate-c-type-parsing
translate-c: improve type parsing
2021-06-13 19:51:22 +03:00
Veikka Tuominen
029fe6c9ab meta.cast: handle casts from negative ints to ptrs 2021-06-13 16:53:01 +03:00
Matthew Borkowski
483933d88d parse.zig: make parseForTypeExpr accept only a TypeExpr as body 2021-06-13 16:37:53 +03:00
Matthew Borkowski
3692fb039d parse.zig: simplify parseSwitchProng and make one item cases with trailing commas produce .switch_case_one nodes 2021-06-13 16:37:53 +03:00
Matthew Borkowski
51beb71480 parse.zig: simplify parsing functions that build lists by always using scratch buffer 2021-06-13 16:37:53 +03:00
Jarred Sumner
540b52931a Improve error message when std.fmt.format is missing arguments
Use fmt in fmt so the number in the error message is fmt'd
2021-06-13 10:33:49 +03:00