coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
assert.h File Reference
#include <arch/hlt.h>
#include <console/console.h>
#include <stdint.h>
Include dependency graph for assert.h:

Go to the source code of this file.

Macros

#define __ASSERT_FILE__   __FILE__
 
#define __ASSERT_LINE__   __LINE__
 
#define __build_time_assert(x)    (__builtin_constant_p(x) ? ((x) ? 1 : dead_code_t(int)) : 0)
 
#define MOCK_ASSERT(result, expression)
 
#define ASSERT(x)
 
#define ASSERT_MSG(x, msg)
 
#define BUG()
 
#define assert(statement)   ASSERT(statement)
 
#define dead_code()   _dead_code_assertion_failed()
 
#define dead_code_t(type)
 
#define pointer_to_uint32_safe(x)
 

Functions

void mock_assert (const int result, const char *const expression, const char *const file, const int line)
 
void _dead_code_assertion_failed (void)
 

Macro Definition Documentation

◆ __ASSERT_FILE__

#define __ASSERT_FILE__   __FILE__

Definition at line 21 of file assert.h.

◆ __ASSERT_LINE__

#define __ASSERT_LINE__   __LINE__

Definition at line 22 of file assert.h.

◆ __build_time_assert

#define __build_time_assert (   x)     (__builtin_constant_p(x) ? ((x) ? 1 : dead_code_t(int)) : 0)

Definition at line 26 of file assert.h.

◆ assert

#define assert (   statement)    ASSERT(statement)

Definition at line 74 of file assert.h.

◆ ASSERT

#define ASSERT (   x)
Value:
{ \
if (!__build_time_assert(x) && !(x)) { \
printk(BIOS_EMERG, \
"ASSERTION ERROR: file '%s', line %d\n", \
MOCK_ASSERT(!!(x), #x); \
if (CONFIG(FATAL_ASSERTS)) \
hlt(); \
} \
}
#define __build_time_assert(x)
Definition: assert.h:26
#define __ASSERT_FILE__
Definition: assert.h:21
#define __ASSERT_LINE__
Definition: assert.h:22
@ CONFIG
Definition: dsi_common.h:201
int x
Definition: edid.c:994
#define BIOS_EMERG
BIOS_EMERG - Emergency / Fatal.
Definition: loglevel.h:25

Definition at line 44 of file assert.h.

◆ ASSERT_MSG

#define ASSERT_MSG (   x,
  msg 
)
Value:
{ \
if (!__build_time_assert(x) && !(x)) { \
printk(BIOS_EMERG, \
"ASSERTION ERROR: file '%s', line %d\n", \
printk(BIOS_EMERG, "%s", msg); \
MOCK_ASSERT(!!(x), (msg)); \
if (CONFIG(FATAL_ASSERTS)) \
hlt(); \
} \
}

Definition at line 54 of file assert.h.

◆ BUG

#define BUG ( )
Value:
{ \
printk(BIOS_EMERG, \
"ERROR: BUG ENCOUNTERED at file '%s', line %d\n", \
MOCK_ASSERT(0, "BUG ENCOUNTERED"); \
if (CONFIG(FATAL_ASSERTS)) \
hlt(); \
}

Definition at line 65 of file assert.h.

◆ dead_code

#define dead_code ( )    _dead_code_assertion_failed()

Definition at line 89 of file assert.h.

◆ dead_code_t

#define dead_code_t (   type)
Value:
({ \
dead_code(); \
*(type *)(uintptr_t)0; \
})
unsigned int type
Definition: edid.c:57
unsigned long uintptr_t
Definition: stdint.h:21

Definition at line 92 of file assert.h.

◆ MOCK_ASSERT

#define MOCK_ASSERT (   result,
  expression 
)

Definition at line 40 of file assert.h.

◆ pointer_to_uint32_safe

#define pointer_to_uint32_safe (   x)
Value:
({ \
})
unsigned int uint32_t
Definition: stdint.h:14

Definition at line 104 of file assert.h.

Function Documentation

◆ _dead_code_assertion_failed()

void _dead_code_assertion_failed ( void  )

◆ mock_assert()

void mock_assert ( const int  result,
const char *const  expression,
const char *const  file,
const int  line 
)