aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/compute/skc/assert_state.h
blob: b4724f9699b84ce29fbf5d386a9fb49852ff4ee9 (plain)
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
/*
 * Copyright 2017 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can
 * be found in the LICENSE file.
 *
 */

//
//
//

#pragma once

//
//
//

#include "macros.h"

//
//
//

#if 1

#include <assert.h>

#define SKC_ASSERT_STATE_DECLARE(st)            st state
#define SKC_ASSERT_STATE_MEMBER(sp)             SKC_CONCAT(sp,->state)
#define SKC_ASSERT_STATE_INIT(sp,to)            SKC_ASSERT_STATE_MEMBER(sp) = (to)
#define SKC_ASSERT_STATE_TRANSITION(from,to,sp) assert(SKC_ASSERT_STATE_MEMBER(sp) == (from)); SKC_ASSERT_STATE_INIT(sp,to)
#define SKC_ASSERT_STATE_ASSERT(at,sp)          assert(SKC_ASSERT_STATE_MEMBER(sp) == (at))

#else

#define SKC_ASSERT_STATE_DECLARE(st)
#define SKC_ASSERT_STATE_INIT(sp,to)
#define SKC_ASSERT_STATE_TRANSITION(from,to,sp)
#define SKC_ASSERT_STATE_ASSERT(at,sp)

#endif

//
//
//