replace hot attributes
[dpdk.git] / lib / librte_eal / include / rte_common.h
index f820c2e..0c002b4 100644 (file)
@@ -64,9 +64,9 @@ extern "C" {
 #endif
 
 #ifdef RTE_ARCH_STRICT_ALIGN
-typedef uint64_t unaligned_uint64_t __attribute__ ((aligned(1)));
-typedef uint32_t unaligned_uint32_t __attribute__ ((aligned(1)));
-typedef uint16_t unaligned_uint16_t __attribute__ ((aligned(1)));
+typedef uint64_t unaligned_uint64_t __rte_aligned(1);
+typedef uint32_t unaligned_uint32_t __rte_aligned(1);
+typedef uint16_t unaligned_uint16_t __rte_aligned(1);
 #else
 typedef uint64_t unaligned_uint64_t;
 typedef uint32_t unaligned_uint32_t;
@@ -91,6 +91,11 @@ typedef uint16_t unaligned_uint16_t;
  */
 #define __rte_weak __attribute__((__weak__))
 
+/**
+ * Force symbol to be generated even if it appears to be unused.
+ */
+#define __rte_used __attribute__((used))
+
 /*********** Macros to eliminate unused variable warnings ********/
 
 /**
@@ -185,7 +190,12 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void)
 /**
  * Force a function to be noinlined
  */
-#define __rte_noinline  __attribute__((noinline))
+#define __rte_noinline __attribute__((noinline))
+
+/**
+ * Hint function in the hot path
+ */
+#define __rte_hot __attribute__((hot))
 
 /*********** Macros for pointer arithmetic ********/
 
@@ -717,7 +727,7 @@ rte_log2_u64(uint64_t v)
 #ifndef container_of
 #define container_of(ptr, type, member)        __extension__ ({                \
                        const typeof(((type *)0)->member) *_ptr = (ptr); \
-                       __attribute__((unused)) type *_target_ptr =     \
+                       __rte_unused type *_target_ptr =        \
                                (type *)(ptr);                          \
                        (type *)(((uintptr_t)_ptr) - offsetof(type, member)); \
                })