Files
OpenCellular/builtin/assert.h
nagendra modadugu e1dc48480f CR50: remove dependence of assert.h on util.h
Third party code includes standard system headers,
but may not have include paths configured for the
platform.

Remove the dependency between assert.h and
platform headers util.h, and panic.h.

BRANCH=none
BUG=chrome-os-partner:43025,chrome-os-partner:47524
TEST=make buildall succeeds

Change-Id: Ic8d4dc1944765d2f0f80782afa574d7b8e54eb0f
Signed-off-by: nagendra modadugu <ngm@google.com>
Reviewed-on: https://chromium-review.googlesource.com/347080
Commit-Ready: Nagendra Modadugu <ngm@google.com>
Tested-by: Nagendra Modadugu <ngm@google.com>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-05-25 18:51:07 -07:00

45 lines
1.0 KiB
C

/* Copyright 2016 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef __CROS_EC_ASSERT_H__
#define __CROS_EC_ASSERT_H__
/* Include CONFIG definitions for EC sources. */
#ifndef THIRD_PARTY
#include "common.h"
#endif
#ifdef CONFIG_DEBUG_ASSERT
#ifdef CONFIG_DEBUG_ASSERT_REBOOTS
#ifdef CONFIG_DEBUG_ASSERT_BRIEF
extern void panic_assert_fail(const char *fname, int linenum);
#define ASSERT(cond) do { \
if (!(cond)) \
panic_assert_fail(__FILE__, __LINE__); \
} while (0)
#else
extern void panic_assert_fail(const char *msg, const char *func,
const char *fname, int linenum);
#define ASSERT(cond) do { \
if (!(cond)) \
panic_assert_fail(#cond, __func__, __FILE__, \
__LINE__); \
} while (0)
#endif
#else
#define ASSERT(cond) do { \
if (!(cond)) \
__asm("bkpt"); \
} while (0)
#endif
#else
#define ASSERT(cond)
#endif
#define assert(x...) ASSERT(x)
#endif /* __CROS_EC_ASSERT_H__ */