Ariles
include
ariles2
internal
exception.h
Go to the documentation of this file.
1
/**
2
@file
3
@author Alexander Sherikov
4
5
@copyright 2019 Alexander Sherikov, Licensed under the Apache License, Version 2.0.
6
(see @ref LICENSE or http://www.apache.org/licenses/LICENSE-2.0)
7
8
@brief Throw & assert macro
9
*/
10
11
#ifndef H_CPPUT_EXCEPTION
12
#define H_CPPUT_EXCEPTION
13
14
#include <stdexcept>
15
#include "
concat.h
"
16
17
#define CPPUT_THROW_EXCEPTION(exception_type, message) throw exception_type((message))
18
19
#define CPPUT_THROW(...) \
20
CPPUT_THROW_EXCEPTION(std::runtime_error, cpput::concat::simple("In "
, __func__, "() // ", __VA_ARGS__))
21
22
23
#define CPPUT_PERSISTENT_ASSERT(condition, ...) \
24
if (!(condition))
/* NOLINT */
\
25
{ \
26
CPPUT_THROW(__VA_ARGS__); \
27
};
28
29
#ifdef DNDEBUG
30
# define CPPUT_ASSERT(condition, ...)
31
#else
32
# define CPPUT_ASSERT(condition, ...) CPPUT_PERSISTENT_ASSERT(condition, __VA_ARGS__)
33
#endif
34
35
#endif
concat.h
Generated by
1.9.1