VCCC  2024.05
VisualCamp Common C++ library
debug_assert.hpp
Go to the documentation of this file.
1 //
2 // Created by YongGyu Lee on 4/15/24.
3 //
4 
5 #ifndef VCCC_CORE_DEBUG_ASSERT_HPP_
6 #define VCCC_CORE_DEBUG_ASSERT_HPP_
7 
8 #include <cassert>
9 
10 #define VCCC_LINE_LOCATION_IMPL2(file, line) \
11  "file: " file ", line " # line
12 
13 #define VCCC_LINE_LOCATION_IMPL(file, line) \
14  VCCC_LINE_LOCATION_IMPL2(file, line)
15 
16 #define VCCC_LINE_LOCATION \
17  VCCC_LINE_LOCATION_IMPL(__FILE__, __LINE__)
18 
19 #define VCCC_DEBUG_ASSERT(expr) \
20  assert(((void) "Assertion on " VCCC_LINE_LOCATION, expr))
21 
22 #endif // VCCC_CORE_DEBUG_ASSERT_HPP_