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