Re: [PATCH v23] eal: RTE_PTR_ADD/SUB API improvements

Stephen Hemminger
2026-02-06T16:09:26Z

On Thu, 5 Feb 2026 20:28:14 -0800
scott.k.mitch1@gmail.com wrote:

> +static int
> +test_ptr_align_edge_cases(void)
> +{
> +/* Independent test parameters */
> +#define RTE_COMMON_TEST_PAGE_SIZE 4096
> +#define RTE_COMMON_TEST_CACHE_LINE_ALIGN RTE_CACHE_LINE_SIZE
> +/* Dependent: computed based on test requirements */
> +/* Must fit PAGE_SIZE alignment tests */
> +#define RTE_COMMON_TEST_EDGE_CASE_BUFFER_SIZE (2 * RTE_COMMON_TEST_PAGE_SIZE)
> +#define RTE_COMMON_TEST_DOUBLE_PAGE_SIZE (2 * RTE_COMMON_TEST_PAGE_SIZE)
> +/* Must be >= CACHE_LINE_ALIGN to prevent overflow in CEIL boundary test */
> +#define RTE_COMMON_TEST_BOUNDARY_TEST_OFFSET (2 * RTE_COMMON_TEST_CACHE_LINE_ALIGN)
> +

Code reads better if #define's are put outside the function.
#define's don't have scope