4144 Commits

Author SHA1 Message Date
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
viri
b2879825d7 std.windows: fix OVERLAPPED, add OVERLAPPED_ENTRY 2021-06-13 10:26:02 +03:00
Garrett Squire
a6d72fea06 Make std.ChildProcess exit code u8 to match std.process.exit
This patch adjusts the exit code for a child process to be a u8. Since
the WEXITSTATUS macro returns the lower eight bits, it's safe to assume
that we can truncate the returned u32.
2021-06-12 23:13:14 +03:00
LemonBoy
44cdafd9d4 std: Fix complex ldexp implementation
Two bugs in the implementation ported from musl made all the complex
functions relying on ldexp return incorrect results in some cases.

Spotted in #9047
2021-06-12 19:56:08 +03:00
Veikka Tuominen
0d022eb1d6 zig fmt: rewrite byteOffsetOf to offsetOf 2021-06-12 19:16:01 +03:00
Exonorid
f63338195d Renamed @byteOffsetOf to @offsetOf 2021-06-12 19:16:01 +03:00
protty
2ba68f9f4c
std.Thread.Futex addition (#9070)
* std.Thread.Futex: implementation + tests

* std.Thread.Futex: fix darwin compile errors

* std.Thread.Futex: fix wait() documentation typo

* std.Thread.Futex: fix darwin version check

* std.Thread.Futex: remove unnecessary comptime keyword
2021-06-12 08:51:37 -05:00
Veikka Tuominen
2b2efa24d0 std.build: don't default to static linkage 2021-06-12 14:23:07 +03:00
LemonBoy
986a71234b std: Move PDB-related code into its own file
No functional changes are expected, this patch is only moving some code
in order to slim the huge bowl of spaghetti that is debug.zig.

The amount of memory leaked on error is much less than before but not
zero, some further work is required to smooth the edges of this old part
of the stdlib.
2021-06-12 10:51:43 +03:00
Andrew Kelley
da4081fe21 cleanups to previous commit
* fix a merge conflict discovered upon rebasing latest master
 * rename Target.Cpu.Feature.Set.subSet to isSuperSetOf
 * convert a comment into an assert
2021-06-11 14:01:13 -07:00
Edward Dean
7ba175cd8b Add CPU feature check to standardTargetOptions
If there is a mismatch of CPU features provided
compared to the whitelist, then will fail the build and
print what the expected CPU model is and the feature
set for the model. Also prints what features need to be
removed.
2021-06-11 13:32:28 -07:00
Evan Haas
45212e3b33 translate-c: Implement flexible arrays
Fixes #8759
2021-06-11 21:31:39 +03:00
codic12
d8b133d733 c.zig: fix waitpid() definition 2021-06-11 20:43:14 +03:00
Ellis Trisk-Grove
ba7bfe949e std.build.InstallDir: make dupe() a public function
Co-authored-by: Veikka Tuominen <git@vexu.eu>
2021-06-11 20:24:56 +03:00
Asa Zeren
6cc8845802 Change defineCMacro to take separate name and value arugments
Before this change, when one or more of name or value are not known at
comptime, build.zig files must allocate and do the concatanation, which can be
cumbersome, and also adds a redundant allocation when name and value are
slices. The new version only does a single allocation directly in the builder's
allocator to concatonate name and value.

The origional behavior is available in defineCMacroRaw, for use in situations
such as parseing c compiler arguments.

Additionally, several places have been updated to use the new funtions.
2021-06-11 20:18:19 +03:00
Veikka Tuominen
0bde5ce369
Merge pull request #8330 from kivikakk/single-limb-bigint-overflow
bigint add failures with aliasing
2021-06-11 19:17:01 +03:00
Veikka Tuominen
c5d4122684
Merge pull request #7959 from MasterQ32/build_rewrite
Make build.zig ready for generated files
2021-06-11 19:13:14 +03:00