Commit Graph

127 Commits

Author SHA1 Message Date
bobsayshilol c1496ab6c0 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-10-27 22:02:34 +00:00
Feoramund 2938655a3d Fix CPU count detection in FreeBSD & NetBSD 2024-09-11 08:39:23 -04:00
Laytan 28c643d23f riscv compiler support 2024-09-01 21:42:47 +02:00
gingerBill 018026d844 Use gb_zero_* calls 2024-07-15 00:36:00 +01:00
Andreas T Jonsson 58f07698e8 Added arm64 support for NetBSD 2024-06-05 10:18:47 +02:00
gingerBill 8dec4f6ed3 Merge pull request #3570 from jasonKercher/linux-arm32
Get the compiler to build and work on arm32 Linux
2024-05-20 00:05:57 +01:00
jasonkercher 2183140e71 arm32 now compiles and runs demo 2024-05-10 13:24:43 -04:00
Andreas T Jonsson b72c2edabb Merge branch 'master' into netbsd 2024-05-10 09:04:52 +02:00
Feoramund 1165d65c94 Minimally support compiling Odin on FreeBSD arm64
This is enough to get Odin itself compiling and the demo running.
2024-05-05 07:26:45 -04:00
Andreas T Jonsson 4558f3992a Initial commit of NetBSD port 2024-04-16 14:27:29 +02:00
Laytan Laats e6a552e0ce fix gb.h to be able to use -fsanitize=address 2024-03-29 22:51:58 +01:00
Slendi c178f7199d Get Odin to compile on Haiku
This patch makes Odin to compile on Haiku which is a good first step.
Now, all that's needed to do is to figure out how to do futexes, which
I am blaming for the program crashing.
2024-02-15 15:51:28 +02:00
avanspector 70c150fc83 Fix gcc build
Although gcc is not officially supported, this little fix lets it to build Odin
2024-01-13 19:27:42 +01:00
gingerBill 9ff9587b7b Remove unused code in gb.h; Minimize use of heap_allocator() in parser 2023-08-16 00:41:49 +01:00
gingerBill 6568625dea Fix line error printing for error messages 2023-06-19 22:12:47 +01:00
gingerBill 4a8564aff7 Update threading.cpp to have helgrind annotations 2023-01-16 19:23:13 +00:00
Jeroen Ruigrok van der Werven b70d211f21 fix: Expand OpenBSD include for wait.h to all Unix
closes: #1968
2022-08-22 11:15:53 +02:00
Ronald1985 1829aa1638 Undo changes to common.cpp and move the include of sys/wait.h to gb.h 2022-07-22 23:08:46 +01:00
Jeroen van Rijn 2f7bd154a2 Additional cleanup of microsoft_craziness.h. 2022-05-27 20:59:46 +02:00
Jeroen van Rijn 3cab2592c3 Compiler: Add early error for output path being a directory.
- Introduce new `Path` type and an array of build paths on the build context.
- Resolve input and output paths/files early (before parsing).
- Error early if inputs are missing or outputs are directories.
- Plumb new file path generation into linker stage instead of its adhoc method.

TODO:
- Remove more adhoc file path generation in parser and linker stage.
- Make intermediate object file generation use new path system.
- Round out and robustify Path helper functions.
2022-04-24 13:37:26 +02:00
Sébastien Marie 0a90994403 provide a simple gb_file_copy() implementation
permit to not require sendfile(2) syscall for gb_file_copy()
2022-02-25 12:32:34 +00:00
Sébastien Marie 5676c9e7eb initial OpenBSD support 2022-02-25 08:49:25 +00:00
Jeroen van Rijn 2b5bc1d558 [report] Fix odin report crash if /usr/lib/os-release doesn't exist. 2022-02-22 17:08:57 +01:00
Yawning Angel dce120258f src: Add preliminary support for Linux AArch64
Tested via `tests/core`, on a Raspberry Pi 4 running the latest
64-bit Raspberry Pi OS image (LLVM 11).
2021-12-23 02:46:32 +00:00
skytrias 6399f2b014 fix strip-semicolon using original file handle size 2021-10-23 00:12:32 +02:00
gingerBill 76419383a8 Add some minor sanity checks to the compiler's heap_allocator_proc on Darwin 2021-09-08 14:45:53 +01:00
gingerBill aa8777ee47 Change the implementation of Arena to use virtual memory, and remove the old gbArena code 2021-08-26 15:38:34 +01:00
nakst 35204e3cc5 thread_pool.cpp: fix with 1 thread; gb.h: remove buggy /proc/cpuinfo code 2021-08-23 09:18:18 +01:00
gingerBill df372dbd5b Migrate and remove more from gb.h 2021-08-19 15:38:21 +01:00
gingerBill 9ae4de2ab8 Remove unused code from gb.h (which means it is heavily modified now) 2021-08-19 15:09:39 +01:00
gingerBill 33239324b8 Improve the C++ to be more correct for clang on Windows, still requiring the same disabled warnings as on *nix 2021-08-19 14:44:53 +01:00
gingerBill 423b842347 Fix typo 2021-08-07 15:07:29 +01:00
gingerBill 16eeae36d7 Inline heap_allocator resize logic on *nix platforms 2021-08-07 15:05:46 +01:00
gingerBill b0e64ca7e8 Prepare tokenizer for optimizations 2021-08-02 16:47:32 +01:00
gingerBill be76da2c90 Begin optimizing tokenizer; Replace gb_utf8_decode with utf8_decode (CC but easier to change later) 2021-08-01 23:56:17 +01:00
gingerBill f29b51efdd Fix gb_shuffle 2021-07-13 13:09:55 +01:00
gingerBill df4404e093 Fix typo in gb_get_env 2021-04-25 21:24:33 +01:00
gingerBill 583fd89fcf Add gb_get_env 2021-04-25 21:22:15 +01:00
Jason Dsouza 9d949ef82e Fix potential Typo : S32 ==> I32 2021-04-19 11:41:02 +05:30
Nakst 0d1addf0d4 Make size of allocation multiple of the alignment
To silence an error from GCC's address sanitizer.
2021-03-14 20:36:35 +00:00
gingerBill efdee0dafb Remove bit_field type from Odin (keyword and dead runtime code still exists) 2021-02-19 11:31:14 +00:00
gingerBill 9c1c9693f2 Patch up gb.h 2020-11-24 15:18:20 +00:00
gingerBill 776c3f4e90 Prepare for M1 Mac 2020-11-24 12:20:48 +00:00
gingerBill 17ec3e72a6 Add SCOPED_TEMPORARY_BLOCK for temporary allocations within a block 2020-11-15 18:45:40 +00:00
Christian Seibold ac126a8cd7 Add FreeBSD targets, get gb.h working with FreeBSD, fix odin_root_directory function for FreeBSD and a few other operating systems not yet added 2020-09-14 11:28:41 -05:00
gingerBill 5551404be4 Fix gb_alloc_str_len 2020-08-05 22:32:27 +01:00
gingerBill 37e3e081c6 Update microsoft_craziness.h to work correctly with the rest of the codebase (and not use WIN32_LEAN_AND_MEAN) 2019-11-27 15:18:32 +00:00
gingerBill 772c8779fa Clean up thread pool code 2019-09-03 22:11:21 +01:00
gingerBill 1348d8a8cd Improve thread pool (volatile hints, etc) 2019-09-02 18:49:23 +01:00
gingerBill 97dece15d7 Minor changes 2019-09-01 22:18:55 +01:00