replace no-return attributes

The new macro __rte_noreturn, for compiler hinting,
is now used where appropriate for consistency.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
This commit is contained in:
Thomas Monjalon 2020-02-09 21:24:18 +01:00
parent ce6427ddca
commit ddcd7640ca
19 changed files with 25 additions and 21 deletions

View File

@ -422,7 +422,7 @@ following:
.stats = (void *)&ntuple_stats
};
static __attribute__((noreturn)) void
static __rte_noreturn void
lcore_main(cls_app)
{
uint16_t port;

View File

@ -206,7 +206,7 @@ to generate hints based on recent network load trends.
.. code-block:: c
static
attribute ((noreturn)) int main_loop(__rte_unused void *dummy)
__rte_noreturn int main_loop(__rte_unused void *dummy)
{
// ...

View File

@ -1097,7 +1097,7 @@ invokes the genuine pthread function.
The function ``pthread_exit()`` has additional special handling. The standard
system header file pthread.h declares ``pthread_exit()`` with
``__attribute__((noreturn))`` this is an optimization that is possible because
``__rte_noreturn`` this is an optimization that is possible because
the pthread is terminating and this enables the compiler to omit the normal
handling of stack and protection of registers since the function is not
expected to return, and in fact the thread is being destroyed. These

View File

@ -191,7 +191,7 @@ looks like the following:
.. code-block:: c
static __attribute__((noreturn)) void
static __rte_noreturn void
lcore_main(void)
{
uint16_t port;

View File

@ -265,7 +265,7 @@ port_init(uint8_t port, struct rte_mempool *mbuf_pool)
* The lcore main. This is the main thread that does the work, reading from
* an input port classifying the packets and writing to an output port.
*/
static __attribute__((noreturn)) void
static __rte_noreturn void
lcore_main(struct flow_classifier *cls_app)
{
uint16_t port;

View File

@ -97,7 +97,7 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool)
* The lcore main. This is the main thread that does the work, reading from
* an input port and writing to an output port.
*/
static __attribute__((noreturn)) void
static __rte_noreturn void
lcore_main(void)
{
uint16_t port;

View File

@ -1877,7 +1877,7 @@ process_burst(struct rte_mbuf *pkts_burst[MAX_PKT_BURST], int nb_rx,
/*
* CPU-load stats collector
*/
static int __attribute__((noreturn))
static int __rte_noreturn
cpu_load_collector(__rte_unused void *arg) {
unsigned i, j, k;
uint64_t hits;
@ -2299,7 +2299,7 @@ sched_spawner(__rte_unused void *arg) {
}
/* main processing loop */
static int __attribute__((noreturn))
static int __rte_noreturn
pthread_tx(void *dummy)
{
struct rte_mbuf *pkts_burst[MAX_PKT_BURST];

View File

@ -55,7 +55,7 @@
* An exiting lthread must not terminate the pthread it is running in
* since this would mean terminating the lthread scheduler.
* We override pthread_exit() with a macro because it is typically declared with
* __attribute__((noreturn))
* __rte_noreturn
*/
void pthread_exit_override(void *v);

View File

@ -596,7 +596,7 @@ parse_ptp_frames(uint16_t portid, struct rte_mbuf *m) {
* The lcore main. This is the main thread that does the work, reading from an
* input port and writing to an output port.
*/
static __attribute__((noreturn)) void
static __rte_noreturn void
lcore_main(void)
{
uint16_t portid;

View File

@ -166,7 +166,7 @@ app_pkt_handle(struct rte_mbuf *pkt, uint64_t time)
}
static __attribute__((noreturn)) int
static __rte_noreturn int
main_loop(__rte_unused void *dummy)
{
uint64_t current_time, last_time = rte_rdtsc();

View File

@ -215,7 +215,7 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool)
* Main thread that does the work, reading from INPUT_PORT
* and writing to OUTPUT_PORT
*/
static __attribute__((noreturn)) void
static __rte_noreturn void
lcore_main(void)
{
uint16_t port;

View File

@ -112,7 +112,7 @@ port_init(uint16_t port, struct rte_mempool *mbuf_pool)
* The lcore main. This is the main thread that does the work, reading from
* an input port and writing to an output port.
*/
static __attribute__((noreturn)) void
static __rte_noreturn void
lcore_main(void)
{
uint16_t port;

View File

@ -55,7 +55,7 @@ timer1_cb(__rte_unused struct rte_timer *tim,
rte_timer_reset(tim, hz/3, SINGLE, lcore_id, timer1_cb, NULL);
}
static __attribute__((noreturn)) int
static __rte_noreturn int
lcore_mainloop(__rte_unused void *arg)
{
uint64_t prev_tsc = 0, cur_tsc, diff_tsc;

View File

@ -13,7 +13,7 @@
* @param arg
* opaque pointer
*/
__attribute__((noreturn)) void *eal_thread_loop(void *arg);
__rte_noreturn void *eal_thread_loop(void *arg);
/**
* Init per-lcore info for master thread

View File

@ -89,7 +89,7 @@ void eal_thread_init_master(unsigned lcore_id)
}
/* main loop of threads */
__attribute__((noreturn)) void *
__rte_noreturn void *
eal_thread_loop(__rte_unused void *arg)
{
char c;

View File

@ -182,6 +182,11 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void)
#define RTE_FINI(func) \
RTE_FINI_PRIO(func, LAST)
/**
* Hint never returning function
*/
#define __rte_noreturn __attribute__((noreturn))
/**
* Force a function to be inlined
*/
@ -826,9 +831,8 @@ rte_str_to_size(const char *str)
* printf format characters which will be expanded using any further parameters
* to the function.
*/
void
__rte_noreturn void
rte_exit(int exit_code, const char *format, ...)
__attribute__((noreturn))
__rte_format_printf(2, 3);
#ifdef __cplusplus

View File

@ -72,7 +72,7 @@ void __rte_panic(const char *funcname , const char *format, ...)
__rte_cold
#endif
#endif
__attribute__((noreturn))
__rte_noreturn
__rte_format_printf(2, 3);
#ifdef __cplusplus

View File

@ -1042,7 +1042,7 @@ eal_intr_handle_interrupts(int pfd, unsigned totalfds)
* @return
* never return;
*/
static __attribute__((noreturn)) void *
static __rte_noreturn void *
eal_intr_thread_main(__rte_unused void *arg)
{
/* host thread, never break out */

View File

@ -89,7 +89,7 @@ void eal_thread_init_master(unsigned lcore_id)
}
/* main loop of threads */
__attribute__((noreturn)) void *
__rte_noreturn void *
eal_thread_loop(__rte_unused void *arg)
{
char c;