Flutter Engine
macros.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef TONIC_COMMON_MACROS_H_
6 #define TONIC_COMMON_MACROS_H_
7 
8 #include <cassert>
9 #include <cstdio>
10 #include <cstdlib>
11 
12 #include "tonic/common/log.h"
13 
14 #define TONIC_DISALLOW_COPY(TypeName) TypeName(const TypeName&) = delete;
15 
16 #define TONIC_DISALLOW_ASSIGN(TypeName) \
17  void operator=(const TypeName&) = delete;
18 
19 #define TONIC_DISALLOW_COPY_AND_ASSIGN(TypeName) \
20  TONIC_DISALLOW_COPY(TypeName) \
21  TONIC_DISALLOW_ASSIGN(TypeName)
22 
23 #define TONIC_CHECK(condition) \
24  { \
25  if (!(condition)) { \
26  tonic::Log("assertion failed " #condition); \
27  abort(); \
28  } \
29  }
30 
31 #ifndef NDEBUG
32 #define TONIC_DCHECK TONIC_CHECK
33 #else // NDEBUG
34 #define TONIC_DCHECK (void)
35 #endif // NDEBUG
36 
37 #endif // TONIC_COMMON_MACROS_H_