diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-10-06 07:39:44 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-10-10 14:00:37 +0200 |
commit | d7a48e1b259316533a5c775e27934760e1fcd313 (patch) | |
tree | ba60f54f4647a8d866395450183ef2551bf9d46d /cpukit/include/rtems/score | |
parent | grlib: Add and use irqmp_has_timestamp() (diff) | |
download | rtems-d7a48e1b259316533a5c775e27934760e1fcd313.tar.bz2 |
rtems: Improve RTEMS_NO_RETURN attribute
Provide RTEMS_NO_RETURN also in case RTEMS_DEBUG is defined to prevent errors
like this:
error: no return statement in function returning non-void [-Werror=return-type]
Use C11 and C++11 standard means to declare a no-return function.
Close #4122.
Diffstat (limited to 'cpukit/include/rtems/score')
-rw-r--r-- | cpukit/include/rtems/score/assert.h | 3 | ||||
-rw-r--r-- | cpukit/include/rtems/score/basedefs.h | 8 | ||||
-rw-r--r-- | cpukit/include/rtems/score/interr.h | 6 | ||||
-rw-r--r-- | cpukit/include/rtems/score/smpimpl.h | 4 | ||||
-rw-r--r-- | cpukit/include/rtems/score/threadimpl.h | 6 |
5 files changed, 13 insertions, 14 deletions
diff --git a/cpukit/include/rtems/score/assert.h b/cpukit/include/rtems/score/assert.h index 6c68d9d28d..649d59b7e9 100644 --- a/cpukit/include/rtems/score/assert.h +++ b/cpukit/include/rtems/score/assert.h @@ -78,9 +78,6 @@ extern "C" { #if !defined( RTEMS_SCHEDSIM ) /* normal build is newlib. */ - void __assert_func(const char *, int, const char *, const char *) - RTEMS_NO_RETURN; - #define _Assert( _e ) \ ( ( _e ) ? \ ( void ) 0 : \ diff --git a/cpukit/include/rtems/score/basedefs.h b/cpukit/include/rtems/score/basedefs.h index c31b4ebef7..0244af1471 100644 --- a/cpukit/include/rtems/score/basedefs.h +++ b/cpukit/include/rtems/score/basedefs.h @@ -94,9 +94,11 @@ * can impact the code generated following calls to * rtems_fatal_error_occurred and _Terminate. */ -#if defined(RTEMS_SCHEDSIM) - #define RTEMS_NO_RETURN -#elif defined(__GNUC__) && !defined(RTEMS_DEBUG) +#if __cplusplus >= 201103L + #define RTEMS_NO_RETURN [[noreturn]] +#elif __STDC_VERSION__ >= 201112L + #define RTEMS_NO_RETURN _Noreturn +#elif defined(__GNUC__) #define RTEMS_NO_RETURN __attribute__((__noreturn__)) #else #define RTEMS_NO_RETURN diff --git a/cpukit/include/rtems/score/interr.h b/cpukit/include/rtems/score/interr.h index 1371e55653..85767d0bc5 100644 --- a/cpukit/include/rtems/score/interr.h +++ b/cpukit/include/rtems/score/interr.h @@ -261,10 +261,10 @@ extern Internal_errors_Information _Internal_errors_What_happened; * * @see rtems_fatal() and _Internal_error(). */ -void _Terminate( +RTEMS_NO_RETURN void _Terminate( Internal_errors_Source the_source, Internal_errors_t the_error -) RTEMS_NO_RETURN; +); /** * @brief Terminates the system with an INTERNAL_ERROR_CORE fatal source and @@ -274,7 +274,7 @@ void _Terminate( * * @see _Terminate(). */ -void _Internal_error( Internal_errors_Core_list core_error ) RTEMS_NO_RETURN; +RTEMS_NO_RETURN void _Internal_error( Internal_errors_Core_list core_error ); #ifdef __cplusplus } diff --git a/cpukit/include/rtems/score/smpimpl.h b/cpukit/include/rtems/score/smpimpl.h index dbca09d5cb..1ba16fb135 100644 --- a/cpukit/include/rtems/score/smpimpl.h +++ b/cpukit/include/rtems/score/smpimpl.h @@ -124,9 +124,9 @@ extern Processor_mask _SMP_Online_processors; * * @param cpu_self The current processor control. */ -void _SMP_Start_multitasking_on_secondary_processor( +RTEMS_NO_RETURN void _SMP_Start_multitasking_on_secondary_processor( Per_CPU_Control *cpu_self -) RTEMS_NO_RETURN; +); /** * @brief Interrupts handler for inter-processor interrupts. diff --git a/cpukit/include/rtems/score/threadimpl.h b/cpukit/include/rtems/score/threadimpl.h index 61454eb7fe..a2e1e1427c 100644 --- a/cpukit/include/rtems/score/threadimpl.h +++ b/cpukit/include/rtems/score/threadimpl.h @@ -122,7 +122,7 @@ void _Thread_Create_idle(void); * part of initialization and its invocation is the last act of * the non-multitasking part of the system initialization. */ -void _Thread_Start_multitasking( void ) RTEMS_NO_RETURN; +RTEMS_NO_RETURN void _Thread_Start_multitasking( void ); /** * @brief The configuration of a new thread to initialize. @@ -259,11 +259,11 @@ bool _Thread_Start( * @param entry The start entry information for @a executing. * @param lock_context The lock context. */ -void _Thread_Restart_self( +RTEMS_NO_RETURN void _Thread_Restart_self( Thread_Control *executing, const Thread_Entry_information *entry, ISR_lock_Context *lock_context -) RTEMS_NO_RETURN; +); /** * @brief Restarts the thread. |