mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-09-23 07:04:45 +08:00
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.
This commit is contained in:
@@ -68,7 +68,7 @@ void bsp_reset(void);
|
||||
* This style of initialization ensures that the C++ global constructors are
|
||||
* executed after RTEMS is initialized.
|
||||
*/
|
||||
void boot_card(const char *cmdline) RTEMS_NO_RETURN;
|
||||
RTEMS_NO_RETURN void boot_card(const char *cmdline);
|
||||
|
||||
struct Per_CPU_Control;
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ int qoriq_if_intercom_attach_detach(
|
||||
);
|
||||
#endif
|
||||
|
||||
void bsp_restart(void *addr) RTEMS_NO_RETURN;
|
||||
RTEMS_NO_RETURN void bsp_restart(void *addr);
|
||||
|
||||
void *bsp_idle_thread( uintptr_t ignored );
|
||||
#define BSP_IDLE_TASK_BODY bsp_idle_thread
|
||||
@@ -119,9 +119,9 @@ struct Per_CPU_Control;
|
||||
|
||||
void qoriq_start_thread(struct Per_CPU_Control *);
|
||||
|
||||
void qoriq_restart_secondary_processor(
|
||||
RTEMS_NO_RETURN void qoriq_restart_secondary_processor(
|
||||
const qoriq_start_spin_table *spin_table
|
||||
) RTEMS_NO_RETURN;
|
||||
);
|
||||
|
||||
void qoriq_initialize_exceptions(void *interrupt_stack_begin);
|
||||
|
||||
|
||||
@@ -396,7 +396,7 @@ extern unsigned int leon3_timer_prescaler;
|
||||
/* GRLIB extended IRQ controller register */
|
||||
void leon3_ext_irq_init(void);
|
||||
|
||||
void leon3_power_down_loop(void) RTEMS_NO_RETURN;
|
||||
RTEMS_NO_RETURN void leon3_power_down_loop(void);
|
||||
|
||||
static inline uint32_t leon3_get_cpu_count(
|
||||
volatile struct irqmp_regs *irqmp
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 : \
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -322,8 +322,7 @@ void _CPU_ISR_install_vector(
|
||||
*/
|
||||
void _CPU_Context_switch( Context_Control *run, Context_Control *heir );
|
||||
|
||||
void _CPU_Context_restore( Context_Control *new_context )
|
||||
RTEMS_NO_RETURN;
|
||||
RTEMS_NO_RETURN void _CPU_Context_restore( Context_Control *new_context );
|
||||
|
||||
#ifdef RTEMS_SMP
|
||||
uint32_t _CPU_SMP_Initialize( void );
|
||||
|
||||
@@ -456,12 +456,10 @@ void _CPU_ISR_install_vector(
|
||||
*/
|
||||
void _CPU_Context_switch( Context_Control *run, Context_Control *heir );
|
||||
|
||||
void _CPU_Context_restore( Context_Control *new_context )
|
||||
RTEMS_NO_RETURN;
|
||||
RTEMS_NO_RETURN void _CPU_Context_restore( Context_Control *new_context );
|
||||
|
||||
#if defined(ARM_MULTILIB_ARCH_V7M)
|
||||
void _ARMV7M_Start_multitasking( Context_Control *heir )
|
||||
RTEMS_NO_RETURN;
|
||||
RTEMS_NO_RETURN void _ARMV7M_Start_multitasking( Context_Control *heir );
|
||||
#define _CPU_Start_multitasking _ARMV7M_Start_multitasking
|
||||
#endif
|
||||
|
||||
|
||||
@@ -571,9 +571,7 @@ void _CPU_Context_switch(
|
||||
*
|
||||
* XXX document implementation including references if appropriate
|
||||
*/
|
||||
void _CPU_Context_restore(
|
||||
Context_Control *new_context
|
||||
) RTEMS_NO_RETURN;
|
||||
RTEMS_NO_RETURN void _CPU_Context_restore( Context_Control *new_context );
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
@@ -496,8 +496,7 @@ void _CPU_Context_Initialize(
|
||||
* + disable interrupts and halt the CPU
|
||||
*/
|
||||
|
||||
extern void _CPU_Fatal_halt(uint32_t source, uint32_t error)
|
||||
RTEMS_NO_RETURN;
|
||||
RTEMS_NO_RETURN void _CPU_Fatal_halt( uint32_t source, uint32_t error );
|
||||
|
||||
#endif /* ASM */
|
||||
|
||||
@@ -582,9 +581,7 @@ void _CPU_Context_switch(
|
||||
* efficient manner and avoid stack conflicts.
|
||||
*/
|
||||
|
||||
void _CPU_Context_restore(
|
||||
Context_Control *new_context
|
||||
) RTEMS_NO_RETURN;
|
||||
RTEMS_NO_RETURN void _CPU_Context_restore( Context_Control *new_context );
|
||||
|
||||
/*
|
||||
* _CPU_Context_save_fp
|
||||
|
||||
@@ -702,9 +702,7 @@ void _CPU_Context_switch(
|
||||
*
|
||||
* XXX document implementation including references if appropriate
|
||||
*/
|
||||
void _CPU_Context_restore(
|
||||
Context_Control *new_context
|
||||
) RTEMS_NO_RETURN;
|
||||
RTEMS_NO_RETURN void _CPU_Context_restore( Context_Control *new_context );
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
@@ -595,9 +595,9 @@ void _CPU_Context_switch(
|
||||
Context_Control *heir
|
||||
);
|
||||
|
||||
void _CPU_Context_Restart_self(
|
||||
RTEMS_NO_RETURN void _CPU_Context_Restart_self(
|
||||
Context_Control *the_context
|
||||
) RTEMS_NO_RETURN;
|
||||
);
|
||||
|
||||
/*
|
||||
* _CPU_Context_save_fp
|
||||
|
||||
@@ -774,9 +774,7 @@ void _CPU_Context_switch(
|
||||
* NOTE: May be unnecessary to reload some registers.
|
||||
*/
|
||||
|
||||
void _CPU_Context_restore(
|
||||
Context_Control *new_context
|
||||
) RTEMS_NO_RETURN;
|
||||
RTEMS_NO_RETURN void _CPU_Context_restore( Context_Control *new_context );
|
||||
|
||||
/*
|
||||
* _CPU_Context_save_fp
|
||||
|
||||
@@ -478,9 +478,7 @@ void _CPU_Context_switch(
|
||||
*
|
||||
* XXX
|
||||
*/
|
||||
void _CPU_Context_restore(
|
||||
Context_Control *new_context
|
||||
) RTEMS_NO_RETURN;
|
||||
RTEMS_NO_RETURN void _CPU_Context_restore( Context_Control *new_context );
|
||||
|
||||
/**
|
||||
* @brief The set of registers that specifies the complete processor state.
|
||||
|
||||
@@ -290,8 +290,7 @@ void _CPU_Context_Initialize(
|
||||
#define _CPU_Context_Restart_self( _the_context ) \
|
||||
_CPU_Context_restore( (_the_context) );
|
||||
|
||||
void _CPU_Fatal_halt( uint32_t _source, uint32_t _error )
|
||||
RTEMS_NO_RETURN;
|
||||
RTEMS_NO_RETURN void _CPU_Fatal_halt( uint32_t _source, uint32_t _error );
|
||||
|
||||
/**
|
||||
* @brief CPU initialization.
|
||||
@@ -310,9 +309,7 @@ void *_CPU_Thread_Idle_body( uintptr_t ignored );
|
||||
|
||||
void _CPU_Context_switch( Context_Control *run, Context_Control *heir );
|
||||
|
||||
void _CPU_Context_restore(
|
||||
Context_Control *new_context
|
||||
) RTEMS_NO_RETURN;
|
||||
RTEMS_NO_RETURN void _CPU_Context_restore( Context_Control *new_context );
|
||||
|
||||
void _CPU_Exception_frame_print( const CPU_Exception_frame *frame );
|
||||
|
||||
|
||||
@@ -1085,9 +1085,7 @@ void _CPU_Context_switch(
|
||||
*
|
||||
* XXX document implementation including references if appropriate
|
||||
*/
|
||||
void _CPU_Context_restore(
|
||||
Context_Control *new_context
|
||||
) RTEMS_NO_RETURN;
|
||||
RTEMS_NO_RETURN void _CPU_Context_restore( Context_Control *new_context );
|
||||
|
||||
/**
|
||||
* @addtogroup RTEMSScoreCPUExampleContext
|
||||
|
||||
@@ -527,9 +527,7 @@ void _CPU_Context_switch(
|
||||
*
|
||||
*/
|
||||
|
||||
void _CPU_Context_restore(
|
||||
Context_Control *new_context
|
||||
) RTEMS_NO_RETURN;
|
||||
RTEMS_NO_RETURN void _CPU_Context_restore( Context_Control *new_context );
|
||||
|
||||
/*
|
||||
* _CPU_Context_save_fp
|
||||
|
||||
@@ -932,9 +932,7 @@ void _CPU_Context_switch(
|
||||
* NOTE: May be unnecessary to reload some registers.
|
||||
*/
|
||||
|
||||
void _CPU_Context_restore(
|
||||
Context_Control *new_context
|
||||
) RTEMS_NO_RETURN;
|
||||
RTEMS_NO_RETURN void _CPU_Context_restore( Context_Control *new_context );
|
||||
|
||||
/*
|
||||
* _CPU_Context_save_fp
|
||||
|
||||
@@ -213,7 +213,7 @@ void _CPU_Context_Initialize(
|
||||
#define _CPU_Context_Restart_self( _the_context ) \
|
||||
_CPU_Context_restore( (_the_context) )
|
||||
|
||||
extern void _CPU_Fatal_halt(uint32_t source, uint32_t error) RTEMS_NO_RETURN;
|
||||
RTEMS_NO_RETURN void _CPU_Fatal_halt( uint32_t source, uint32_t error );
|
||||
|
||||
#define CPU_USE_GENERIC_BITFIELD_CODE TRUE
|
||||
|
||||
@@ -393,9 +393,7 @@ void _CPU_Context_switch(
|
||||
*
|
||||
*/
|
||||
|
||||
void _CPU_Context_restore(
|
||||
Context_Control *new_context
|
||||
) RTEMS_NO_RETURN;
|
||||
RTEMS_NO_RETURN void _CPU_Context_restore( Context_Control *new_context );
|
||||
|
||||
/* The following routine swaps the endian format of an unsigned int.
|
||||
* It must be static because it is referenced indirectly.
|
||||
|
||||
@@ -586,9 +586,7 @@ void _CPU_Context_switch(
|
||||
* efficient manner. It may simply be a label in _CPU_Context_switch.
|
||||
*/
|
||||
|
||||
void _CPU_Context_restore(
|
||||
Context_Control *new_context
|
||||
) RTEMS_NO_RETURN;
|
||||
RTEMS_NO_RETURN void _CPU_Context_restore( Context_Control *new_context );
|
||||
|
||||
/*
|
||||
* @brief This routine saves the floating point context passed to it.
|
||||
|
||||
@@ -912,8 +912,7 @@ void _CPU_Context_Initialize(
|
||||
* location or a register, optionally disables interrupts, and
|
||||
* halts/stops the CPU.
|
||||
*/
|
||||
extern void _CPU_Fatal_halt(uint32_t source, uint32_t error)
|
||||
RTEMS_NO_RETURN;
|
||||
RTEMS_NO_RETURN void _CPU_Fatal_halt( uint32_t source, uint32_t error );
|
||||
|
||||
/* end of Fatal Error manager macros */
|
||||
|
||||
@@ -1001,9 +1000,7 @@ void _CPU_Context_switch(
|
||||
*
|
||||
* @param[in] new_context is the context to restore
|
||||
*/
|
||||
void _CPU_Context_restore(
|
||||
Context_Control *new_context
|
||||
) RTEMS_NO_RETURN;
|
||||
RTEMS_NO_RETURN void _CPU_Context_restore( Context_Control *new_context );
|
||||
|
||||
#if defined(RTEMS_SMP)
|
||||
uint32_t _CPU_SMP_Initialize( void );
|
||||
|
||||
@@ -365,8 +365,10 @@ static inline void sparc_enable_interrupts(uint32_t psr)
|
||||
* @param[in] exitcode1 Primary exit code stored in CPU g2 register after exit
|
||||
* @param[in] exitcode2 Primary exit code stored in CPU g3 register after exit
|
||||
*/
|
||||
void sparc_syscall_exit(uint32_t exitcode1, uint32_t exitcode2)
|
||||
RTEMS_NO_RETURN;
|
||||
RTEMS_NO_RETURN void sparc_syscall_exit(
|
||||
uint32_t exitcode1,
|
||||
uint32_t exitcode2
|
||||
);
|
||||
|
||||
/**
|
||||
* @brief SPARC flash processor interrupts.
|
||||
|
||||
@@ -877,9 +877,7 @@ void _CPU_Context_switch(
|
||||
* efficient manner.
|
||||
*/
|
||||
|
||||
void _CPU_Context_restore(
|
||||
Context_Control *new_context
|
||||
) RTEMS_NO_RETURN;
|
||||
RTEMS_NO_RETURN void _CPU_Context_restore( Context_Control *new_context );
|
||||
|
||||
/*
|
||||
* _CPU_Context_save_fp
|
||||
|
||||
@@ -543,9 +543,7 @@ void _CPU_Context_switch(
|
||||
*
|
||||
* This is implemented in assembly on the v850.
|
||||
*/
|
||||
void _CPU_Context_restore(
|
||||
Context_Control *new_context
|
||||
) RTEMS_NO_RETURN;
|
||||
RTEMS_NO_RETURN void _CPU_Context_restore( Context_Control *new_context );
|
||||
|
||||
/* XXX this should be possible to remove */
|
||||
#if 0
|
||||
|
||||
@@ -280,9 +280,7 @@ void _CPU_Context_switch(
|
||||
Context_Control *heir
|
||||
);
|
||||
|
||||
void _CPU_Context_restore(
|
||||
Context_Control *new_context
|
||||
) RTEMS_NO_RETURN;
|
||||
RTEMS_NO_RETURN void _CPU_Context_restore( Context_Control *new_context );
|
||||
|
||||
typedef struct {
|
||||
uint32_t processor_state_register;
|
||||
|
||||
Reference in New Issue
Block a user