aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/minikql/defs.h
blob: 3e332363c6cc53f33e15f32fca9e12a4037269ef (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#pragma once

// unique tag to fix pragma once gcc glueing: ./ydb/library/yql/minikql/defs.h

#include <util/system/compiler.h>
#include <util/generic/array_ref.h>
#include <util/generic/yexception.h>

#define THROW ::NKikimr::TThrowable() , __LOCATION__ +

#define MKQL_ENSURE(condition, message)                               \
    do {                                                              \
        if (Y_UNLIKELY(!(condition))) {                               \
            (THROW yexception() << __FUNCTION__ << "(): requirement " \
                << #condition << " failed. " <<  message);            \
        }                                                             \
    } while (0)

#define MKQL_ENSURE_WITH_LOC(location, condition, message)      \
    do {                                                        \
        if (Y_UNLIKELY(!(condition))) {                         \
            ThrowException(location + yexception() << message); \
        }                                                       \
    } while (0)

#define MKQL_ENSURE_S(condition, ...)                                 \
    do {                                                              \
        if (Y_UNLIKELY(!(condition))) {                               \
            (THROW yexception() << __FUNCTION__ << "(): requirement " \
                << #condition << " failed. " << "" __VA_ARGS__);      \
        }                                                             \
    } while (0)

namespace NKikimr {

template <typename T>
[[noreturn]] void ThrowException(T&& e)
{
    throw e;
}

struct TThrowable
{
    template <typename T>
    [[noreturn]] void operator,(T&& e) {
        ThrowException(e);
    }
};

typedef
#ifdef _win_
struct { ui64 Data, Meta; }
#else
unsigned __int128
#endif
TRawUV;

}