163 Commits

Author SHA1 Message Date
mlugg
d00e05f186
all: update to std.builtin.Type.Pointer.Size field renames
This was done by regex substitution with `sed`. I then manually went
over the entire diff and fixed any incorrect changes.

This diff also changes a lot of `callconv(.C)` to `callconv(.c)`, since
my regex happened to also trigger here. I opted to leave these changes
in, since they *are* a correct migration, even if they're not the one I
was trying to do!
2025-01-16 12:46:29 +00:00
David Rubin
0c457fa7eb add m4 {pro,max} detection 2024-12-16 20:56:29 -05:00
mlugg
512cb22d83
std.c.darwin.posix_spawn: fix signature
And change corresponding signature in `DarwinPosixSpawn`.
2024-12-16 14:53:54 +00:00
Daniel Berg
b5f9e07034
std.c.darwin: make os_log_t a pointer to opaque 2024-11-19 09:32:42 +00:00
Daniel Hooper
9996f8b9b1
Fix std.c.EXC.MASK struct to match definition in mach/exception_types.h (#21964)
Co-authored-by: Alex Rønne Petersen <alex@alexrp.com>
2024-11-13 05:27:02 +00:00
Saurabh Mishra
267523e136 fix typo in segset_t 2024-10-03 09:37:57 -07:00
matt
7f6b7c5608 fix THREAD_STATE_NONE on darwin
#21094
2024-09-24 22:41:00 -07:00
mlugg
0fe3fd01dd
std: update std.builtin.Type fields to follow naming conventions
The compiler actually doesn't need any functional changes for this: Sema
does reification based on the tag indices of `std.builtin.Type` already!
So, no zig1.wasm update is necessary.

This change is necessary to disallow name clashes between fields and
decls on a type, which is a prerequisite of #9938.
2024-08-28 08:39:59 +01:00
Meghan Denny
7071d1b3c2
std: add native cpu detection for apple m3 (#21116)
* std.c.darwin: add missing CPUFAMILY fields

* std.zig.system.detectNativeCpuAndFeatures: add missing darwin fields

* add comment so the prong isnt lost and easily discoverable during next llvm upgrade
2024-08-19 11:49:02 -07:00
Andrew Kelley
8c4a2dc1df move non-libc stuff out of std.c 2024-07-19 00:30:32 -07:00
Andrew Kelley
e8c4e79499 std.c reorganization
It is now composed of these main sections:
* Declarations that are shared among all operating systems.
* Declarations that have the same name, but different type signatures
  depending on the operating system. Often multiple operating systems
  share the same type signatures however.
* Declarations that are specific to a single operating system.
  - These are imported one per line so you can see where they come from,
    protected by a comptime block to prevent accessing the wrong one.

Closes #19352 by changing the convention to making types `void` and
functions `{}`, so that it becomes possible to update `@hasDecl` sites
to use `@TypeOf(f) != void` or `T != void`. Happily, this ended up
removing some duplicate logic and update some bitrotted feature
detection checks.

A handful of types have been modified to gain namespacing and type
safety. This is a breaking change.

Oh, and the last usage of `usingnamespace` site is eliminated.
2024-07-19 00:30:32 -07:00
Jora Troosh
13070448f5
std: fix typos (#20560) 2024-07-09 14:25:42 -07:00
Isaac Freund
a1777cb5cb
std: fix pthread_{get,set}name_np return type ABI
I believe this was accidentally broken when the E enum for errno values
was introduces. These functions are quite the special case in that they
return the error value directly rather than returning -1 and passing the
error value through the errno variable.

In any case, using a u16 as the return type at the ABI boundary where a
c_int is expected is asking for trouble.
2024-06-17 23:26:53 +02:00
Jacob Young
5a41704f7e cbe: rewrite CType
Closes #14904
2024-03-30 20:50:48 -04:00
Jacob Young
2dd74cd312 haiku: debitrot 2024-03-23 18:11:32 +01:00
Andrew Kelley
cd62005f19 extract std.posix from std.os
closes #5019
2024-03-19 11:45:09 -07:00
Jacob Young
d10c52c194 AstGen: disallow alignment on function types
A pointer type already has an alignment, so this information does not
need to be duplicated on the function type.  This already has precedence
with addrspace which is already disallowed on function types for this
reason.  Also fixes `@TypeOf(&func)` to have the correct addrspace and
alignment.
2024-03-17 03:06:17 +01:00
Michael Dusan
d7cf25f5ca
bsd: debitrot std.c
- follow-up to f4bf061d8a8
- updated std.fs.Dir to use properly named symbols
2024-03-15 02:28:50 -04:00
Tristan Ross
9d70d614ae
std.builtin: make link mode fields lowercase 2024-03-11 07:09:10 -07:00
Andrew Kelley
a280ff2767 std.os.termios: add type safety to lflag field
This creates `tc_cflag_t` even though such a type is not defined by
libc.

I also collected the missing flag bits from all the operating systems.
2024-02-12 21:21:45 -07:00
Andrew Kelley
e97fa8b038 std.os.termios: add type safety to cflag field
This creates `tc_cflag_t` even though such a type is not defined by
libc.

I also collected the missing flag bits from all the operating systems.
2024-02-12 18:24:07 -07:00
Andrew Kelley
20abc0caee std.os.termios: add type safety to oflag field
This creates `tc_oflag_t` even though such a type is not defined by
libc.

I also collected the missing flag bits from all the operating systems.
2024-02-12 17:28:09 -07:00
Andrew Kelley
47643cc5cc std.os.termios: add type safety to iflag field
This creates `tc_iflag_t` even though such a type is not defined by
libc.

I also collected the missing flag bits from all the operating systems.
2024-02-12 16:43:51 -07:00
Andrew Kelley
0c88f927f1 std.os.termios: consolidate and correct 2024-02-12 16:21:21 -07:00
Andrew Kelley
9a64318554 std.c.NCSS: consolidate and correct 2024-02-12 15:52:13 -07:00
Andrew Kelley
5258c3caad std: add type safety to cc_t 2024-02-12 15:41:38 -07:00
Andrew Kelley
7680c5330c some API work on std.c, std.os, std.os.wasi
* std.c: consolidate some definitions, making them share code. For
  example, freebsd, dragonfly, and openbsd can all share the same
  `pthread_mutex_t` definition.
* add type safety to std.c.O
  - this caught a bug where mode flags were incorrectly passed as the
    open flags.
* 3 fewer uses of usingnamespace keyword
* as per convention, remove purposeless field prefixes from struct field
  names even if they have those prefixes in the corresponding C code.
* fix incorrect wasi libc Stat definition
* remove C definitions from incorrectly being in std.os.wasi
* make std.os.wasi definitions type safe
* go through wasi native APIs even when linking libc because the libc
  APIs are problematic and wasteful
* don't expose WASI definitions in std.posix
* remove std.os.wasi.rights_t.ALL: this is a footgun. should it be all
  future rights too? or only all current rights known? both are
  the wrong answer.
2024-02-11 13:38:55 -07:00
Andrew Kelley
a60f219660 std.c.MAP: use a packed struct
Same as previous commit, but for the libc interface.
2024-02-06 22:06:01 -07:00
xdBronch
c9c3ee704c correctly detect apple a15 and a16 chips 2023-10-03 00:36:59 -07:00
Andrew Kelley
c7f2a7ea82 Revert "std: add a subset of the macOs's libproc api."
This reverts commit 7b0e015eb42272d84396f44fc904ab79f38dd696.
2023-07-31 11:20:57 -07:00
Andrew Kelley
1f9161a9c6 Revert "std.c: add mincore api to darwin."
This reverts commit 05f9608115a48fb7312ebf38c1240ae10b770c88.
2023-07-31 11:17:57 -07:00
Andrew Kelley
a397952932 Revert "std.c: add os_proc_available_memory for darwin"
This reverts commit 012f9a97eb74c63921ce7f3a036c71816fb59a24.
2023-07-31 11:13:40 -07:00
Andrew Kelley
a92be49851 Revert "Merge pull request #15317 from devnexen/darwin_rand_nativegen"
This reverts commit a11113097730693fb915114cec79df9cb4adcc93, reversing
changes made to 9f3f9fb40f605de2f2bdcd0ce7a396e06b8b8c0d.
2023-07-31 11:13:27 -07:00
Andrew Kelley
421022929a Revert "std.c: adding cpu affinity api for macOs (mainly x86_64)"
This reverts commit 4bfd37ddb48af4dbfd2e892aec7a90a822c8cbe7.
2023-07-31 11:12:19 -07:00
Andrew Kelley
614ae886db Revert "std.c: darwin add host_info based data."
This reverts commit ff59c4584041517a2ee07cccf923ef5460032d68.
2023-07-31 11:11:05 -07:00
Andrew Kelley
f3fa47a984 Revert "std.c: darwin adding more host_info api data"
This reverts commit 20cc69318f4661795aaacdc55bcaabb5f2e6484e.
2023-07-31 11:04:37 -07:00
Andrew Kelley
942848de58 Revert "std.c: adding basic darwin's host_statistics data."
This reverts commit 6547d233125199b16644c0f7504793490af67926.
2023-07-31 11:04:04 -07:00
Andrew Kelley
0043cdbeca Revert "std.c: further darwin's host statistics data"
This reverts commit cceadf52baff2590c1b38c469b1177918183dfe8.
2023-07-31 11:03:52 -07:00
Andrew Kelley
faa6daef99 Revert "std.c: darwin's *copyfile api update."
This reverts commit 40e8c2243c139dc499298645a2b387e30ae09cba.
2023-07-31 10:57:06 -07:00
Andrew Kelley
1b9ffa0824 Revert "std.Thread: refining stack size from platform minimum, changes more targetted towards platform like Linux/musl (#15791)"
This reverts commit 41502c6aa53a3da31b276c23c4db74db7d04796b.
2023-07-31 10:54:35 -07:00
Andrew Kelley
ba3b352891 Revert "std.os: fix uname usage."
This reverts commit 138f1253deb48434af707ec5e9124e889520be08.
2023-07-31 10:52:12 -07:00
Andrew Kelley
004711310a Revert "std.c: fix host_basic_info definition for darwin."
This reverts commit ea1d64dae4bb34d62e9cfddf7e3da493ed8063e9.
2023-07-31 10:50:22 -07:00
Lauri Tirkkonen
972e70b794 darwin: drop underscore from SIG._{BLOCK,UNBLOCK,SETMASK}
this makes them match decls in other OSes
2023-07-25 13:49:08 -07:00
kcbanner
576ffaa329 darwin: update mcontext_t definition for aarch64 to add neon state 2023-07-20 22:58:14 -04:00
kcbanner
412cd789bf debug: fixup base address calculations for macho
dwarf: fixup x86 register mapping logic
dwarf: change the register context update to update in-place instead of copying
debug: always print the unwind error type
2023-07-20 22:58:14 -04:00
mlugg
f26dda2117 all: migrate code to new cast builtin syntax
Most of this migration was performed automatically with `zig fmt`. There
were a few exceptions which I had to manually fix:

* `@alignCast` and `@addrSpaceCast` cannot be automatically rewritten
* `@truncate`'s fixup is incorrect for vectors
* Test cases are not formatted, and their error locations change
2023-06-24 16:56:39 -07:00
David CARLIER
ea1d64dae4 std.c: fix host_basic_info definition for darwin.
follow-up on ff59c45.

ref: a5e15eced0/lib/libc/include/any-macos-any/mach/host_info.h (L116)
2023-06-24 13:00:14 -07:00
Eric Joldasov
50339f595a all: zig fmt and rename "@XToY" to "@YFromX"
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
2023-06-19 12:34:42 -07:00
David CARLIER
138f1253de std.os: fix uname usage.
close #15839.
2023-05-29 22:08:43 +03:00
David CARLIER
41502c6aa5
std.Thread: refining stack size from platform minimum, changes more targetted towards platform like Linux/musl (#15791) 2023-05-25 14:32:17 -05:00