This PR fixes some issues with the debug build in Visual Studio 2022.
Currently the build does not define DEBUG so all of the asserts are compiled out. I updated the build to define DEBUG and found that some of the asserts were broken. For example, there is a pointer validation assert that assumes that every pointer it checks should be writable. This is no longer the case as some string constants are now read-only. The assert used IsBadWritePointer to check the pointer which is a bad idea anyway, so I have replaced the check with a no-op.
While testing the debug build I fixed a few other random bugs. Most of these were type casting bugs, where bools were used for bitfields. I also fixed a crash on exiting debug builds. This was caused by the debug memory allocator trying to acquire a critical section which had been destructed. The original code relied on the link order to ensure that the global objects in utilglob.cpp were initialized first and destructed last. I have added a MSVC-specific pragma to force these objects to be initialized first to avoid having to rely on the link order.
I have also added build targets for all of the Kauai tools. I haven't extensively tested all of the tools but they all compile and run.
This PR fixes some issues with the debug build in Visual Studio 2022.
Currently the build does not define DEBUG so all of the asserts are compiled out. I updated the build to define DEBUG and found that some of the asserts were broken. For example, there is a pointer validation assert that assumes that every pointer it checks should be writable. This is no longer the case as some string constants are now read-only. The assert used IsBadWritePointer to check the pointer which is a bad idea anyway, so I have replaced the check with a no-op.
While testing the debug build I fixed a few other random bugs. Most of these were type casting bugs, where bools were used for bitfields. I also fixed a crash on exiting debug builds. This was caused by the debug memory allocator trying to acquire a critical section which had been destructed. The original code relied on the link order to ensure that the global objects in
utilglob.cpp
were initialized first and destructed last. I have added a MSVC-specific pragma to force these objects to be initialized first to avoid having to rely on the link order.I have also added build targets for all of the Kauai tools. I haven't extensively tested all of the tools but they all compile and run.