6467 Commits

Author SHA1 Message Date
Andrew Kelley
6db3869fc7 std.build.ConfigHeaderStep: support cmake syntax
It's not fully implemented yet, for example `@FOO@` syntax is not
handled.
2023-01-17 00:44:57 -07:00
Andrew Kelley
d35d086ae6 std.crypto.Certificate: add more object id 2023-01-17 00:09:38 -07:00
Andrew Kelley
7623f3fad0 std.crypto.Certificate: skip unknown attributes 2023-01-17 00:09:34 -07:00
Andrew Kelley
86308ba1e1 std.net.getAddressList: call WSAStartup on Windows 2023-01-17 00:08:42 -07:00
Andrew Kelley
62e3fdcf4f std.crypto.Certificate: add more object ids 2023-01-17 00:08:42 -07:00
Andrew Kelley
09560bc69a clean up windows cert scanning
* keep helper functions out of the DLL bindings APIs
 * unify the logic for linux and windows certificate scanning with
   regards to error handling
2023-01-17 00:08:42 -07:00
star-tek-mb
1f9fa82235 windows root certificate scanning 2023-01-17 00:08:42 -07:00
Andrew Kelley
d56a65a8c4 std.http.Client: default to lazy root cert scanning
After this change, the system will be inspected for root certificates
only upon the first https request that actually occurs. This makes the
compiler no longer do SSL certificate scanning when running `zig build`
if no network requests are made.
2023-01-17 01:44:56 -05:00
Andrew Kelley
e646becd04
Merge pull request #14336 from Vexu/field-reorder
Sema: automatically optimize order of struct fields
2023-01-16 21:19:48 -05:00
Andrew Kelley
37424fd11a add std.build.LibExeObjStep.installHeadersDirectoryOptions
For when you need options such as excluding certain extensions.
2023-01-16 16:09:24 -07:00
fn ⌃ ⌥
e45b471ad3
Find system-installed root SSL certificates on macOS (#14325) 2023-01-16 22:34:04 +00:00
Veikka Tuominen
b2c85464be std.os.linux.io_uring: fix ABI error
`register_files_update` was passing a pointer to a Zig struct to the kernel.
2023-01-16 22:25:34 +02:00
Michael Bartnett
31a2b8c364
std: Handle field struct defaults in std.mem.zeroInit
I originally started monkeying with this because std.mem.zeroes doesn't support sentinel-terminated const slices even with defaults in 0.10.x.

I see that std.mem.zeroes was modified in #13256 to allow setting these slices to "".

That got me partway to where I wanted, but there was still an issue fields whose types are structs, they wouldn't get their defaults.

So when iterating struct fields looking for default values, when there is no default value and the type is .Struct, it will delegate to a call to zeroInit.

* Initialize struct fields in zeroInit exactly once

In my changes, similar to the previous implementation, the priority order for fields being initialized is:

1. If the `init` argument is a tuple, the nth element corresponding to the nth field of the struct.
2. Otherwise, if the `init` argument is not a tuple, try to find a matching field name on `init` and use that field.
3. Is the field has a default value, initalize with that value.
4. Fall back to what the field would have been initialized to via a recursive call to `std.mem.zeroInit`.

But instead of initializing a default instance of the struct and then running multiple passes over it, the init method is chosen per-field and each field is initialized exactly once.
2023-01-16 14:24:47 +02:00
Michael Bartnett
99febb54d3 Add fromOwnedSliceSentinel to ArrayList ArrayList and ArrayListUnmanaged, add fromOwnedSlice to ArrayListUnmanaged 2023-01-16 14:22:38 +02:00
r00ster91
3dd8f43ad3 std.Thread: make Id smaller where possible 2023-01-16 14:20:57 +02:00
Andrew Kelley
e3505c0a5a std.crypto.Certificate.Bundle: add more Linux directories
Thanks to the Go project for finding all these paths.
2023-01-15 15:01:42 -07:00
Andrew Kelley
9a0e1704ae std.crypto.Certificate: support v1
closes #14304
2023-01-15 14:59:49 -07:00
Robert Burke
d813cef42a Fix buffer overflow in fmt when DAZ is set 2023-01-13 16:45:10 +02:00
Andrew Kelley
7cb2f9222d
Merge pull request #14265 from ziglang/init-package-manager
Package Manager MVP
2023-01-12 18:49:15 -05:00
antlilja
4971df8572 UEFI pool allocator changes
* Changed the interface to align with the new allocator interface.
* Fixed bug where not enough memory was allocated for the header or to
  align the pointer.
2023-01-12 03:46:15 -05:00
Andrew Kelley
2a92b04b9d
Merge pull request #14257 from Vexu/compile-errors
compile error improvements and bug fixes
2023-01-12 03:39:01 -05:00
Andrew Kelley
f4d6b37068 Package: handle Windows PathAlreadyExists error code
Unfortunately, error.AccessDenied is ambiguous on Windows when it is
returned from fs.rename.
2023-01-11 17:54:34 -08:00
Andrew Kelley
4d306ebd32 fix std.io.Reader regression
oops. #14264
2023-01-11 15:39:49 -08:00
Andrew Kelley
476cbe871a fix build failures on 32-bit arm due to u64/usize coercion 2023-01-11 15:39:49 -08:00
Andrew Kelley
fe8951cc94 zig build: add Artifact.installHeadersDirectory
This one is useful for when the C library has a "include" directory but
it needs to get renamed to, e.g. "lame" when being installed.
2023-01-11 15:39:49 -08:00
Andrew Kelley
416717d04e zig build: support libraries aware of installed headers 2023-01-11 15:39:49 -08:00
Andrew Kelley
cfcf9771c1 zig build: support dependencies
The `zig build` command now makes `@import("@dependencies")` available
to the build runner package. It contains all the dependencies in a
generated file that looks something like this:

```zig
pub const imports = struct {
    pub const foo = @import("foo");
    pub const @"bar.baz" = @import("bar.baz");
};
pub const build_root = struct {
    pub const foo = "<path>";
    pub const @"bar.baz" = "<path>";
};
```

The build runner exports this import so that `std.build.Builder` can
access it. `std.build.Builder` uses it to implement the new `dependency`
function which can be used like so:

```zig
const libz_dep = b.dependency("libz", .{});
const libmp3lame_dep = b.dependency("libmp3lame", .{});
// ...
lib.linkLibrary(libz_dep.artifact("z"));
lib.linkLibrary(libmp3lame_dep.artifact("mp3lame"));
```

The `dependency` function calls the build.zig file of the dependency as
a child Builder, and then can be ransacked for its build steps via the
`artifact` function.

This commit also renames `dependency.id` to `dependency.name` in the
`build.zig.ini` file.
2023-01-11 15:39:49 -08:00
Andrew Kelley
d4e829d0a0 std.tar: add strip_components option 2023-01-11 15:39:49 -08:00
Andrew Kelley
585b9970ef add std.tar for tar file unpacking 2023-01-11 15:39:48 -08:00
Andrew Kelley
4f6981bbe3 add std.Ini for basic .ini file parsing 2023-01-11 15:39:48 -08:00
Andrew Kelley
f945c2a1c8 expose std.io.bufferedReaderSize
This allows setting a custom buffer size. In this case I wanted it
because using a buffer size large enough to fit a TLS ciphertext record
elides a memcpy().

This commit also adds `readAtLeast` to the Reader interface.
2023-01-11 15:39:48 -08:00
Andrew Kelley
c50f65304f std.http.Client: support the Reader interface 2023-01-11 15:39:48 -08:00
Andrew Kelley
da6d79c47c water cooler complaint about gzip stream namespace 2023-01-11 15:39:48 -08:00
Veikka Tuominen
e2adf3b61a parser: add helpful note for missing const/var before container level decl
Closes #13888
2023-01-11 21:11:21 +02:00
praschke
3ab43988c1 std.net: check for localhost names before asking DNS
the old implementation asks DNS before checking if it shouldn't.
additionally, it did not catch absolute 'localhost.' names.
2023-01-10 18:09:07 -05:00
Andrew Kelley
9b807f9c17
Merge pull request #14247 from kcbanner/windows_improve_module_lookup
Windows debug info lookup improvements
2023-01-10 18:08:12 -05:00
kcbanner
bb4cb34204 test: fix "chdir smoke test" comparing paths with potentially different drive letter cases 2023-01-10 18:03:05 -05:00
Techatrix
1f8f79cd53
std: add helper functions to std.zig.Ast for extracting data out of nodes 2023-01-09 16:59:19 +02:00
kcbanner
58e558822a windows: unexpectedStatus/unexpectedError start the stack trace at the caller 2023-01-08 23:51:55 -05:00
kcbanner
5e3cadf871 debug: fixup memory management 2023-01-08 22:16:16 -05:00
kcbanner
461fb499f3 windows: rework DebugInfo to use less file operations and fix some memory management issues 2023-01-08 20:28:42 -05:00
Andrew Kelley
c53a556a61 std.build.WriteFileStep: fix regression in this branch
This branch makes WriteFileStep use the same hashing algorithm as our
cache system, reducing the divergence between zig build and the cache
system.
2023-01-07 19:07:33 -07:00
Andrew Kelley
01e34c1cd9 std.build.ConfigHeaderStep: stub out cmake style 2023-01-07 18:12:20 -07:00
Andrew Kelley
ea792011d1 add std.build.ConfigHeaderStep
This API converts a config.h.in file into config.h. This is useful when
introducing a build.zig file to an existing C/C++ project that is
configured with autotools or cmake.

The cmake syntax is not implemented yet.
2023-01-07 18:07:10 -07:00
Andrew Kelley
e579c88f4c std.crypto.siphash: add finalResult() and peek()
Useful for avoiding mutable state when using this API.
2023-01-07 18:06:55 -07:00
Andrew Kelley
aa87789c29 std.Uri: make scheme non-optional 2023-01-06 18:52:39 -07:00
Andrew Kelley
646a911c19 std.http.Client: update from old std.Url to new std.Uri 2023-01-06 18:05:37 -07:00
Felix "xq" Queißner
e7c109329d Renames Url.zig to Uri.zig 2023-01-06 17:56:05 -07:00
Felix "xq" Queißner
08496aa2aa Ports zig-uri to stdlib. 2023-01-06 17:56:05 -07:00
Andrew Kelley
3806091a10 std.http.Client: fix handling of \r\n before next chunk size 2023-01-06 17:53:06 -07:00