DPDK patches and discussions
 help / color / mirror / Atom feed
From: Tyler Retzlaff <roretzla@linux.microsoft.com>
To: dev@dpdk.org
Cc: Kai Ji <kai.ji@intel.com>,
	Pablo de Lara <pablo.de.lara.guarch@intel.com>,
	bruce.richardson@intel.com, david.marchand@redhat.com,
	Tyler Retzlaff <roretzla@linux.microsoft.com>
Subject: [PATCH v3 3/3] eal: remove typeof from per lcore macros
Date: Tue, 13 Feb 2024 11:12:03 -0800	[thread overview]
Message-ID: <1707851523-27998-4-git-send-email-roretzla@linux.microsoft.com> (raw)
In-Reply-To: <1707851523-27998-1-git-send-email-roretzla@linux.microsoft.com>

The design of the macros requires a type to be provided to the macro.

By expanding the type parameter inside of typeof it also inadvertently
allows an expression to be used which appears not to have been intended
after evaluating the parameter name and existing macro use.

Technically this is an API break but only for applications that were
using these macros outside of the original design intent.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
---
 doc/guides/rel_notes/release_24_03.rst | 5 +++++
 lib/eal/include/rte_per_lcore.h        | 8 ++++----
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/doc/guides/rel_notes/release_24_03.rst b/doc/guides/rel_notes/release_24_03.rst
index 6741947..39088da 100644
--- a/doc/guides/rel_notes/release_24_03.rst
+++ b/doc/guides/rel_notes/release_24_03.rst
@@ -89,6 +89,11 @@ API Changes
    Also, make sure to start the actual text at the margin.
    =======================================================
 
+* eal: Removed ``typeof(type)`` from the expansion of ``RTE_DEFINE_PER_LCORE``
+  and ``RTE_DECLARE_PER_LCORE`` macros aligning them with their intended design.
+  If use with an expression is desired applications can adapt by supplying
+  ``typeof(e)`` as an argument.
+
 * gso: ``rte_gso_segment`` now returns -ENOTSUP for unknown protocols.
 
 
diff --git a/lib/eal/include/rte_per_lcore.h b/lib/eal/include/rte_per_lcore.h
index 41fe1f0..529995e 100644
--- a/lib/eal/include/rte_per_lcore.h
+++ b/lib/eal/include/rte_per_lcore.h
@@ -24,10 +24,10 @@
 
 #ifdef RTE_TOOLCHAIN_MSVC
 #define RTE_DEFINE_PER_LCORE(type, name)			\
-	__declspec(thread) typeof(type) per_lcore_##name
+	__declspec(thread) type per_lcore_##name
 
 #define RTE_DECLARE_PER_LCORE(type, name)			\
-	extern __declspec(thread) typeof(type) per_lcore_##name
+	extern __declspec(thread) type per_lcore_##name
 #else
 /**
  * Macro to define a per lcore variable "var" of type "type", don't
@@ -35,13 +35,13 @@
  * whole macro.
  */
 #define RTE_DEFINE_PER_LCORE(type, name)			\
-	__thread __typeof__(type) per_lcore_##name
+	__thread type per_lcore_##name
 
 /**
  * Macro to declare an extern per lcore variable "var" of type "type"
  */
 #define RTE_DECLARE_PER_LCORE(type, name)			\
-	extern __thread __typeof__(type) per_lcore_##name
+	extern __thread type per_lcore_##name
 #endif
 
 /**
-- 
1.8.3.1


  parent reply	other threads:[~2024-02-13 19:12 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-19 17:27 [PATCH 0/2] remove __typeof__ from expansion of " Tyler Retzlaff
2023-12-19 17:27 ` [PATCH 1/2] eal: provide type instead of expression to per lcore macro Tyler Retzlaff
2023-12-19 17:27 ` [PATCH 2/2] eal: remove typeof from per lcore macros Tyler Retzlaff
2023-12-19 17:36 ` [PATCH 0/2] remove __typeof__ from expansion of " Bruce Richardson
2024-01-02 23:44 ` [PATCH v2 0/3] " Tyler Retzlaff
2024-01-02 23:45   ` [PATCH v2 1/3] eal: provide type to per lcore macro Tyler Retzlaff
2024-01-02 23:45   ` [PATCH v2 2/3] crypto/ipsec_mb: " Tyler Retzlaff
2024-01-02 23:45   ` [PATCH v2 3/3] eal: remove typeof from per lcore macros Tyler Retzlaff
2024-01-08 10:45   ` [PATCH v2 0/3] remove __typeof__ from expansion of " Bruce Richardson
2024-02-13 11:12 ` [PATCH 0/2] " David Marchand
2024-02-13 19:12 ` [PATCH v3 0/3] " Tyler Retzlaff
2024-02-13 19:12   ` [PATCH v3 1/3] eal: provide type to per lcore macro Tyler Retzlaff
2024-02-13 19:12   ` [PATCH v3 2/3] crypto/ipsec_mb: " Tyler Retzlaff
2024-02-13 19:12   ` Tyler Retzlaff [this message]
2024-02-13 19:32     ` [PATCH v3 3/3] eal: remove typeof from per lcore macros Morten Brørup
2024-02-14  8:19   ` [PATCH v3 0/3] remove __typeof__ from expansion of " David Marchand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1707851523-27998-4-git-send-email-roretzla@linux.microsoft.com \
    --to=roretzla@linux.microsoft.com \
    --cc=bruce.richardson@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=kai.ji@intel.com \
    --cc=pablo.de.lara.guarch@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).