14/02/2024 17:35, Tyler Retzlaff:
> * Expand __rte_aligned(a) to __declspec(align(a)) when building
>   with MSVC.
> 
> * Move __rte_aligned from the end of {struct,union} definitions to
>   be between {struct,union} and tag.
> 
>   The placement between {struct,union} and the tag allows the desired
>   alignment to be imparted on the type regardless of the toolchain being
>   used for all of GCC, LLVM, MSVC compilers building both C and C++.
> 
> * Replace use of __rte_aligned(a) on variables/fields with alignas(a).

We miss an explanation about why __rte_aligned() and alignas() are different.
If __rte_aligned() is only for struct definitions, maybe we should have
a different name?
At least we need a Doxygen comment to guide about its usage.


[...]
>  #ifdef RTE_TOOLCHAIN_MSVC
> -#define __rte_aligned(a)
> +#define __rte_aligned(a) __declspec(align(a))
>  #else
>  #define __rte_aligned(a) __attribute__((__aligned__(a)))
>  #endif
[...]
>  /** Force alignment to cache line. */
> -#ifdef RTE_TOOLCHAIN_MSVC
> -#define __rte_cache_aligned
> -#else
>  #define __rte_cache_aligned __rte_aligned(RTE_CACHE_LINE_SIZE)
> -#endif
>  
>  /** Force minimum cache line alignment. */
>  #define __rte_cache_min_aligned __rte_aligned(RTE_CACHE_LINE_MIN_SIZE)



Reply via email to