Commit Graph

22498 Commits

Author SHA1 Message Date
dweiller
edc0e84270 allow custom test runners to import modules 2023-02-08 16:35:32 +11:00
dweiller
1f7390f399 fix custom test runner package path resolution
Fixes #13970.

This fix makes test runners resolve package paths relative to the
directory the test runner is in. This means it is not possible to import
a file from outside the file tree root at the directory containing the
test runner.
2023-02-08 14:30:37 +11:00
Jakub Konka
9ccd8ed0ad
Merge pull request #14575 from ziglang/fix-14459
macho+zld: fix misc alignment issues when parsing object files in archives
2023-02-07 15:20:56 +01:00
Jakub Konka
4b1a883d35 macho: ensure local syms buffer is nlist_64 aligned when re-reading from file 2023-02-07 03:14:26 +01:00
Jakub Konka
f63eda3f6a macho: parse and sort data-in-code entries ahead of time 2023-02-06 16:08:42 +01:00
Jakub Konka
b32f5ee932 macho: downgrade alignment requirements for symtab in object files
Parse and sort relocations by address descending.
2023-02-06 13:23:08 +01:00
Andrew Kelley
a5b34a61ab
Merge pull request #14562: std.Build: enhancements to ConfigHeaderStep 2023-02-05 08:27:53 -05:00
Andrew Kelley
b29e3fa2cd std.Build: enhancements to ConfigHeaderStep
Breaking API change to std.Build.addConfigHeader. It now uses an options
struct.

Introduce std.Build.CompileStep.installConfigHeader which also accepts
an options struct. This is used to add a generated config file into the
set of installed header files for a particular compilation artifact.

std.Build.ConfigHeaderStep now additionally supports a "blank" style
where a header is generated from scratch. It no longer exposes
`output_dir`. Instead it exposes a FileSource via `output_file`.
It now additionally accepts an `include_path` option which affects the
include path of CompileStep when using the `#include` directive, as well
as affecting the default installation subdirectory for header
installation purposes.

The hash used for the directory to store the generated config file now
includes the contents of the generated file. This fixes possible race
conditions when generating multiple header files simultaneously.

The values hash table is now an array hash map, to preserve order for
the "blank" use case.

I also took the opportunity to remove output_dir from TranslateCStep and
WriteFileStep. This is technically a breaking change, but it was always
naughty to access these fields.
2023-02-05 06:26:30 -07:00
David Vanderson
b04e48566c std.build: support for generated c headers
Add ability to generate a c header file from scratch, and then both
compile with it and install it if needed.

Example:
```zig
    const avconfig_h = b.addConfigHeader(.{ .path = "libavutil/avconfig.h" }, .generated, .{
        .AV_HAVE_BIGENDIAN = 0, // TODO: detect based on target
        .AV_HAVE_FAST_UNALIGNED = 1, // TODO: detect based on target
    });

    lib.addConfigHeader(avconfig_h);

    lib.installConfigHeader(avconfig_h);
```
2023-02-05 06:26:30 -07:00
Andrew Kelley
11cc1c16fa make @embedFile support module-mapped names the same way as @import
closes #14553
2023-02-05 03:25:43 -05:00
Stephen Gregoratto
d4ce0fe7fe Update Linux syscall list for 6.1, support Mips64
Follow up for #14541.
2023-02-05 03:25:21 -05:00
ee7
289e8fab79 langref, tools: rename --single-threaded to -fsingle-threaded
Commit 40f5e5dfc6 ("CLI: introduce -fsingle-threaded/
-fno-single-threaded", 2021-12-01) removed the `--single-threaded`
option, but didn't update all mentions of it.

    $ zig version
    0.11.0-dev.1568+c9b957c93
    $ zig build-exe --help | grep single
      -fsingle-threaded         Code assumes there is only one thread
      -fno-single-threaded      Code may not assume there is only one thread
    $ zig build-exe --single-threaded foo.zig
    error: unrecognized parameter: '--single-threaded'
2023-02-04 23:24:07 +02:00
Jonathan Marler
1876eaec51 mark deprecated assumeSentinel as pub
assumeSentinel was removed and replaced with a compileError, but it's
not pub, so the error message indicates it's private rather than
providing the compileError message.
2023-02-04 23:19:00 +02:00
Nicolas Goy
b7c96c3bbd Allow const for ArrayList.getLast, fix #14522 2023-02-04 15:24:45 -05:00
Suirad
7f24993772 Add support for mips64/mips64el 2023-02-04 15:19:53 -05:00
Manlio Perillo
c1f71963a9 compiler_rt: fix and improve documentation
- In Integer Bit Operations, use zeros consistently and fix the
    incorrect function descriptions
  - In ucmp, fix the incorrect signedness of the operands
  - In Integer Arithmetic, document the signedness of the operands in
    div, udiv, mod, umod, udivmod and divmod as it is done in LLVM
    documentation
  - In Float Conversion, replace "int_to_float" to "int to float" and
    "uint_to_float" to "uint to float"
2023-02-04 17:23:03 +02:00
Andrew Kelley
693b12f8e1 std.Build: support exposing and depending on zig modules
New API introduced: std.Build.addModule

This function exposes a zig module with the given name, which can be
used by packages that depend on this one via std.Build.Dependency.module.

std.Build.Pkg and related functionality is deleted. Every use case has a
straightforward upgrade path using the new Module struct.

std.Build.OptionsStep.getPackage is replaced by
std.Build.OptionsStep.createModule.

std.Build.CompileStep.addPackagePath is replaced by
std.Build.CompileStep.addAnonymousModule.

This partially addresses #14307 by renaming some of the instances of
"package" to "module".

Closes #14278
2023-02-04 01:55:39 -05:00
Marc Tiehuis
4009e0d2b1 remove stage1 workaround for big int set
Underlying fix should have been d7b029995c.

u128 limb sizes are still not fully tested as we are missing compiler-rt
support (__divei4, __modei4 on x86_64). Should be no zig blockers so the
assertion has been removed.
2023-02-04 00:29:04 -05:00
Luuk de Gram
c9b957c937 link: remove FnData and make it self-owned
This finishes the work started in #14502 where atoms are owned by the
linker themselves. This now makes debug atoms fully owned by dwarf,
and no information is left stored on the decl.
2023-02-03 22:55:46 +01:00
Andrew Kelley
60935decd3
Merge pull request #14523 from ziglang/zon
introduce Zig Object Notation and use it for the build manifest file (build.zig.zon)
2023-02-03 14:20:49 -05:00
Loris Cro
4c7f8286d5 autodoc: fix search regression 2023-02-03 18:05:07 +01:00
Loris Cro
e59ef95a40
Merge pull request #14515 from der-teufel-programming/autodoc-quickfixes
autodoc: Added `@qualCast` builtin function handling
2023-02-03 17:55:31 +01:00
Loris Cro
93c56a70c4
Merge pull request #14489 from der-teufel-programming/autodoc-initempty
autodoc: Implemented struct_init_empty for walkInstruction
2023-02-03 17:52:23 +01:00
Manlio Perillo
c181ba1022 langref: remove link to closed issue #4026
In the math builtin functions documentation, remove the link to issue
https://github.com/ziglang/zig/issues/4026, since it was closed by
https://github.com/ziglang/zig/pull/11532.
2023-02-03 14:49:17 +02:00
Ryan Liptak
9db084f43d Add test for optional error set return types
Closes #5820
2023-02-03 14:48:08 +02:00
Andrew Kelley
81c27c74bc use build.zig.zon instead of build.zig.ini for the manifest file
* improve error message when build manifest file is missing
 * update std.zig.Ast to support ZON
 * Compilation.AllErrors.Message: make the notes field a const slice
 * move build manifest parsing logic into src/Manifest.zig and add more
   checks, and make the checks integrate into the standard error
   reporting code so that reported errors look sexy

closes #14290
2023-02-03 00:06:11 -07:00
Andrew Kelley
873bb29c98 introduce ZON: Zig Object Notation
* std.zig.parse is moved to std.zig.Ast.parse
 * the new function has an additional parameter that requires passing
   Mode.zig or Mode.zon
 * moved parser.zig code to Parse.zig
 * added parseZon function next to parseRoot function
2023-02-03 00:06:11 -07:00
Jan Philipp Hafer
03cdb4fb58 compiler_rt: make README visually nice and improve explanations
This commit makes the text more dense with sources, noes the outstanding
audit and adds an explanation of the table before converting everything
to markdown tables.

For the status a checkmark or cross in utf8 encoding are used and the
input and output sizes of all operations are given inclusive comments for
understanding of the routines.

This should document all compiler_rt integer and float routines, but
does not include a documentation of existing ieee floating and math
routines.
2023-02-02 17:45:38 -05:00
Andrew Kelley
7505d19e93
Merge pull request #14511 from ziglang/zig-build-hashes
two package hash breaking enhancements
2023-02-02 14:03:41 -05:00
Krzysztof Wolicki Der Teufel
c3abb63fe9 autodoc: Added @qualCast builtin function handling 2023-02-02 14:47:16 +01:00
Andrew Kelley
6b7ad22981
Merge pull request #14477 from Vexu/fixes
Improve `@ptrCast` errors, fix some bugs
2023-02-01 23:31:52 -05:00
Kirk Scheibelhut
e712d5f03e remove reference to removed addTestExe 2023-02-01 22:52:32 -05:00
praschke
72a7e3dc5e mingw: stop using K&R-style function definitions
this patch is from upstream, to fix -Wdeprecated-non-prototypes issues.

K&R-style has apparently been deprecated since even C89, and C2x will be
repurposing the syntax space. this warning triggers when the change would
affect the meaning of the code.
2023-02-01 22:11:16 -05:00
Andrew Kelley
24ff8a1a5f zig build: use multihash for the hash field
https://multiformats.io/multihash/

Still, only SHA2-256 is supported. This is only intended to future-proof
the hash field of the manifest.

closes #14284
2023-02-01 20:02:35 -07:00
Andrew Kelley
ea6e0e33a7 zig build: add executable bit and file path to package hash
Unfortunately, due to the Windows equivalent of executable permissions
being a bit tricky, there is follow-up work to be done.

What is done in this commit is the hash modifications. At the fetch
layer, executable bits inside packages are ignored. In the hash
computation layer, executable bit is implemented for POSIX but not yet
for Windows. This means that the hash will not break again in the future
for packages that do not have any executable files, but it will break
for packages that do.

This is a hash-breaking change.

Closes #14308
2023-02-01 18:42:29 -07:00
Jakub Konka
304420b99c
Merge pull request #14502 from ziglang/link-owned-atoms
link: move ownership of linker atom from frontend to the linkers
2023-02-02 01:39:01 +01:00
Veikka Tuominen
629c3108aa AstGen: fix orelse type coercion in call arguments
Closes #14506
2023-02-02 00:31:35 +02:00
Josh Holland
1fba88450d langref: add paragraph and examples about indexing non-ASCII strings
PR #10610 addressed most of the points from #1854.  This
additional paragraph and examples covers the OMISSIONS section
clarifying issues about indexing into non-ASCII strings (whether valid
UTF-8 or not).  I think this finally closes #1854.
2023-02-01 21:46:46 +02:00
Evan Typanski
86ec26b1f0 translate-c: Fix types on assign expression bool 2023-02-01 21:45:53 +02:00
ominitay
3c8d968194 fmt: Make default_max_depth configurable 2023-02-01 21:43:36 +02:00
Veikka Tuominen
490addde27 Sema: fix error location on comptime arg to typed generic param
Closes #14505
2023-02-01 20:50:43 +02:00
Jakub Konka
beb20d29db link: remove union types which are now internal to backends 2023-02-01 19:32:54 +01:00
Luuk de Gram
46f54b23ae
link: make Wasm atoms fully owned by the linker 2023-02-01 19:10:56 +01:00
Jakub Konka
1aa0f8aa2f link: fix pointer invalidation issues in Elf, MachO and Coff 2023-02-01 17:46:57 +01:00
Jakub Konka
e0f3975fc8 link: make SpirV atoms fully owned by the linker 2023-02-01 16:01:43 +01:00
Jakub Konka
5de2aae63c link: decouple DI atoms from linker atoms, and manage them in Dwarf linker 2023-02-01 15:03:55 +01:00
Jakub Konka
d98fc53b8f link: use strtab.StringTable in Dwarf 2023-02-01 11:49:07 +01:00
Jakub Konka
b3277c8936 link: make Plan9 atoms fully owned by the linker 2023-02-01 11:12:53 +01:00
Jakub Konka
9fdc32c96e link: clean up type resolution in Elf.Atom and MachO.Atom 2023-02-01 09:13:49 +01:00
praschke
2ccff51154 mingw: repair msvcrt-os build flags
__LIBMSVCRT__ is still used and is distinct from __LIBMSVCRT_OS__
2023-01-31 23:25:02 -05:00