meh

Fork of mbed by mbed official

Committer:
ricardobtez
Date:
Tue Apr 05 23:51:21 2016 +0000
Revision:
118:16969dd821af
Parent:
86:04dd9b1680ae
Child:
103:bad568076d81
dgdgr

Who changed what in which revision?

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