mirror of https://github.com/ARMmbed/mbed-os.git
Import assert fix from mbed v3.
parent
d1b902a46d
commit
daf7ef352d
|
@ -1,9 +1,32 @@
|
|||
/*
|
||||
* Copyright (c) 2006 Nordic Semiconductor. All Rights Reserved.
|
||||
* Copyright (c) Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* The information contained herein is confidential property of Nordic Semiconductor. The use,
|
||||
* copying, transfer or disclosure of such information is prohibited except by express written
|
||||
* agreement with Nordic Semiconductor.
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this
|
||||
* list of conditions and the following disclaimer in the documentation and/or
|
||||
* other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of Nordic Semiconductor ASA nor the names of other
|
||||
* contributors to this software may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -18,6 +41,10 @@
|
|||
#include "nrf.h"
|
||||
#include "app_error.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(DEBUG_NRF) || defined(DEBUG_NRF_USER)
|
||||
|
||||
/** @brief Function for handling assertions.
|
||||
|
@ -38,7 +65,7 @@
|
|||
*/
|
||||
void assert_nrf_callback(uint16_t line_num, const uint8_t *file_name);
|
||||
|
||||
/*lint -emacro(506, ASSERT) */ /* Suppress "Constant value Boolean */
|
||||
/*lint -emacro(506, ASSERT) */ /* Suppress "Constant value Boolean */
|
||||
/*lint -emacro(774, ASSERT) */ /* Suppress "Boolean within 'if' always evaluates to True" */ \
|
||||
|
||||
/** @brief Function for checking intended for production code.
|
||||
|
@ -53,8 +80,14 @@ else \
|
|||
assert_nrf_callback((uint16_t)__LINE__, (uint8_t *)__FILE__); \
|
||||
}
|
||||
#else
|
||||
#ifndef ASSERT
|
||||
#define ASSERT(expr) //!< Assert empty when disabled
|
||||
__WEAK void assert_nrf_callback(uint16_t line_num, const uint8_t *file_name);
|
||||
#endif
|
||||
#endif /* defined(DEBUG_NRF) || defined(DEBUG_NRF_USER) */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* NRF_ASSERT_H_ */
|
||||
|
|
Loading…
Reference in New Issue