blob: b4724f9699b84ce29fbf5d386a9fb49852ff4ee9 [file] [log] [blame]
Allan MacKinnon4359d522018-06-19 13:57:04 -07001/*
2 * Copyright 2017 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can
5 * be found in the LICENSE file.
6 *
7 */
8
9//
10//
11//
12
13#pragma once
14
15//
16//
17//
18
19#include "macros.h"
20
21//
22//
23//
24
25#if 1
26
27#include <assert.h>
28
29#define SKC_ASSERT_STATE_DECLARE(st) st state
30#define SKC_ASSERT_STATE_MEMBER(sp) SKC_CONCAT(sp,->state)
31#define SKC_ASSERT_STATE_INIT(sp,to) SKC_ASSERT_STATE_MEMBER(sp) = (to)
32#define SKC_ASSERT_STATE_TRANSITION(from,to,sp) assert(SKC_ASSERT_STATE_MEMBER(sp) == (from)); SKC_ASSERT_STATE_INIT(sp,to)
33#define SKC_ASSERT_STATE_ASSERT(at,sp) assert(SKC_ASSERT_STATE_MEMBER(sp) == (at))
34
35#else
36
37#define SKC_ASSERT_STATE_DECLARE(st)
38#define SKC_ASSERT_STATE_INIT(sp,to)
39#define SKC_ASSERT_STATE_TRANSITION(from,to,sp)
40#define SKC_ASSERT_STATE_ASSERT(at,sp)
41
42#endif
43
44//
45//
46//