Commit graph

168 commits

Author SHA1 Message Date
Alex Rønne Petersen
1bada4b275
Merge pull request #23447 from alexrp/cpuid-updates 2025-04-03 19:32:59 +02:00
Alex Rønne Petersen
481b7bf3f0
std.Target: Remove functions that just wrap component functions.
Functions like isMinGW() and isGnuLibC() have a good reason to exist: They look
at multiple components of the target. But functions like isWasm(), isDarwin(),
isGnu(), etc only exist to save 4-8 characters. I don't think this is a good
enough reason to keep them, especially given that:

* It's not immediately obvious to a reader whether target.isDarwin() means the
  same thing as target.os.tag.isDarwin() precisely because isMinGW() and similar
  functions *do* look at multiple components.
* It's not clear where we would draw the line. The logical conclusion before
  this commit would be to also wrap Arch.isX86(), Os.Tag.isSolarish(),
  Abi.isOpenHarmony(), etc... this obviously quickly gets out of hand.
* It's nice to just have a single correct way of doing something.
2025-02-17 19:18:19 +01:00
Alex Rønne Petersen
5647dd84c1 Revert d714cf3340 (#21273)
Turns out this was already fixed in #21964.

I have no idea why GitHub showed an incorrect diff in #21273, or how applying the diff to master was even possible, but here we are.
2025-01-26 20:52:29 -08:00
injuly
d714cf3340
std.c.darwin: Fix EXC.MASK compile error (#21273) 2025-01-26 19:56:14 +01:00
John Benediktsson
530335b572
adding std.c.TCP.NODELAY for macos (#22404)
closes #17260
2025-01-23 04:01:05 +00:00
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 f4bf061d8a
- 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 7b0e015eb4.
2023-07-31 11:20:57 -07:00
Andrew Kelley
1f9161a9c6 Revert "std.c: add mincore api to darwin."
This reverts commit 05f9608115.
2023-07-31 11:17:57 -07:00
Andrew Kelley
a397952932 Revert "std.c: add os_proc_available_memory for darwin"
This reverts commit 012f9a97eb.
2023-07-31 11:13:40 -07:00
Andrew Kelley
a92be49851 Revert "Merge pull request #15317 from devnexen/darwin_rand_nativegen"
This reverts commit a111130977, reversing
changes made to 9f3f9fb40f.
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 4bfd37ddb4.
2023-07-31 11:12:19 -07:00
Andrew Kelley
614ae886db Revert "std.c: darwin add host_info based data."
This reverts commit ff59c45840.
2023-07-31 11:11:05 -07:00
Andrew Kelley
f3fa47a984 Revert "std.c: darwin adding more host_info api data"
This reverts commit 20cc69318f.
2023-07-31 11:04:37 -07:00
Andrew Kelley
942848de58 Revert "std.c: adding basic darwin's host_statistics data."
This reverts commit 6547d23312.
2023-07-31 11:04:04 -07:00
Andrew Kelley
0043cdbeca Revert "std.c: further darwin's host statistics data"
This reverts commit cceadf52ba.
2023-07-31 11:03:52 -07:00
Andrew Kelley
faa6daef99 Revert "std.c: darwin's *copyfile api update."
This reverts commit 40e8c2243c.
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 41502c6aa5.
2023-07-31 10:54:35 -07:00
Andrew Kelley
ba3b352891 Revert "std.os: fix uname usage."
This reverts commit 138f1253de.
2023-07-31 10:52:12 -07:00
Andrew Kelley
004711310a Revert "std.c: fix host_basic_info definition for darwin."
This reverts commit ea1d64dae4.
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