Pinned to some recent date
platform/mbed_assert.h@0:fb7af294d5d9, 2016-11-17 (annotated)
- Committer:
- Simon Cooksey
- Date:
- Thu Nov 17 16:43:53 2016 +0000
- Revision:
- 0:fb7af294d5d9
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Simon Cooksey |
0:fb7af294d5d9 | 1 | |
Simon Cooksey |
0:fb7af294d5d9 | 2 | /** \addtogroup platform */ |
Simon Cooksey |
0:fb7af294d5d9 | 3 | /** @{*/ |
Simon Cooksey |
0:fb7af294d5d9 | 4 | /* mbed Microcontroller Library |
Simon Cooksey |
0:fb7af294d5d9 | 5 | * Copyright (c) 2006-2013 ARM Limited |
Simon Cooksey |
0:fb7af294d5d9 | 6 | * |
Simon Cooksey |
0:fb7af294d5d9 | 7 | * Licensed under the Apache License, Version 2.0 (the "License"); |
Simon Cooksey |
0:fb7af294d5d9 | 8 | * you may not use this file except in compliance with the License. |
Simon Cooksey |
0:fb7af294d5d9 | 9 | * You may obtain a copy of the License at |
Simon Cooksey |
0:fb7af294d5d9 | 10 | * |
Simon Cooksey |
0:fb7af294d5d9 | 11 | * http://www.apache.org/licenses/LICENSE-2.0 |
Simon Cooksey |
0:fb7af294d5d9 | 12 | * |
Simon Cooksey |
0:fb7af294d5d9 | 13 | * Unless required by applicable law or agreed to in writing, software |
Simon Cooksey |
0:fb7af294d5d9 | 14 | * distributed under the License is distributed on an "AS IS" BASIS, |
Simon Cooksey |
0:fb7af294d5d9 | 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
Simon Cooksey |
0:fb7af294d5d9 | 16 | * See the License for the specific language governing permissions and |
Simon Cooksey |
0:fb7af294d5d9 | 17 | * limitations under the License. |
Simon Cooksey |
0:fb7af294d5d9 | 18 | */ |
Simon Cooksey |
0:fb7af294d5d9 | 19 | #ifndef MBED_ASSERT_H |
Simon Cooksey |
0:fb7af294d5d9 | 20 | #define MBED_ASSERT_H |
Simon Cooksey |
0:fb7af294d5d9 | 21 | |
Simon Cooksey |
0:fb7af294d5d9 | 22 | #ifdef __cplusplus |
Simon Cooksey |
0:fb7af294d5d9 | 23 | extern "C" { |
Simon Cooksey |
0:fb7af294d5d9 | 24 | #endif |
Simon Cooksey |
0:fb7af294d5d9 | 25 | |
Simon Cooksey |
0:fb7af294d5d9 | 26 | /** Internal mbed assert function which is invoked when MBED_ASSERT macro failes. |
Simon Cooksey |
0:fb7af294d5d9 | 27 | * This function is active only if NDEBUG is not defined prior to including this |
Simon Cooksey |
0:fb7af294d5d9 | 28 | * assert header file. |
Simon Cooksey |
0:fb7af294d5d9 | 29 | * In case of MBED_ASSERT failing condition, error() is called with the assertation message. |
Simon Cooksey |
0:fb7af294d5d9 | 30 | * @param expr Expresion to be checked. |
Simon Cooksey |
0:fb7af294d5d9 | 31 | * @param file File where assertation failed. |
Simon Cooksey |
0:fb7af294d5d9 | 32 | * @param line Failing assertation line number. |
Simon Cooksey |
0:fb7af294d5d9 | 33 | */ |
Simon Cooksey |
0:fb7af294d5d9 | 34 | void mbed_assert_internal(const char *expr, const char *file, int line); |
Simon Cooksey |
0:fb7af294d5d9 | 35 | |
Simon Cooksey |
0:fb7af294d5d9 | 36 | #ifdef __cplusplus |
Simon Cooksey |
0:fb7af294d5d9 | 37 | } |
Simon Cooksey |
0:fb7af294d5d9 | 38 | #endif |
Simon Cooksey |
0:fb7af294d5d9 | 39 | |
Simon Cooksey |
0:fb7af294d5d9 | 40 | #ifdef NDEBUG |
Simon Cooksey |
0:fb7af294d5d9 | 41 | #define MBED_ASSERT(expr) ((void)0) |
Simon Cooksey |
0:fb7af294d5d9 | 42 | |
Simon Cooksey |
0:fb7af294d5d9 | 43 | #else |
Simon Cooksey |
0:fb7af294d5d9 | 44 | #define MBED_ASSERT(expr) \ |
Simon Cooksey |
0:fb7af294d5d9 | 45 | do { \ |
Simon Cooksey |
0:fb7af294d5d9 | 46 | if (!(expr)) { \ |
Simon Cooksey |
0:fb7af294d5d9 | 47 | mbed_assert_internal(#expr, __FILE__, __LINE__); \ |
Simon Cooksey |
0:fb7af294d5d9 | 48 | } \ |
Simon Cooksey |
0:fb7af294d5d9 | 49 | } while (0) |
Simon Cooksey |
0:fb7af294d5d9 | 50 | #endif |
Simon Cooksey |
0:fb7af294d5d9 | 51 | |
Simon Cooksey |
0:fb7af294d5d9 | 52 | #endif |
Simon Cooksey |
0:fb7af294d5d9 | 53 | |
Simon Cooksey |
0:fb7af294d5d9 | 54 | /** @}*/ |