blob: e3ac7581d00cb52f291a1efe5e4849a8582cd449 [file] [log] [blame]
Andrew Scull5c496a32019-04-04 11:57:33 +01001/*
2 * Copyright 2019 The Hafnium Authors.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * https://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#pragma once
18
19#if !defined(__cplusplus)
Andrew Scullf8252932019-04-04 13:51:22 +010020
21#include "hf/panic.h"
22
23/**
24 * Only use for exceptional cases and never if the condition could be true e.g.
25 * when processing external inputs.
26 */
27#define assert(x) \
28 do { \
29 if (!(x)) { \
30 panic("assertion failed (%s) at %s:%d", #x, __FILE__, \
31 __LINE__); \
32 } \
33 } while (0)
34
Andrew Scull5c496a32019-04-04 11:57:33 +010035#define static_assert _Static_assert
Andrew Scullf8252932019-04-04 13:51:22 +010036
Andrew Scull5c496a32019-04-04 11:57:33 +010037#endif