The cache guard macro uses __COUNTER__ to generate unique names.
However, although most C compilers support __COUNTER__, it is not yet
part of the C standard, so compilation fails when building in pedantic
mode.
The macro was changed to use __LINE__ instead.
Fixes: 65f600c0f000 ("eal: add empty cache line macro")
Signed-off-by: Morten Brørup <[email protected]>
---
lib/eal/include/rte_common.h | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h
index 573bf4f2ce..97865aaa39 100644
--- a/lib/eal/include/rte_common.h
+++ b/lib/eal/include/rte_common.h
@@ -751,8 +751,12 @@ rte_is_aligned(const void * const __rte_restrict ptr,
const unsigned int align)
*
* Use as spacing between data accessed by different lcores,
* to prevent cache thrashing on hardware with speculative prefetching.
+ *
+ * Note: Although __COUNTER__ would be better for uniqueness, it is not yet
+ * (March 2026) part of the C standard, so compilation would fail when building
+ * in pedantic mode.
*/
-#define RTE_CACHE_GUARD _RTE_CACHE_GUARD_HELPER1(__COUNTER__)
+#define RTE_CACHE_GUARD _RTE_CACHE_GUARD_HELPER1(__LINE__)
/*********** PA/IOVA type definitions ********/
--
2.43.0