forked from Schroedi/cpp.react
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDefs.h
More file actions
62 lines (48 loc) · 1.63 KB
/
Defs.h
File metadata and controls
62 lines (48 loc) · 1.63 KB
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
59
60
61
62
// Copyright Sebastian Jeckel 2014.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef REACT_DETAIL_DEFS_H_INCLUDED
#define REACT_DETAIL_DEFS_H_INCLUDED
#pragma once
#include <cassert>
#include <cstddef>
///////////////////////////////////////////////////////////////////////////////////////////////////
#define REACT_BEGIN namespace react {
#define REACT_END }
#define REACT ::react
#define REACT_IMPL_BEGIN REACT_BEGIN namespace impl {
#define REACT_IMPL_END REACT_END }
#define REACT_IMPL REACT ::impl
#ifdef _DEBUG
#define REACT_MESSAGE(...) printf(__VA_ARGS__)
#else
#define REACT_MESSAGE
#endif
// Assert with message
#define REACT_ASSERT(condition, ...) for (; !(condition); assert(condition)) printf(__VA_ARGS__)
#define REACT_ERROR(...) REACT_ASSERT(false, __VA_ARGS__)
// Logging
#ifdef REACT_ENABLE_LOGGING
#define REACT_LOG(...) __VA_ARGS__
#else
#define REACT_LOG(...)
#endif
// Thread local storage
#if _WIN32 || _WIN64
// MSVC
#define REACT_TLS __declspec(thread)
#elif __GNUC__
// GCC
#define REACT_TLS __thread
#else
// Standard C++11
#define REACT_TLS thread_local
#endif
/***************************************/ REACT_IMPL_BEGIN /**************************************/
// Type aliases
using uint = unsigned int;
using uchar = unsigned char;
using std::size_t;
/****************************************/ REACT_IMPL_END /***************************************/
#endif // REACT_DETAIL_DEFS_H_INCLUDED