assert
This commit is contained in:
parent
0217edf080
commit
732633451e
@ -80,7 +80,7 @@ case "$TASK" in
|
||||
;;
|
||||
# creates executable with debug info and no optimizations
|
||||
build_exec_dbg)
|
||||
C_ARGS="-O0 -g"
|
||||
C_ARGS="-O0 -g -DDEBUG=1"
|
||||
CPP_ARGS="$C_ARGS"
|
||||
LINKER_ARGS="$CPP_ARGS $LINKER_LIBS"
|
||||
PRE_TASK_SCRIPT=tasks/pre_build.sh
|
||||
|
||||
@ -17,3 +17,11 @@ public:
|
||||
|
||||
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
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
#include "UsefulException.hpp"
|
||||
#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_start(vl, args_count);
|
||||
std::stringstream ss;
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#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)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user