source: branches/reconfiguration/softs/libs/assert.h @ 1019

Last change on this file since 1019 was 850, checked in by cfuguet, 10 years ago

reconf: introducing a softs directory in the reconfiguration branch

  • This softs directory contains a minimalistic (giet-like) library of drivers and some utility functions.
  • Introducing a simple unit test in the vci_cc_vcache_wrapper component to test the newly introduced watchdog timer mechanism. This unit test uses the minimalistic library.
File size: 865 bytes
Line 
1/**
2 * \file    assert.h
3 * \author  Cesar FUGUET
4 * \date    July 30, 2014
5 * \brief   assert macro definition
6 */
7#ifndef ASSERT_H
8#define ASSERT_H
9
10#include <stdio.h>
11
12/**
13 * \param cond A boolean condition
14 *
15 * \brief assert condition
16 * \note  the assert macro may be removed at compile time with the
17 *        -DNDEBUG option
18 */
19#ifndef NDEBUG
20#define assert(expression) {\
21        if (!(expression)) {                                          \
22            printf("assertion \"%s\" failed: file \"%s\", line %d\n", \
23                #expression, __FILE__, __LINE__);                     \
24            exit();                                                   \
25        }                                                             \
26    }
27#else
28#define assert(expression)
29#endif
30
31#endif
32
33/*
34 * vim: tabstop=4 : softtabstop=4 : shiftwidth=4 : expandtab
35 */
Note: See TracBrowser for help on using the repository browser.