Fix builds which use "-DDEBUG"#5946
Merged
sturnclaw merged 4 commits intopioneerspacesim:masterfrom Nov 4, 2024
Merged
Conversation
When the "DEBUG" build macro is supplied during a build, the "LUA_DEBUG_xxx" macros are enabled. These macros rely on some functionality in "Log.h", which has been lost in some source files during various refactrors over the years. This patch adds these back in, as well as fixing a couple of instances where the LUA_DEBUG_xx macros themselves were no longer working. NOTE: This patch only fixes the compile-time errors. When running with "DEBUG" enabled, various LUA_DEBUG_xx macros fail at runtime, indicating either that the invariants they check are no longer true and must be updated, or that a bug has been introduced in the code in the meantime.
- Fix extra metatype object being left on the stack in unwanted cases - Fix extra load of the global IO namespace in Sandbox.cpp - Fix error where we tried to validate the presence of one more value on the stack than we actually wanted
Also add missing validation to LuaObjectBase::PushRegister()
d472978 to
3ccb261
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thanks to @WickedSmoke (IRC) for pointing out that the debug builds were broken when "-DDEBUG" is specified as part of the build.
Specifically, "DEBUG" enables the "LUA_DEBUG" symbols, and these no longer compile in the current codebase. This patch fixes the compilation errors, but, notably, now cause runtime problems such as:
This patch also replaces all instances of checking "DEBUG" with checks against "NDEBUG" instead, as the latter is part of the C/C++ language standards and thus independant of any particular build system.