Skip to content

Commit daf7ef3

Browse files
committed
Import assert fix from mbed v3.
1 parent d1b902a commit daf7ef3

File tree

1 file changed

+38
-5
lines changed
  • hal/targets/hal/TARGET_NORDIC/TARGET_NRF5/sdk/libraries/util

1 file changed

+38
-5
lines changed

hal/targets/hal/TARGET_NORDIC/TARGET_NRF5/sdk/libraries/util/nrf_assert.h

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,32 @@
11
/*
2-
* Copyright (c) 2006 Nordic Semiconductor. All Rights Reserved.
2+
* Copyright (c) Nordic Semiconductor ASA
3+
* All rights reserved.
34
*
4-
* The information contained herein is confidential property of Nordic Semiconductor. The use,
5-
* copying, transfer or disclosure of such information is prohibited except by express written
6-
* agreement with Nordic Semiconductor.
5+
* Redistribution and use in source and binary forms, with or without modification,
6+
* are permitted provided that the following conditions are met:
7+
*
8+
* 1. Redistributions of source code must retain the above copyright notice, this
9+
* list of conditions and the following disclaimer.
10+
*
11+
* 2. Redistributions in binary form must reproduce the above copyright notice, this
12+
* list of conditions and the following disclaimer in the documentation and/or
13+
* other materials provided with the distribution.
14+
*
15+
* 3. Neither the name of Nordic Semiconductor ASA nor the names of other
16+
* contributors to this software may be used to endorse or promote products
17+
* derived from this software without specific prior written permission.
18+
*
19+
*
20+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
24+
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
27+
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
730
*
831
*/
932

@@ -18,6 +41,10 @@
1841
#include "nrf.h"
1942
#include "app_error.h"
2043

44+
#ifdef __cplusplus
45+
extern "C" {
46+
#endif
47+
2148
#if defined(DEBUG_NRF) || defined(DEBUG_NRF_USER)
2249

2350
/** @brief Function for handling assertions.
@@ -38,7 +65,7 @@
3865
*/
3966
void assert_nrf_callback(uint16_t line_num, const uint8_t *file_name);
4067

41-
/*lint -emacro(506, ASSERT) */ /* Suppress "Constant value Boolean */
68+
/*lint -emacro(506, ASSERT) */ /* Suppress "Constant value Boolean */
4269
/*lint -emacro(774, ASSERT) */ /* Suppress "Boolean within 'if' always evaluates to True" */ \
4370

4471
/** @brief Function for checking intended for production code.
@@ -53,8 +80,14 @@ else \
5380
assert_nrf_callback((uint16_t)__LINE__, (uint8_t *)__FILE__); \
5481
}
5582
#else
83+
#ifndef ASSERT
5684
#define ASSERT(expr) //!< Assert empty when disabled
5785
__WEAK void assert_nrf_callback(uint16_t line_num, const uint8_t *file_name);
86+
#endif
5887
#endif /* defined(DEBUG_NRF) || defined(DEBUG_NRF_USER) */
5988

89+
#ifdef __cplusplus
90+
}
91+
#endif
92+
6093
#endif /* NRF_ASSERT_H_ */

0 commit comments

Comments
 (0)