src/include: Open brace on same line as enum or struct
[coreboot.git] / src / include / assert.h
blob90cc2a8b18850833b4f97c74dbb78029bdbc6827
1 /*
2 * This file is part of the coreboot project.
4 * Copyright (C) 2010 coresystems GmbH
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; version 2 of the License.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
16 #ifndef __ASSERT_H__
17 #define __ASSERT_H__
19 #include <arch/hlt.h>
20 #include <console/console.h>
22 /* GCC and CAR versions */
23 #define ASSERT(x) { \
24 if (!(x)) { \
25 printk(BIOS_EMERG, "ASSERTION ERROR: file '%s'" \
26 ", line %d\n", __FILE__, __LINE__); \
27 if (IS_ENABLED(CONFIG_FATAL_ASSERTS)) \
28 hlt(); \
29 } \
31 #define BUG() { \
32 printk(BIOS_EMERG, "ERROR: BUG ENCOUNTERED at file '%s'"\
33 ", line %d\n", __FILE__, __LINE__); \
34 if (IS_ENABLED(CONFIG_FATAL_ASSERTS)) \
35 hlt(); \
38 #define assert(statement) ASSERT(statement)
40 #endif // __ASSERT_H__