diff --git a/build.sh b/build.sh index 0f5a919..5ed3dd9 100755 --- a/build.sh +++ b/build.sh @@ -74,8 +74,8 @@ fi # Configure with CMake print_status "Configuring with CMake..." -cmake .. -DCMAKE_BUILD_TYPE=Debug -#cmake .. -DCMAKE_BUILD_TYPE=Release +#cmake .. -DCMAKE_BUILD_TYPE=Debug +cmake .. -DCMAKE_BUILD_TYPE=Release # Build the project print_status "Building project..." diff --git a/src/main.cpp b/src/main.cpp index fed2d72..6dd061a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -87,6 +87,7 @@ std::string safearg(int argc, char *argv[], int index) int main(int argc, char* argv[]) { if (safearg(argc,argv,1) == "hash") return dropshell::hash_demo_raw(safearg(argc,argv,2)); + ASSERT_MSG(safearg(argc,argv,1) != "assert", "Hello! Here is an assert."); try { // silently attempt to load the config file. @@ -180,8 +181,8 @@ int main(int argc, char* argv[]) { } if (cmd == "edit" && argc < 4) { - ASSERT_ALWAYS(argc>=3); - dropshell::edit_server(argv[2]); + ASSERT_MSG(argc>=3, "Error: logic error!"); + dropshell::edit_server(safearg(argc,argv,2)); return 0; } diff --git a/src/utils/assert.hpp b/src/utils/assert.hpp index 898d7b9..03c9837 100644 --- a/src/utils/assert.hpp +++ b/src/utils/assert.hpp @@ -39,39 +39,16 @@ struct SourceLocation { } // namespace ds -// Define assertion macros with different behaviors based on build configuration -#if defined(NDEBUG) && !defined(DS_ENABLE_RELEASE_ASSERTS) - // Assertions disabled in release builds by default - #define ASSERT(condition) ((void)0) - #define ASSERT_MSG(condition, message) ((void)0) -#else - // Standard assertion - #define ASSERT(condition) \ - do { \ - if (!(condition)) { \ - ds::assert_fail(#condition, DS_CURRENT_LOCATION); \ - } \ - } while (false) - - // Assertion with custom message - #define ASSERT_MSG(condition, message) \ - do { \ - if (!(condition)) { \ - ds::assert_fail(#condition, DS_CURRENT_LOCATION, message); \ - } \ - } while (false) -#endif - -// Always-active assertion for critical checks, even in release builds -#define ASSERT_ALWAYS(condition) \ +// Standard assertion +#define ASSERT(condition) \ do { \ if (!(condition)) { \ ds::assert_fail(#condition, DS_CURRENT_LOCATION); \ } \ } while (false) - -// Always-active assertion with custom message for critical checks -#define ASSERT_ALWAYS_MSG(condition, message) \ + +// Assertion with custom message +#define ASSERT_MSG(condition, message) \ do { \ if (!(condition)) { \ ds::assert_fail(#condition, DS_CURRENT_LOCATION, message); \