Commit Graph
100 Commits
Author SHA1 Message Date
Jeroen van Rijn 07c59cb4db Early out and propagate nil in create*
If allocation of a `^Thread` failed, `create*` now properly return `nil`,
so you can assert on that instead of calling `thread.destroy` on a null pointer, say.
2025-04-17 17:26:24 +02:00
Jeroen van Rijn 1c655b84e4 Fix #5049
Keep in mind that `thread.create` needs an allocator to be set, as it returns `^Thread`.
2025-04-17 16:53:07 +02:00
Jeroen van RijnandGitHub 8985d3beb3 Merge pull request #5050 from Kelimion/pq-err
Let `core:container/priority_queue` return `runtime.Allocator_Error`
2025-04-17 14:35:04 +02:00
Jeroen van Rijn 5a39013339 Let core:container/priority_queue return runtime.Allocator_Error
`init`, `reserve` and `push` now return `runtime.Allocator_Error`.
2025-04-17 14:20:03 +02:00
Jeroen van RijnandGitHub 81274a7d67 Merge pull request #5045 from laytan/fix-not-resolving-to-alias-in-a-recursive-declaration
fix not resolving to alias in a recursive declaration
2025-04-16 23:07:01 +02:00
Jeroen van RijnandGitHub 3ba9b9b14e Merge pull request #5044 from Barinzaya/box2d-missing-allowfastrotation
Add missing field in box2d.BodyDef
2025-04-16 21:56:22 +02:00
Jeroen van Rijn 678fa897f5 signbit -> sign_bit in tests/core/math 2025-04-15 16:20:49 +02:00
Jeroen van Rijn ddedddc16d Get rid of duplicate math.signbit in favor of math.sign_bit 2025-04-15 16:17:02 +02:00
Jeroen van RijnandGitHub 2d5b85f9f9 Merge pull request #5038 from mtarik34b/noteq-comparison-for-nan-must-be-true
Ensure `NaN != any_float_value` evaluates to true for constant NaN values
2025-04-15 12:29:17 +02:00
Jeroen van Rijn 0fc141db5d core:mem/tlsf: Add early-out in OOM logic
This implementation doesn't allow for out-of-band allocations to be passed through, as it's not designed to
track those. Nor is it able to signal those allocations then need to be freed on the backing allocator,
as opposed to regular allocations handled for you when you `destroy` the TLSF instance.

So if we're asked for more than we're configured to grow by, we can fail with an OOM error early, without adding a new pool.
2025-04-14 20:40:05 +02:00
Jeroen van Rijn 3d13beb3ec Remove now-implemented TODO 2025-04-14 20:09:55 +02:00
Jeroen van RijnandGitHub 11af4cebb7 Merge pull request #5037 from Kelimion/tlsf
Allow `core:mem/tlsf` to automatically add new pools.
2025-04-14 20:00:39 +02:00
Jeroen van Rijn beee27dec0 Allow core:mem/tlsf to automatically add new pools.
New features:
- If TLSF can't service an allocation made on it, and it's initialized with `new_pool_size` > 0, it will ask the backing allocator for additional memory.

- `estimate_pool_size` can tell you what size your initial (and `new_pool_size`) ought to be if you want to make `count` allocations of `size` and `alignment`, or in its other form, how much backing memory is needed for `count` allocations of `type` and its corresponding size and alignment.
2025-04-14 19:49:55 +02:00
Jeroen van RijnandGitHub 66d99c1be3 Merge pull request #5036 from Kelimion/tlsf
Refactor `core:mem/tlsf`, add `free_all` support.
2025-04-14 17:30:46 +02:00
Jeroen van Rijn 7088284ff4 Refactor core:mem/tlsf, add free_all support.
TODO: Allow the TLSF allocator to add additional pools when it would ordinarily OOM
      by calling its backing allocator.
2025-04-14 17:13:27 +02:00
Jeroen van RijnandGitHub 9516084e58 Merge pull request #5035 from Sojamann/sync_chan-maintainance
core:sync/chan: maintainance and package clarity
2025-04-13 23:13:07 +02:00
Jeroen van RijnandGitHub a98cbe2cc9 Merge pull request #5034 from Kelimion/yeet-tuple
Remove Type_Info_Tuple
2025-04-13 21:59:32 +02:00
Jeroen van Rijn bb38775fb1 Remove Type_Info_Tuple 2025-04-13 21:51:57 +02:00
Jeroen van RijnandGitHub c10cf312ff Merge pull request #5032 from Sojamann/sync_chan-doc
core:sync/chan: add package documentation
2025-04-13 17:09:18 +02:00
Jeroen van Rijn 0e9cd0fb6a Prepare for tlsf.free_all 2025-04-13 15:20:53 +02:00
Jeroen van Rijn 32c9f6d13a Remove bit_field -> bit_set warning.
The "This 'bit_field' might be better expressed as a 'bit_set' since all of the fields are booleans, of 1-bit in size, and the backing type is an integer" warning is imperfect. Disable it for now.
2025-04-12 14:01:18 +02:00
Jeroen van Rijn 0a97e01827 Add tests for type_elem_type on SIMD vectors 2025-04-11 23:31:02 +02:00
Jeroen van RijnandGitHub 29b03adab1 Merge pull request #5030 from Kelimion/type_elem_type
Allow intrinsics.type_elem_type(simd_vector) to return the element type.
2025-04-11 22:51:28 +02:00
Jeroen van Rijn 41d4ddbc5e Add reflect.length + reflect.capacity support for #simd[N]T 2025-04-11 22:44:02 +02:00
Jeroen van Rijn f4ce84dfb4 Add fix to reflect.typeid_elem 2025-04-11 22:24:19 +02:00
Jeroen van Rijn 04807309b7 Allow intrinsics.type_elem_type(simd_vector) to return the element type.
Make `type_elem_type(#simd[4]f32)` return `f32`, same as it would for `[4]f32`.
2025-04-11 21:49:48 +02:00
Jeroen van Rijn b27008e0f9 Simplify condition, op = Token_Sub was trivially true 2025-04-10 17:58:54 +02:00
Jeroen van Rijn 3a7691c714 Fixes #5026 2025-04-10 17:54:58 +02:00
Jeroen van RijnandGitHub 5912718002 Merge pull request #5023 from justgook/master
add quotes for absolute path
2025-04-09 14:39:31 +02:00
Jeroen van RijnandGitHub d401a089c8 Merge pull request #5022 from IllusionMan1212/fix-printing-long-strings
gb.h: fix buffer overflow when printing long strings.
2025-04-09 07:37:59 +02:00
Jeroen van RijnandGitHub dd826b759f Merge pull request #5021 from flysand7/fix-badge
Fix the CI badge URL
2025-04-08 22:55:58 +02:00
Jeroen van Rijn 329b15961a Don't run demo if building Odin fails.
`cl`'s return value was stomped by `mt`, so we ran the demo if `cl` failed, but `mt` succeeded.
This obscures `cl`'s output, so we're now checking both for errors.
2025-04-08 11:44:35 +02:00
Jeroen van Rijn eeb8b8dcc4 Fix #5020 2025-04-08 10:13:45 +02:00
Jeroen van RijnandGitHub 44bd2d3750 Merge pull request #5019 from Cararasu/master
vendor/glfw: fix SetMonitorCallback and MonitorProc type definition
2025-04-07 22:24:08 +02:00
Jeroen van RijnandGitHub d77b8aeaa1 Merge pull request #5018 from Barinzaya/fix-fmt-bitset-nonzero-enum
Fix printing of `bit_set[Enum]` when `min(Enum) != 0`
2025-04-07 22:01:19 +02:00
Jeroen van Rijn 716bd479a9 Disallow .Multiline in iterator. 2025-04-07 21:33:57 +02:00
Jeroen van Rijn 2b26c0b39e Remove now unused field. 2025-04-07 15:02:36 +02:00
Jeroen van Rijn a5e513567b Optimize regex match iterator.
Reuse virtual machine and capture groups between matches.
2025-04-07 14:58:41 +02:00
Jeroen van Rijn c13b68f103 Fix os2/process defer error. 2025-04-07 13:33:21 +02:00
Jeroen van Rijn 3287e1b0f0 Fix HXA defer warning 2025-04-07 13:19:00 +02:00
Jeroen van RijnandGitHub bee158d53a Merge pull request #5010 from Feoramund/fix-netbsd-arm64-syscall
Fix `syscall_bsd` on NetBSD ARM64
2025-04-07 11:30:13 +02:00
Jeroen van Rijn 9a2b6c01aa Return loop index in regex iterator. 2025-04-06 21:45:37 +02:00
Jeroen van Rijn 66077add33 {.Glboal} implicit in regex allocator. 2025-04-06 21:13:02 +02:00
Jeroen van RijnandGitHub 07a79254e0 Merge pull request #5008 from Kelimion/regex-iterator
Add iterator for `core:text/regex`.
2025-04-06 14:32:50 +02:00
Jeroen van Rijn 918d57fe01 Keep -vet happy. 2025-04-06 14:24:17 +02:00
Jeroen van Rijn cdc56dc691 Add iterator for core:text/regex.
Usage:
```odin
haystack := `xxfoobarxfoobarxx`
pattern  := `f(o)ob(ar)`

it := regex.create_iterator(haystack, pattern, {.Global}) or_return
defer regex.destroy(it)

for capture in regex.match(&it) {
	fmt.println(capture)
}
```
2025-04-06 14:19:14 +02:00
Jeroen van Rijn dbefee8905 Fix broken asan on Windows. 2025-04-05 22:01:16 +02:00
Jeroen van Rijn a6977ac733 Remove stray import. 2025-04-05 19:25:39 +02:00
Jeroen van Rijn 4b203d0c78 Fix segfault in core:sys/info on WSL2 2025-04-05 19:23:58 +02:00
Jeroen van RijnandGitHub 8d283cefa0 Merge pull request #5007 from laytan/net-errors-overhaul
net: rework errors to be cross-platform
2025-04-05 17:53:10 +02:00
Jeroen van RijnandGitHub 6913fc2231 Merge pull request #5006 from Kelimion/fix-doc-tests
Fix broken examples in documentation tester.
2025-04-05 16:47:12 +02:00
Jeroen van Rijn f7c4c80ef3 Fix broken examples in documentation tester.
No more:
```
We could not find the procedure "pkg_foo_example :: proc()" needed to test the example created for "pkg.foo"
The following procedures were found:
   bar()
```
2025-04-05 16:36:26 +02:00
Jeroen van RijnandGitHub 8480295b60 Merge pull request #4993 from Sojamann/small-array-doc
[DOC] Add documentation for package core:container/small_array
2025-04-05 15:49:51 +02:00
Jeroen van RijnandGitHub e651803045 Merge pull request #5005 from Kelimion/fix-5004
Fix #5004
2025-04-05 14:56:10 +02:00
Jeroen van Rijn 843467bb8f Fix #5004
Fixes constant NaN to constant NaN comparisons.
2025-04-05 14:47:30 +02:00
Jeroen van RijnandGitHub d31ad3cd7f Merge pull request #4991 from nadako/sdl-3.2.10
Update vendor:sdl3 to version 3.2.10
2025-04-02 23:01:03 +02:00
Jeroen van RijnandGitHub 688540699d Merge pull request #4994 from harold-b/hb/linux-sys-built-tag
Add linux build tag to core/sys/linux/sys.odin
2025-04-02 22:46:59 +02:00
Jeroen van Rijn 10bde20850 Fix #4980
Add nullptr check.
2025-04-02 14:21:52 +02:00
Jeroen van RijnandGitHub 29a8707001 Merge pull request #4978 from glektarssza/chore/fixup-detection-of-msvc
Use Microsoft "best practices" for using `vswhere`
2025-03-27 21:45:24 +01:00
Jeroen van Rijn 660598ca8a Fix #4968 2025-03-25 12:01:02 +01:00
Jeroen van RijnandGitHub 242f59a43d Merge pull request #4124 from Yawning/feature/crypto
core/crypto: More improvements
2025-03-23 11:38:11 +01:00
Jeroen van RijnandGitHub f578ce3acb Merge pull request #4957 from Barinzaya/fix-mem-make_map
Fix `mem.make_map`
2025-03-22 16:34:32 +01:00
Jeroen van RijnandGitHub a91d528af6 Merge pull request #4921 from cornishon/fmt_allocator_docs
Update `fmt` docs for procedures with a default allocator parameter
2025-03-09 14:14:18 +01:00
Jeroen van RijnandGitHub 874efa5fe8 Merge pull request #4912 from flysand7/remove-epoch-datetime
[datetime]: Remove the definition of EPOCH
2025-03-06 12:10:48 +01:00
Jeroen van RijnandGitHub 7841d0b14b Merge pull request #4884 from Dzentsetsu/master
Add DWM_WINDOW_CORNER_PREFERENCE enum for window corner preferences
2025-03-02 13:50:00 +01:00
Jeroen van RijnandGitHub b6e4765e63 Merge pull request #4872 from haesbaert/dns-spoof
Fix multiple vulnerabilities in the resolver
2025-02-23 19:13:21 +01:00
Jeroen van Rijn 940da61869 Fix missing error when TCP connection refused.
Fixes #4867
2025-02-23 12:47:22 +01:00
Jeroen van RijnandGitHub bc100c3158 Merge pull request #4820 from Lperlind/tlsf_fixup
Fix tlsf block adjustment
2025-02-10 03:12:20 +01:00
Jeroen van RijnandGitHub 40cf9a33e9 Merge pull request #4817 from bplu4t2f/master
Add more win32 STARTF_* constants
2025-02-09 15:26:07 +01:00
Jeroen van RijnandGitHub 963663b8e1 Merge pull request #4814 from haesbaert/dns-cleanup
Cleanup allocated dns runtime data
2025-02-09 02:12:02 +01:00
Jeroen van RijnandGitHub fdc011555f Merge pull request #4813 from haesbaert/dns-fixes
Fix some compression bugs in dns.
2025-02-09 02:11:47 +01:00
Jeroen van RijnandGitHub 0683a3d672 Merge pull request #4681 from haesbaert/sockaddr
Add net.dial_tcp_from_host{_or_endpoint} and unify them
2025-02-08 12:45:02 +01:00
Jeroen van RijnandGitHub 77c91c82ff Merge pull request #4776 from candtechsoftware/master
Added IP_ADD_MEMBERSHIP to  Socket_Option on Linux
2025-01-30 12:56:07 +01:00
Jeroen van RijnandGitHub e7cf6c3275 Merge pull request #4769 from Kelimion/mdns
Add tentative mDNS/Bonjour/Avahi query support to `net.resolve`
2025-01-27 23:11:53 +01:00
Jeroen van Rijn cc29bdaefc Simplify *nix mDNS 2025-01-27 23:04:15 +01:00
Jeroen van Rijn 8998d74a92 Add mDNS for *nix. 2025-01-27 22:55:48 +01:00
Jeroen van Rijn d85c2c1ca7 Add mDNS/Bonjour/Avahi (.local) support for Windows 2025-01-27 22:16:24 +01:00
Jeroen van Rijn 600e0ebed0 Fix stray space vs. tab 2025-01-12 12:13:29 +01:00
Jeroen van RijnandGitHub 397e371232 Merge pull request #4641 from zolk3ri/fix/base32-error-handling
encoding/base32: Add RFC-compliant error handling and improve reliability
2025-01-04 20:27:16 +01:00
Jeroen van Rijn ad99d20d29 Remove outdated PNG save helpers 2024-12-23 16:33:23 +01:00
Jeroen van RijnandGitHub d3f072835d Merge pull request #4592 from cstrachan88/master
Fixes odin-lang/Odin#4591
2024-12-17 21:23:49 +01:00
Jeroen van RijnandGitHub 04e8dcc042 Merge pull request #4554 from Kelimion/get-date
Add misc\get-date.c
2024-12-03 12:49:33 +01:00
Jeroen van Rijn ef5546aea5 Add misc\get-date.c
Prints the current date as YYYYMMDD without relying on PowerShell.

Hopefully fixes #4540
2024-12-03 12:42:13 +01:00
Jeroen van Rijnandflysand7 47888794c8 Fix assert when return value expected. 2024-12-01 11:54:56 +11:00
Jeroen van Rijnandflysand7 ad8bff4d3a Make O_RDONLY default for os.open on all platforms.
And also moved Windows file procs to `os_windows.odin`, in line with all the other platforms who didn't have a dedicated `file_<platform>.odin`
2024-12-01 11:54:56 +11:00
Jeroen van Rijnandflysand7 21ff9856d4 Check type_expr in check_procedure_param_polymorphic_type
Fixes #4523 assert.
2024-12-01 11:54:56 +11:00
Jeroen van Rijnandflysand7 9388f0d5a5 Add aliases for Is*Ready -> Is*Valid 2024-12-01 11:54:56 +11:00
Jeroen van Rijnandflysand7 0e3572947a Fix #4508 for abs, min, max (#4516)
* Fix #4508 for abs, min, max and the rest of the builtins.

None of these segfault now:
```odin
package bug

main :: proc() {
	p :: proc() {}

	// _ = len(p())
	// _ = cap(p())

	// _ = size_of(p())
	// _ = align_of(p())

	// T :: struct {}
	// _ = offset_of(p())
	// _ = offset_of(T, p())
	// _ = offset_of(p(), foo)
	// _ = offset_of(p(), "")

	// _ = type_of(p())
	// _ = type_info_of(p())
	// _ = typeid_of(p())

	// A: [4]int
	// _ = swizzle(p())    //  :: proc(x: [N]T, indices: ..int) -> [len(indices)]T ---
	// _ = swizzle(A, p()) //  :: proc(x: [N]T, indices: ..int) -> [len(indices)]T ---

	// _ = complex(p(), p())
	// _ = quaternion(p(), p(), p(), p())
	// _ = quaternion(w=p(), x=p(), y=p(), z=p())

	// _ = real(p())
	// _ = imag(p())
	// _ = jmag(p())
	// _ = kmag(p())
	// _ = conj(p())

	// _ = expand_values(p())

	// _ = min(p())
	// _ = max(p())
	// _ = abs(p())
	// _ = clamp(p(), p(), p())

	// _ = soa_zip(p())
	// _ = soa_unzip(p())
}
```
2024-12-01 11:54:56 +11:00
Jeroen van Rijnandflysand7 7e4aafe239 Add comment explaining #4515 test. 2024-12-01 11:54:56 +11:00
Jeroen van Rijnandflysand7 66c57e380a Test #4515 2024-12-01 11:54:56 +11:00
Jeroen van Rijnandflysand7 4d9a9ec3f5 Fix #4509 2024-12-01 11:54:54 +11:00
Jeroen van Rijnandflysand7 826abd6245 && 2024-12-01 11:54:53 +11:00
Jeroen van Rijnandflysand7 d44f8c377a Phrasing! 2024-12-01 11:54:53 +11:00
Jeroen van Rijnandflysand7 9ecc378803 Suggest -microarch:native if popcnt instruction is missing.
Fixes #4453.
2024-12-01 11:54:53 +11:00
Jeroen van Rijnandflysand7 1a13322cd7 Missing paren. 2024-12-01 11:54:52 +11:00
Jeroen van Rijnandflysand7 c5d3fdca44 mem.is_aligned is in bytes, not log2 bytes
Fix formula and clarify comment
2024-12-01 11:54:52 +11:00
Jeroen van Rijnandflysand7 c9c237babf match_exact_value: return when type is compound
fixes #4431
2024-12-01 11:54:51 +11:00
Jeroen van Rijnandflysand7 1df246664f Fix image.which_bytes
Invert test in `which_bytes` to fix Softimage PIC detection. Fixes #4429.
2024-12-01 11:54:51 +11:00
Jeroen van RijnandGitHub 314c41ef33 Merge pull request #4534 from laytan/dynlib-unload-before-load
dynlib: unload library before loading again & add LIBRARY_FILE_EXTENSION constant
2024-11-28 21:20:07 +01:00
Jeroen van Rijn 6d83755e92 Fix assert when return value expected. 2024-11-28 20:44:57 +01:00