This commit is contained in:
Timerix22 2024-05-02 02:37:28 +05:00
parent 0217edf080
commit 732633451e
4 changed files with 13 additions and 3 deletions

View File

@ -80,7 +80,7 @@ case "$TASK" in
;; ;;
# creates executable with debug info and no optimizations # creates executable with debug info and no optimizations
build_exec_dbg) build_exec_dbg)
C_ARGS="-O0 -g" C_ARGS="-O0 -g -DDEBUG=1"
CPP_ARGS="$C_ARGS" CPP_ARGS="$C_ARGS"
LINKER_ARGS="$CPP_ARGS $LINKER_LIBS" LINKER_ARGS="$CPP_ARGS $LINKER_LIBS"
PRE_TASK_SCRIPT=tasks/pre_build.sh PRE_TASK_SCRIPT=tasks/pre_build.sh

View File

@ -17,3 +17,11 @@ public:
virtual char const* what() const noexcept; virtual char const* what() const noexcept;
}; };
#if DEBUG == 1
/// Use this macro to find bugs in debug build. Release build could be compiled without asserts. Define DEBUG=1 to enable assert compilation.
#define assert(EXPR, ERRMSG) if(!EXPR) throw UsefulException(ERRMSG);
#else
/// Use this macro to find bugs in debug build. Release build could be compiled without asserts. Define DEBUG=1 to enable assert compilation.
#define assert(EXPR, ERRMSG) EXPR
#endif

View File

@ -4,7 +4,7 @@
#include "UsefulException.hpp" #include "UsefulException.hpp"
#include "../dependencies/kerep/src/base/base.h" #include "../dependencies/kerep/src/base/base.h"
std::string format(const std::string format_str, size_t args_count, ...){ std::string _format(const std::string format_str, size_t args_count, ...){
va_list vl; va_list vl;
va_start(vl, args_count); va_start(vl, args_count);
std::stringstream ss; std::stringstream ss;

View File

@ -1,5 +1,7 @@
#pragma once #pragma once
#include <string> #include <string>
#include "../dependencies/kerep/src/base/std.h"
std::string format(const std::string format_str, size_t args_count, ...); std::string _format(const std::string format_str, size_t args_count, ...);
#define format(FORMAT_STR, ARGS...) _format(FORMAT_STR, count_args(ARGS) ,##ARGS)