Skip to content

Commit 8e167c6

Browse files
committed
more example for macro expansion
1 parent 0d4610b commit 8e167c6

File tree

1 file changed

+41
-1
lines changed

1 file changed

+41
-1
lines changed

tests/headers/attributes.hpp

+41-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#include <stdint.h>
2+
#include <stddef.h>
3+
14
int x __attribute__ ((aligned (16))) = 0;
25

36
struct foo { int x[2] __attribute__ ((unused, aligned (8), deprecated)); };
@@ -17,4 +20,41 @@ extern int
1720
my_printf (void *my_object, const char *my_format, ...)
1821
__attribute__ ((format (printf, 2, 3)));
1922

20-
void fatal () __attribute__ ((noreturn));
23+
void fatal () __attribute__ ((noreturn));
24+
25+
/**
26+
* Force alignment
27+
*/
28+
#define __rte_aligned(a) __attribute__((__aligned__(a)))
29+
30+
/**
31+
* Force a structure to be packed
32+
*/
33+
#define __rte_packed __attribute__((__packed__))
34+
35+
#define RTE_CACHE_LINE_SIZE 64 /**< Minimum Cache line size. */
36+
37+
/**
38+
* Force alignment to cache line.
39+
*/
40+
#define __rte_cache_aligned __rte_aligned(RTE_CACHE_LINE_SIZE)
41+
42+
/**
43+
* The generic rte_mbuf, containing a packet mbuf.
44+
*/
45+
struct rte_mbuf {
46+
/** Timesync flags for use with IEEE1588. */
47+
uint16_t timesync;
48+
} __rte_cache_aligned;
49+
50+
/**
51+
* Physical memory segment descriptor.
52+
*/
53+
struct rte_memseg {
54+
uint32_t nchannel; /**< Number of channels. */
55+
uint32_t nrank; /**< Number of ranks. */
56+
} __rte_packed;
57+
58+
struct align {
59+
int foo;
60+
} __attribute__((aligned(2 * sizeof(long long))));

0 commit comments

Comments
 (0)