UBSAN is reporting that some uninitialized variables. To that end, I
would like to add member default initializers to e.g. ``struct
object``. Doing that makes classes nontrivial.
Allocations throughout the code occur with e.g.
``mem_malloc(sizeof(T))``, which is, tersely speaking, incompatible
with triviality. Therefore, mem_malloc call sites will be rewritten
to invoke ``mem_rmalloc<T>`` instead, to enforce a compile-time check
that ``T`` is indeed trivial.
``mem_rmalloc<T>`` is modeled to look like ``make_unique<T>``, i.e.
can be called with no arguments to allocate space for a single thing,
or called with a size_t argument that specifies the number of
elements (automatic byte sizing is applied internally).
Use Real-time library memory functions by default which improves overall performance. Minor cleanups.
Introduce new CMake option to enable/disable RTL memory functions (enabled by default).
- Add macro PRIMARY_HOG to define the hardcoded hog filename to load.
- Replace instances of "LINUX" with "__LINUX__"
- Remove these macros entirely because they are (now) unused
- LINUX
- _REENRANT
- __32BIT__
- Removed from CMakeFile.txt because they are in linux_fix.h
- _MAX_PATH=260
- _MAX_FNAME=256
Join the license header with historical comments using a separator so IDEs can correctly parse the initial header.
Also use .gitattributes to ensure all files are LF.
The vast majority of this is fixing up `char *` that should be `const char *`
but a handful of other fixes, like potential buffer overflows that GCC
noticed, etc, were applied as well.
This removes `-Wno-write-strings` from CMakeLists.txt, as it is no longer
necessary, as there is no longer a flood of compiler warning spam when
building.
This does not fix all compiler warnings; there are still a handful, and they
are legitimate, but they can be dealt with in a future commit.
The MACINTOSH define refers to MacOS Classic (not OS X) which we do not
plan to support. Rather than carry the cruft forever, let's delete it.
NOTE: legacy/ is unused but we're keeping it around, so MACINTOSH uses
there are left alone.
Process used for this commit:
```
git rm -r mac
find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" \) \
-exec unifdef -UMACINTOSH -o {} {} \;
git restore legacy
git add .
```
Test Plan:
On Mac, build both Debug and Release
```
cmake --build --preset mac --config Debug
cmake --build --preset mac --config Release
```
- tabs to spaces
- use Unix line endings everywhere
- newline at end of file
- remove trailing white space
- no space between keywords and opening parenthesis
- use 2 spaces to indent