• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2021 The Pigweed Authors
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); you may not
4 // use this file except in compliance with the License. You may obtain a copy of
5 // the License at
6 //
7 //     https://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 // License for the specific language governing permissions and limitations under
13 // the License.
14 #pragma once
15 
16 #include "pw_assert/check.h"
17 
18 // Optional short CHECK name definitions
19 
20 // clang-format off
21 // Checks that always run even in production.
22 #define CRASH                 PW_CRASH
23 #define CHECK                 PW_CHECK
24 #define CHECK_PTR_LE          PW_CHECK_PTR_LE
25 #define CHECK_PTR_LT          PW_CHECK_PTR_LT
26 #define CHECK_PTR_GE          PW_CHECK_PTR_GE
27 #define CHECK_PTR_GT          PW_CHECK_PTR_GT
28 #define CHECK_PTR_EQ          PW_CHECK_PTR_EQ
29 #define CHECK_PTR_NE          PW_CHECK_PTR_NE
30 #define CHECK_NOTNULL         PW_CHECK_NOTNULL
31 #define CHECK_INT_LE          PW_CHECK_INT_LE
32 #define CHECK_INT_LT          PW_CHECK_INT_LT
33 #define CHECK_INT_GE          PW_CHECK_INT_GE
34 #define CHECK_INT_GT          PW_CHECK_INT_GT
35 #define CHECK_INT_EQ          PW_CHECK_INT_EQ
36 #define CHECK_INT_NE          PW_CHECK_INT_NE
37 #define CHECK_UINT_LE         PW_CHECK_UINT_LE
38 #define CHECK_UINT_LT         PW_CHECK_UINT_LT
39 #define CHECK_UINT_GE         PW_CHECK_UINT_GE
40 #define CHECK_UINT_GT         PW_CHECK_UINT_GT
41 #define CHECK_UINT_EQ         PW_CHECK_UINT_EQ
42 #define CHECK_UINT_NE         PW_CHECK_UINT_NE
43 #define CHECK_FLOAT_NEAR      PW_CHECK_FLOAT_NEAR
44 #define CHECK_FLOAT_EXACT_LE  PW_CHECK_FLOAT_EXACT_LE
45 #define CHECK_FLOAT_EXACT_LT  PW_CHECK_FLOAT_EXACT_LT
46 #define CHECK_FLOAT_EXACT_GE  PW_CHECK_FLOAT_EXACT_GE
47 #define CHECK_FLOAT_EXACT_GT  PW_CHECK_FLOAT_EXACT_GT
48 #define CHECK_FLOAT_EXACT_EQ  PW_CHECK_FLOAT_EXACT_EQ
49 #define CHECK_FLOAT_EXACT_NE  PW_CHECK_FLOAT_EXACT_NE
50 #define CHECK_OK              PW_CHECK_OK
51 
52 // Checks that are disabled if NDEBUG is not defined.
53 #define DCHECK                PW_DCHECK
54 #define DCHECK_PTR_LE         PW_DCHECK_PTR_LE
55 #define DCHECK_PTR_LT         PW_DCHECK_PTR_LT
56 #define DCHECK_PTR_GE         PW_DCHECK_PTR_GE
57 #define DCHECK_PTR_GT         PW_DCHECK_PTR_GT
58 #define DCHECK_PTR_EQ         PW_DCHECK_PTR_EQ
59 #define DCHECK_PTR_NE         PW_DCHECK_PTR_NE
60 #define DCHECK_NOTNULL        PW_DCHECK_NOTNULL
61 #define DCHECK_INT_LE         PW_DCHECK_INT_LE
62 #define DCHECK_INT_LT         PW_DCHECK_INT_LT
63 #define DCHECK_INT_GE         PW_DCHECK_INT_GE
64 #define DCHECK_INT_GT         PW_DCHECK_INT_GT
65 #define DCHECK_INT_EQ         PW_DCHECK_INT_EQ
66 #define DCHECK_INT_NE         PW_DCHECK_INT_NE
67 #define DCHECK_UINT_LE        PW_DCHECK_UINT_LE
68 #define DCHECK_UINT_LT        PW_DCHECK_UINT_LT
69 #define DCHECK_UINT_GE        PW_DCHECK_UINT_GE
70 #define DCHECK_UINT_GT        PW_DCHECK_UINT_GT
71 #define DCHECK_UINT_EQ        PW_DCHECK_UINT_EQ
72 #define DCHECK_UINT_NE        PW_DCHECK_UINT_NE
73 #define DCHECK_FLOAT_NEAR     PW_DCHECK_FLOAT_NEAR
74 #define DCHECK_FLOAT_EXACT_LT PW_DCHECK_FLOAT_EXACT_LT
75 #define DCHECK_FLOAT_EXACT_LE PW_DCHECK_FLOAT_EXACT_LE
76 #define DCHECK_FLOAT_EXACT_GT PW_DCHECK_FLOAT_EXACT_GT
77 #define DCHECK_FLOAT_EXACT_GE PW_DCHECK_FLOAT_EXACT_GE
78 #define DCHECK_FLOAT_EXACT_EQ PW_DCHECK_FLOAT_EXACT_EQ
79 #define DCHECK_FLOAT_EXACT_NE PW_DCHECK_FLOAT_EXACT_NE
80 #define DCHECK_OK             PW_DCHECK_OK
81 // clang-format on
82