mirror of
https://github.com/memtest86plus/memtest86plus.git
synced 2024-11-23 08:26:23 -06:00
26 lines
453 B
C
26 lines
453 B
C
|
// SPDX-License-Identifier: GPL-2.0
|
||
|
#ifndef ASSERT_H
|
||
|
#define ASSERT_H
|
||
|
/**
|
||
|
* \file
|
||
|
*
|
||
|
* Provides a function to terminate the program if an unexpected and fatal
|
||
|
* error is detected.
|
||
|
*
|
||
|
*//*
|
||
|
* Copyright (C) 2022 Martin Whitaker.
|
||
|
*/
|
||
|
|
||
|
/*
|
||
|
* Terminates the program (using a breakpoint exception) if expr is equal
|
||
|
* to zero.
|
||
|
*/
|
||
|
static inline void assert(int expr)
|
||
|
{
|
||
|
if (!expr) {
|
||
|
__asm__ __volatile__ ("int $3");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
#endif // ASSERT_H
|