blob: ce631e3e4bc016bc3e22d1ef847ebaa24fe42091 [file] [log] [blame]
Ambroise Vincent4128f9f2019-02-11 13:34:41 +00001/*
2 * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef ASSERT_H
8#define ASSERT_H
9
10#include <cdefs.h>
11
Ambroise Vincent4128f9f2019-02-11 13:34:41 +000012#include <common/debug.h>
13
Ambroise Vincent4128f9f2019-02-11 13:34:41 +000014#if ENABLE_ASSERTIONS
Ambroise Vincent8a573de2019-02-11 13:54:30 +000015#define assert(e) ((e) ? (void)0 : __assert(__FILE__, __LINE__, #e))
Ambroise Vincent4128f9f2019-02-11 13:34:41 +000016#else
17#define assert(e) ((void)0)
18#endif /* ENABLE_ASSERTIONS */
19
Ambroise Vincent4128f9f2019-02-11 13:34:41 +000020__dead2 void __assert(const char *file, unsigned int line,
21 const char *assertion);
Ambroise Vincent4128f9f2019-02-11 13:34:41 +000022
23#endif /* ASSERT_H */