Commit Graph

13158 Commits

Author SHA1 Message Date
Dominik Pötzschke
f37ec05548 adjust memory allocation 2024-12-01 11:54:52 +11:00
Dominik Pötzschke
841996435b fix: fix windows params bug 2024-12-01 11:54:52 +11:00
gingerBill
11768c6217 Minor formatting change 2024-12-01 11:54:52 +11:00
Colin Davidson
514faa517e oops, missed a comma 2024-12-01 11:54:52 +11:00
Colin Davidson
3b4338b685 add new test, better fail-check, and non-transitioning tz fix 2024-12-01 11:54:52 +11:00
0dminnimda
24ec0f0ebf Revert further simplifiction 2024-12-01 11:54:52 +11:00
0dminnimda
a7f32109e8 Simplify further 2024-12-01 11:54:52 +11:00
0dminnimda
4f37b34654 Simplify use of pie 2024-12-01 11:54:52 +11:00
0dminnimda
480f32586e Add support for linking as pie 2024-12-01 11:54:52 +11:00
gingerBill
619b382635 Fix previous commit for arrays 2024-12-01 11:54:52 +11:00
gingerBill
50e46326a6 Fix bug for foo().bar where foo() is a 0-value expression 2024-12-01 11:54:52 +11:00
gingerBill
fafac1bc77 Fix auto_cast matrix bug 2024-12-01 11:54:52 +11:00
gingerBill
d5b6c25686 Fix #4406 os2 to not close the std file handles but rather just free the memory for the ^File data. 2024-12-01 11:54:52 +11:00
NicknEma
1b7a32f76c Mark procs as "contextless" in winerror.odin
So that they can be called from places like the windproc and stuff.
2024-12-01 11:54:52 +11:00
Jeroen van Rijn
1a13322cd7 Missing paren. 2024-12-01 11:54:52 +11:00
Jeroen van Rijn
c5d3fdca44 mem.is_aligned is in bytes, not log2 bytes
Fix formula and clarify comment
2024-12-01 11:54:52 +11:00
p2jason
ee84aa4ead Removed event hook callback from add_*_event_listener functions 2024-12-01 11:54:52 +11:00
p2jason
f993fcb82c Removed event queue from add_*_event_listener JS functions and added event hook callback 2024-12-01 11:54:52 +11:00
p2jason
aa08f661ca Changed boolean parameters to bit set in the add_*_event_listener functions 2024-12-01 11:54:52 +11:00
p2jason
0eac9f15bc Added parameters to the add_*_event_listener JS functions for stopping event behavior 2024-12-01 11:54:52 +11:00
Laytan Laats
9adc7f2bcf fix tabs 2024-12-01 11:54:52 +11:00
Laytan Laats
6866e69cb9 add time/timezone to docs 2024-12-01 11:54:52 +11:00
Laytan Laats
9735f8a0ba add CoreFoundation and Security to docs 2024-12-01 11:54:52 +11:00
Laytan Laats
7b63abdba3 add kqueue to docs 2024-12-01 11:54:52 +11:00
Laytan Laats
e6d324c5c4 testing: separate the posix import into target files
This is needed for the docs generator to generate all the docs for the
posix package, if it is imported like it was on Windows it would
generate docs for the Windows version of the package which has much less
symbols exposed.
2024-12-01 11:54:52 +11:00
Barinzaya
6fa646cbf1 Fixed raymath not applying matrix translations.
Translation matrices use the w components of the matrix to apply the
transform, and thus only work when the w component is 1. In the
original raymath implementation, the multiplication is done manually
and adds the translation components directly to the result, as if w is
1, but in the Odin binding this is done with a matrix multiplication.
However, the w component is set to 0 instead of 1, resulting in the
translation not being applied.
2024-12-01 11:54:52 +11:00
peachey2k2
186499c8af Add "-build-mode:dynamic" to the "odin help build" output 2024-12-01 11:54:52 +11:00
Laytan Laats
c08408ea08 fix thread_unix for Darwin after pthread corrections in posix package
afed3ce removed the sys/unix package and moved over to sys/posix, it has
new bindings for the pthread APIs but should have been equivalent (not).

8fb7182 used `CANCEL_ENABLE :: 0`, `CANCEL_DISABLE :: 1`, `CANCEL_DEFERRED :: 0`, `CANCEL_ASYNCHRONOUS :: 1` for Darwin, while the
correct values are `1`, `0`, `2` and `0` respectively (same mistake was made for
FreeBSD in that commit).

What this meant is that the
`pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS)` was not actually
successful, but because the error wasn't checked it was assumed it was.
It also meant `pthread_setcancelstate(PTHREAD_CANCEL_ENABLE)` would
actually be setting `PTHREAD_CANCEL_DISABLE`.

The code in this PR restores the behaviour by now actually deliberately
setting `PTHREAD_CANCEL_DISABLE` and not setting
`PTHREAD_CANCEL_ASYNCHRONOUS` which was the previous behaviour that does
actually seem to work for some reason.

(I also fixed an issue in fmt where `x` would use uppercase if it was a
pointer.)
2024-12-01 11:54:52 +11:00
bobsayshilol
96e6393614 Plug a memory leak
The call to |array_make()| always allocates and since this variable was
unused it lead to a leak. Simply plug it by removing it.
2024-12-01 11:54:52 +11:00
bobsayshilol
73b6461710 Add missing guards around push/pop pragmas
This matches all the other places where we silence Windows warnings.
2024-12-01 11:54:52 +11:00
bobsayshilol
56094f3580 Fix passing nullptr to args marked as non-null
libstdc++'s |memcpy| and |memset| both state that their inputs should
never be a nullptr since this matches the C spec. Some compilers act on
these hints, so we shouldn't unconditionally call these as it would
signal to the compiler that they can't be nullptrs.

As an example, the following code will always call |do_something()|
when compiled with optimisations since GCC version 4.9:
```
    void clear(void *ptr, int size) {
        memset(ptr, 0, size);
    }
    void example(void *ptr, int size) {
        clear(ptr, size);
        if (ptr != nullptr) do_something();
    }
```
2024-12-01 11:54:52 +11:00
bobsayshilol
30fb2ed59d Avoid undefined arithmetic shifting
The result of a left shift on a positive signed integer (Rune) must fit
into an unsigned integer otherwise it's undefined behaviour, as is left
shifting a negative integer by any amount. This code can only be hit if
|x >= 0xf0| and hence a left shift of 31 will always be undefined
unless the input is 0 or 1.

To avoid hitting this we can instead extend the lowest bit to be the
mask if we assume that ints are 2's complement, which we already do
elsewhere. This generates identical code in testing on Compiler
Explorer and the Odin test suite passes locally with this change.

Note that the original code would change to be defined behaviour in
C++20, however we are currently build with |-std=c++14| in the build
scripts.
2024-12-01 11:54:51 +11:00
bobsayshilol
ddde456af7 Avoid member access through nullptr in debug
If |result_count| is 0 then |results| will be a nullptr and hence the
access |results->Tuple| is undefined behaviour. There's already an
early return in the 0 branch so move that to be the first thing so that
we can guarantee that it's not a nullptr.

Note that technically we take the address of the result so it's not
actually dereferencing it, however UBSan doesn't care about that.
2024-12-01 11:54:51 +11:00
bobsayshilol
b10538da7a Fix invalid union access
UBSan spotted that |src->Basic.kind| had a value outside the range of
|BasicKind| due to it actually being a |Type_Pointer|. Since these are
stored in a union there could be cases where the value of |kind| just
so happens to be |Basic_string|, in which case the branch would have
been taken when it shouldn't have been.

To fix this simply check that it's a |Type_Basic| before treating it as
a |Basic|.
2024-12-01 11:54:51 +11:00
Laytan
78dc4d4907 fix test 2024-12-01 11:54:51 +11:00
Laytan
9f1c894f1f port pthread_mutex_t and pthread_cond_t from sys/unix cause miniaudio wants it 2024-12-01 11:54:51 +11:00
Laytan
f342215b4d clean up dynlib and path/filepath with sys/posix 2024-12-01 11:54:51 +11:00
Laytan
2b5f0fc729 remove pthread from sys/unix and use sys/posix where used 2024-12-01 11:54:51 +11:00
Laytan
7de56ec852 fix #load_directory including nested directories 2024-12-01 11:54:51 +11:00
Laytan Laats
49ddbd9b99 sys/posix: impl rest of linux, impl some of Windows 2024-12-01 11:54:51 +11:00
Karl Zylinski
879771fe32 Fix for using utf8string.at with last rune index returning wrong rune. 2024-12-01 11:54:51 +11:00
Jeroen van Rijn
c9c237babf match_exact_value: return when type is compound
fixes #4431
2024-12-01 11:54:51 +11:00
Alexis Caraballo
d9326ae93d fix cbor.to_json always returning array of tuples for objects
to_json uses a small proc to check if all keys of an object are strings.
It was always returning false for any input.
2024-12-01 11:54:51 +11:00
Jeroen van Rijn
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
Laytan
5faefac106 math/rand: choice_bit_set return not_empty -> ok 2024-12-01 11:54:51 +11:00
Laytan Laats
d85f18e898 math/rand: add choice_bit_set 2024-12-01 11:54:51 +11:00
Patric Dexheimer
12cfc9b8de Update process_windows.odin
Mistype
2024-12-01 11:54:51 +11:00
IllusionMan1212
fafb2b1e75 core/io: correctly escape runes greater than 0xFFFF 2024-12-01 11:54:51 +11:00
Yawning Angel
111f10cbbf src/big_int.cpp: Use square-multiply for exponentiation
For utterly unrealistic constant sizes, this still crashes on my system,
but it crashes fast due to the OOM killer, and people using rediculously
large exponents get what they deserve.
2024-12-01 11:54:51 +11:00
gingerBill
197339d91d Add warning for unsigned >= 0 like conditions in a for loop 2024-12-01 11:54:51 +11:00