| 1 |
/**************************************************************************/ |
| 2 |
/* */ |
| 3 |
/* This file is part of Frama-C. */ |
| 4 |
/* */ |
| 5 |
/* Copyright (C) 2007-2022 */ |
| 6 |
/* CEA (Commissariat à l'énergie atomique et aux énergies */ |
| 7 |
/* alternatives) */ |
| 8 |
/* */ |
| 9 |
/* you can redistribute it and/or modify it under the terms of the GNU */ |
| 10 |
/* Lesser General Public License as published by the Free Software */ |
| 11 |
/* Foundation, version 2.1. */ |
| 12 |
/* */ |
| 13 |
/* It is distributed in the hope that it will be useful, */ |
| 14 |
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ |
| 15 |
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ |
| 16 |
/* GNU Lesser General Public License for more details. */ |
| 17 |
/* */ |
| 18 |
/* See the GNU Lesser General Public License version 2.1 */ |
| 19 |
/* for more details (enclosed in the file licenses/LGPLv2.1). */ |
| 20 |
/* */ |
| 21 |
/**************************************************************************/ |
| 22 |
|
| 23 |
#ifndef __FC_ASSERT |
| 24 |
#define __FC_ASSERT |
| 25 |
#include "features.h" |
| 26 |
__PUSH_FC_STDLIB |
| 27 |
|
| 28 |
__BEGIN_DECLS |
| 29 |
|
| 30 |
/*@ |
| 31 |
requires nonnull_c: c != 0; |
| 32 |
terminates c != 0; |
| 33 |
assigns \nothing; |
| 34 |
*/ |
| 35 |
extern void __FC_assert(int c, const char* file, int line, const char*expr); |
| 36 |
|
| 37 |
#define static_assert _Static_assert |
| 38 |
|
| 39 |
|
| 40 |
__END_DECLS |
| 41 |
__POP_FC_STDLIB |
| 42 |
#endif |
| 43 |
|
| 44 |
#undef assert |
| 45 |
#ifdef NDEBUG |
| 46 |
#define assert(ignore) ((void)0) |
| 47 |
#else |
| 48 |
#ifndef __FRAMAC__ |
| 49 |
#define __FC_FILENAME__ __FILE__ |
| 50 |
#endif |
| 51 |
#define assert(e) (__FC_assert((e) != 0,__FC_FILENAME__,__LINE__,#e)) |
| 52 |
#endif |