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 | |
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')
-rw-r--r-- | cpukit/include/rtems/fatal.h | 6 | ||||
-rw-r--r-- | cpukit/include/rtems/init.h | 7 | ||||
-rw-r--r-- | cpukit/include/rtems/rtems/tasks.h | 2 | ||||
-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 | ||||
-rw-r--r-- | cpukit/include/rtems/test-info.h | 2 |
9 files changed, 19 insertions, 25 deletions
diff --git a/cpukit/include/rtems/fatal.h b/cpukit/include/rtems/fatal.h index 3fc6a89a78..228e7462e0 100644 --- a/cpukit/include/rtems/fatal.h +++ b/cpukit/include/rtems/fatal.h @@ -16,7 +16,7 @@ #ifndef _RTEMS_FATAL_H #define _RTEMS_FATAL_H -#include <rtems/score/basedefs.h> /* RTEMS_NO_RETURN */ +#include <rtems/score/basedefs.h> #include <rtems/extension.h> #ifdef __cplusplus @@ -68,9 +68,7 @@ static inline void rtems_exception_frame_print( * * @see _Terminate(). */ -void rtems_fatal_error_occurred( - uint32_t the_error -) RTEMS_NO_RETURN; +RTEMS_NO_RETURN void rtems_fatal_error_occurred( uint32_t the_error ); /** * @brief Terminates the system. diff --git a/cpukit/include/rtems/init.h b/cpukit/include/rtems/init.h index 86b1408d64..552017f0de 100644 --- a/cpukit/include/rtems/init.h +++ b/cpukit/include/rtems/init.h @@ -46,8 +46,7 @@ extern "C" { * * This directive does not return. */ -void rtems_initialize_executive(void) - RTEMS_NO_RETURN; +RTEMS_NO_RETURN void rtems_initialize_executive( void ); /** * @brief Shutdown the RTEMS environment. @@ -57,9 +56,7 @@ void rtems_initialize_executive(void) * shutdown and multitasking halted. The system is terminated with a fatal * source of RTEMS_FATAL_SOURCE_EXIT and the specified result code. */ -void rtems_shutdown_executive( - uint32_t result -) RTEMS_NO_RETURN; +RTEMS_NO_RETURN void rtems_shutdown_executive( uint32_t result ); #ifdef __cplusplus } diff --git a/cpukit/include/rtems/rtems/tasks.h b/cpukit/include/rtems/rtems/tasks.h index f685c315e3..4e2e38d829 100644 --- a/cpukit/include/rtems/rtems/tasks.h +++ b/cpukit/include/rtems/rtems/tasks.h @@ -430,7 +430,7 @@ rtems_status_code rtems_task_delete( rtems_id id ); -void rtems_task_exit( void ) RTEMS_NO_RETURN; +RTEMS_NO_RETURN void rtems_task_exit( void ); /** * @brief RTEMS Task Mode 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. diff --git a/cpukit/include/rtems/test-info.h b/cpukit/include/rtems/test-info.h index d5580bdebb..c4b6041403 100644 --- a/cpukit/include/rtems/test-info.h +++ b/cpukit/include/rtems/test-info.h @@ -110,7 +110,7 @@ int rtems_test_end(const char* name); * @brief Exit the test without calling exit() since it closes stdin, etc and * pulls in stdio code */ -void rtems_test_exit(int status) RTEMS_NO_RETURN; +RTEMS_NO_RETURN void rtems_test_exit(int status); /** * @brief Prints via the RTEMS printer. |