Skip to content

Commit 4097ab7

Browse files
IAR: try with attribute((__noreturn__)) first (#284)
Fixes #279 Fixes #198
1 parent 38181ea commit 4097ab7

3 files changed

Lines changed: 7 additions & 3 deletions

File tree

CMSIS/Core/Include/cmsis_iccarm.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@
5555
#endif
5656

5757
#ifndef __NO_RETURN
58-
#if defined(__cplusplus) && __cplusplus >= 201103L
58+
#if defined(__has_attribute) && __has_attribute(__noreturn__)
59+
#define __NO_RETURN __attribute__((__noreturn__))
60+
#elif defined(__cplusplus) && __cplusplus >= 201103L
5961
#define __NO_RETURN [[noreturn]]
6062
#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
6163
#define __NO_RETURN _Noreturn

CMSIS/Documentation/Doxygen/Core/src/ref_compiler_ctrl.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,8 @@ __STATIC_FORCEINLINE uint32_t NVIC_GetVector(IRQn_Type IRQn)
169169
\brief Inform the compiler that a function does not return.
170170
\details
171171
Informs the compiler that the function does not return. The compiler can then perform optimizations by
172-
removing code that is never reached.
172+
removing code that is never reached. For maximum portability, this should only be used where the C/C++
173+
standard allows it.
173174

174175
<b>Code Example:</b>
175176
\code

CMSIS/Documentation/Doxygen/Core_A/src/ref_compiler_ctrl.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ __STATIC_FORCEINLINE uint32_t NVIC_GetVector(IRQn_Type IRQn)
107107
\brief Inform the compiler that a function does not return.
108108
\details
109109
Informs the compiler that the function does not return. The compiler can then perform optimizations by
110-
removing code that is never reached.
110+
removing code that is never reached. For maximum portability, this should only be used where the C/C++
111+
standard allows it.
111112

112113
<b> Code Example:</b>
113114
\code

0 commit comments

Comments
 (0)