From: bugzilla@dpdk.org
To: dev@dpdk.org
Subject: [DPDK/core Bug 1894] Log library macros pollute the preprocessor namespace
Date: Tue, 24 Feb 2026 09:25:30 +0000 [thread overview]
Message-ID: <bug-1894-3@http.bugs.dpdk.org/> (raw)
http://bugs.dpdk.org/show_bug.cgi?id=1894
Bug ID: 1894
Summary: Log library macros pollute the preprocessor namespace
Product: DPDK
Version: unspecified
Hardware: All
OS: All
Status: UNCONFIRMED
Severity: normal
Priority: Normal
Component: core
Assignee: dev@dpdk.org
Reporter: mb@smartsharesystems.com
Target Milestone: ---
RTE_LOG macros take the severity level parameter without the RTE_LOG prefix,
e.g. RTE_LOG(DEBUG, MEMPOOL, "Something unexpected happened.");
If the application defines a macro named DEBUG, INFO, WARNING, ALERT, or any
other syslog severity name, the application cannot use the RTE_LOG macros, as
the application defined macro will be expanded.
For example:
#define DEBUG 2 /* Debug level. */
RTE_LOG(DEBUG, USER1, "Problem.");
Will first expand the DEBUG definition as:
RTE_LOG(2, USER1, "Problem.");
And then, according to the log library using:
#define RTE_LOG(l, t, ...) \
rte_log(RTE_LOG_ ## l, RTE_LOGTYPE_ ## t, # t ": " __VA_ARGS__)
expand to:
rte_log(RTE_LOG_2, RTE_LOGTYPE_USER1, "USER1: Problem.");
There is no such thing as RTE_LOG_2, so the build will fail.
Changing the RTE_LOG macro to require the full names for severity level and log
type, e.g. RTE_LOG(RTE_LOG_DEBUG, RTE_LOGTYPE_USER1, "Problem."), would fix the
namespace pollution; but it would require updating many source code files.
Backwards compatible macros could be defined in the log library header file
(rte_log.h) for applications still passing the non-prefixed names, e.g.:
#define DEBUG RTE_LOG_DEBUG
As an alternative workaround, the log library header file could define all the
shorthand (prefix stripped) names for log severity level and log type, so the
preprocessor emits a warning if the application also defines any macro with one
of those names.
E.g., in rte_log.h:
#define DEBUG DEBUG
#define USER1 USER1
For this workaround, we would also have to do something similar for the log
types defined in all libraries, e.g. in the mempool library header file:
extern int rte_mempool_logtype;
#define RTE_LOGTYPE_MEMPOOL rte_mempool_logtype
+ #define MEMPOOL MEMPOOL
#define RTE_MEMPOOL_LOG(level, ...) \
RTE_LOG_LINE(level, MEMPOOL, "" __VA_ARGS__)
--
You are receiving this mail because:
You are the assignee for the bug.
reply other threads:[~2026-02-24 9:25 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=bug-1894-3@http.bugs.dpdk.org/ \
--to=bugzilla@dpdk.org \
--cc=dev@dpdk.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.