]> git.droids-corp.org - dpdk.git/commitdiff
replace no-return attributes
authorThomas Monjalon <thomas@monjalon.net>
Sun, 9 Feb 2020 20:24:18 +0000 (21:24 +0100)
committerThomas Monjalon <thomas@monjalon.net>
Thu, 16 Apr 2020 16:30:58 +0000 (18:30 +0200)
The new macro __rte_noreturn, for compiler hinting,
is now used where appropriate for consistency.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
19 files changed:
doc/guides/sample_app_ug/flow_classify.rst
doc/guides/sample_app_ug/l3_forward_power_man.rst
doc/guides/sample_app_ug/performance_thread.rst
doc/guides/sample_app_ug/skeleton.rst
examples/flow_classify/flow_classify.c
examples/l2fwd-cat/l2fwd-cat.c
examples/performance-thread/l3fwd-thread/main.c
examples/performance-thread/pthread_shim/pthread_shim.h
examples/ptpclient/ptpclient.c
examples/qos_meter/main.c
examples/rxtx_callbacks/main.c
examples/skeleton/basicfwd.c
examples/timer/main.c
lib/librte_eal/common/eal_thread.h
lib/librte_eal/freebsd/eal_thread.c
lib/librte_eal/include/rte_common.h
lib/librte_eal/include/rte_debug.h
lib/librte_eal/linux/eal_interrupts.c
lib/librte_eal/linux/eal_thread.c

index bc234b50a7811f94a87f2bc85aede780fb4ea7ef..dc40b4d6f96cd9bffa912a43d055b2aad1ec0631 100644 (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;
index 475a866cfbcf1a058e1a83f72acb14556b3dfde2..0cc6f2e62e754cfb229cb8003592ac2a1beacc75 100644 (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)
     {
         // ...
 
index 5fed46465ff83a0cea40bb1c72db61ebed76ec37..b04d0ba444af9ab4fc6f538c3e8ed251567ac1ce 100644 (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
index 1d0a2760d40ecad3a772f4a10fdbeafab202e27d..34f6f9aea70bfd284aad2316a707a3eb03e47cb9 100644 (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;
index 1c12bbb2fd49c40858b6356b361a017628655c75..433e64d3f901be23f0bc1bbf2396a16759a5b084 100644 (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;
index 6838f288c621cf74dba83f172944285fc9e868cc..45a497c082da7c75aae8e92dd3f94ed4f89ec521 100644 (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;
index 8a1560b50311d3a6e6744454e956e19cbf9bcecb..43a5b9248ddb3a4a8265c58da2ce7bb1f25a47ca 100644 (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];
index bba8ed00e4f4fb01a5989181d79e67b2f3a847a8..e90fb15fc1382b2dd6e182031db23912c2783f76 100644 (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);
 
index 6fcd1aa26eb3669c391f5f15692df2a1e043b750..bfa86eec5a4ae43eb94696e574033cee24777ba7 100644 (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;
index 4dade4ca2f36dcf8da989f10e0d3b4b3076c8dd7..6d057abfe3e746d3ec0d594ded5d1ea895fc4a7e 100644 (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();
index 07e95e8d1a96ab3755e20a3fa8e88b33e73470ad..54d124b00bc989e6a1cd5fd9b46e17d30fece195 100644 (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;
index 73d313b84ed1da40a1c645c2954d559fb63d7fc9..72ba85fa1fe5c5bb5fe6483a1b479bd4866a5a10 100644 (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;
index 00c251c409560593f59e55d0795052be29f3254b..0259022f104e6bd6ced4a6af6dce6a99b7017fa7 100644 (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;
index 0d0bad06bd1484788112be7162eaffda85fc68d5..b40ed249edabdb4827b3c339883f5d7619190a33 100644 (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
index 925737d34dfa360c29b429ef93d14535d95cc184..f21eddd93c9b6718c1b9d89873d227a1304a86ba 100644 (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;
index 28d339a30f34b7ccb1bcc09e390c6b7cd6434bec..733447b7368b6e6f345dc9995b8db15259182207 100644 (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
index 4bcfdc0842b5bf2a3a19763f69f219513c67a40e..50052c5a9042a30928e0a6a6cc4d85f6cdf8655f 100644 (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
index cb8e10709839069ca97ea8e5580db89c25d7db7e..3893e4065ed5b5efc0c89936b2feaece70a5fd61 100644 (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 */
index 575c96089b4fad5692d789fc82a00da6ecc58575..2fa5806b882c018a8573172e6669c7f339bec5a9 100644 (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;