public inbox for dev@dpdk.org
 help / color / mirror / Atom feed
* [PATCH] eal: fix cache guard for pedantic compilation
@ 2026-03-23  8:12 Morten Brørup
  2026-03-23  8:14 ` Morten Brørup
  2026-03-25 14:40 ` Thomas Monjalon
  0 siblings, 2 replies; 3+ messages in thread
From: Morten Brørup @ 2026-03-23  8:12 UTC (permalink / raw)
  To: dev, Jerin Jacob, Bruce Richardson, Thomas Monjalon,
	David Marchand, Robin Jarry, Stephen Hemminger
  Cc: Mattias Rönnblom, Morten Brørup

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 <mb@smartsharesystems.com>
---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH] eal: fix cache guard for pedantic compilation
  2026-03-23  8:12 [PATCH] eal: fix cache guard for pedantic compilation Morten Brørup
@ 2026-03-23  8:14 ` Morten Brørup
  2026-03-25 14:40 ` Thomas Monjalon
  1 sibling, 0 replies; 3+ messages in thread
From: Morten Brørup @ 2026-03-23  8:14 UTC (permalink / raw)
  To: stable; +Cc: dev

Forgot cc stable.

> From: Morten Brørup [mailto:mb@smartsharesystems.com]
> Sent: Monday, 23 March 2026 09.12
> 
> 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 <mb@smartsharesystems.com>
> ---
>  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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] eal: fix cache guard for pedantic compilation
  2026-03-23  8:12 [PATCH] eal: fix cache guard for pedantic compilation Morten Brørup
  2026-03-23  8:14 ` Morten Brørup
@ 2026-03-25 14:40 ` Thomas Monjalon
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2026-03-25 14:40 UTC (permalink / raw)
  To: Morten Brørup
  Cc: dev, Jerin Jacob, Bruce Richardson, David Marchand, Robin Jarry,
	Stephen Hemminger, Mattias Rönnblom

23/03/2026 09:12, Morten Brørup:
> 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 <mb@smartsharesystems.com>

Applied, thanks.




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-03-25 14:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-23  8:12 [PATCH] eal: fix cache guard for pedantic compilation Morten Brørup
2026-03-23  8:14 ` Morten Brørup
2026-03-25 14:40 ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox