acrn-hypervisor/hypervisor/include/debug/assert.h
Junjie Mao 0f777d3fe1 HV: assert: use signed int for __LINE__
GCC preprocessor expands __LINE__ to signed decimal integers. Keep the prototype
of __assert aligned with this.

Signed-off-by: Junjie Mao <junjie.mao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-07-10 13:10:10 +08:00

22 lines
395 B
C

/*
* Copyright (C) 2018 Intel Corporation. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef ASSERT_H
#define ASSERT_H
#ifdef HV_DEBUG
void __assert(int32_t line, const char *file, const char *txt);
#define ASSERT(x, ...) \
if (!(x)) {\
__assert(__LINE__, __FILE__, "fatal error");\
}
#else
#define ASSERT(x, ...) do { } while(0)
#endif
#endif /* ASSERT_H */