From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org
Cc: thomas@monjalon.net, bruce.richardson@intel.com,
anatoly.burakov@intel.com
Subject: [PATCH v2 2/3] eal: simplify internal/experimental tags definitions
Date: Thu, 15 Oct 2026 13:29:15 +0200 [thread overview]
Message-ID: <20261015112916.2622825-2-david.marchand@redhat.com> (raw)
In-Reply-To: <20261015112916.2622825-1-david.marchand@redhat.com>
The tags definitions have become hard to read after adding support for
various compilers.
Let's reorder the definitions:
- put MSVC first, as it offers neither the section attribute nor helps
with detecting wrong use of symbols,
- then for each tag
- start with error/diagnostic tweaks for the respective !ALLOW cases,
- if no tweak is available, and for the ALLOW cases, fallback to
moving the symbol to a section,
Signed-off-by: David Marchand <david.marchand@redhat.com>
---
lib/eal/include/rte_compat.h | 39 +++++++++++++++---------------------
1 file changed, 16 insertions(+), 23 deletions(-)
diff --git a/lib/eal/include/rte_compat.h b/lib/eal/include/rte_compat.h
index 97c1540bd0..cb7836a190 100644
--- a/lib/eal/include/rte_compat.h
+++ b/lib/eal/include/rte_compat.h
@@ -6,64 +6,57 @@
#ifndef _RTE_COMPAT_H_
#define _RTE_COMPAT_H_
-#ifndef ALLOW_EXPERIMENTAL_API
-
#ifdef RTE_TOOLCHAIN_MSVC
+
#define __rte_experimental
-#else
+#define __rte_internal
+
+#else /* !RTE_TOOLCHAIN_MSVC */
+
+#ifndef ALLOW_EXPERIMENTAL_API
+
#define __rte_experimental \
__attribute__((deprecated("Symbol is not yet part of stable ABI"), \
section(".text.experimental")))
-#endif
-#else
+#endif /* !ALLOW_EXPERIMENTAL_API */
-#ifdef RTE_TOOLCHAIN_MSVC
-#define __rte_experimental
-#else
+#ifndef __rte_experimental
#define __rte_experimental \
__attribute__((section(".text.experimental")))
#endif
-#endif
+#ifndef ALLOW_INTERNAL_API
#ifndef __has_attribute
/* if no has_attribute assume no support for attribute too */
#define __has_attribute(x) 0
#endif
-#if !defined ALLOW_INTERNAL_API && __has_attribute(error) /* For GCC */
+#if __has_attribute(error) /* For GCC */
-#ifdef RTE_TOOLCHAIN_MSVC
-#define __rte_internal
-#else
#define __rte_internal \
__attribute__((error("Symbol is not public ABI"), \
section(".text.internal")))
-#endif
-#elif !defined ALLOW_INTERNAL_API && __has_attribute(diagnose_if) /* For clang */
+#elif __has_attribute(diagnose_if) /* For clang */
-#ifdef RTE_TOOLCHAIN_MSVC
-#define __rte_internal
-#else
#define __rte_internal \
_Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Wgcc-compat\"") \
__attribute__((diagnose_if(1, "Symbol is not public ABI", "error"), \
section(".text.internal"))) \
_Pragma("GCC diagnostic pop")
+
#endif
-#else
+#endif /* !ALLOW_INTERNAL_API */
-#ifdef RTE_TOOLCHAIN_MSVC
-#define __rte_internal
-#else
+#ifndef __rte_internal
#define __rte_internal \
__attribute__((section(".text.internal")))
#endif
-#endif
+#endif /* !RTE_TOOLCHAIN_MSVC */
#endif /* _RTE_COMPAT_H_ */
--
2.54.0
next prev parent reply other threads:[~2026-10-15 11:29 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-14 20:16 [PATCH] eal: enforce internal API check with Clang Thomas Monjalon
2026-10-15 8:54 ` Burakov, Anatoly
2026-10-15 10:57 ` David Marchand
2026-10-15 11:29 ` [PATCH v2 1/3] buildtools/chkincs: relax checks on driver headers David Marchand
2026-10-15 11:29 ` David Marchand [this message]
2026-10-15 11:29 ` [PATCH v2 3/3] eal: enforce internal API check with Clang 14 David Marchand
2026-10-15 11:31 ` Burakov, Anatoly
2026-10-15 11:38 ` David Marchand
2026-10-15 11:40 ` David Marchand
2026-10-20 14:59 ` 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=20261015112916.2622825-2-david.marchand@redhat.com \
--to=david.marchand@redhat.com \
--cc=anatoly.burakov@intel.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=thomas@monjalon.net \
/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