* Help with macro
@ 2022-11-04 12:13 Morten Brørup
0 siblings, 0 replies; only message in thread
From: Morten Brørup @ 2022-11-04 12:13 UTC (permalink / raw)
To: dev
With this macro:
#define RTE_MEMPOOL_CACHE_STAT_ADD(cache, name, n) do { \
(cache)->stats.name += n; \
} while (0)
checkpatch complained: WARNING:SINGLE_STATEMENT_DO_WHILE_MACRO: Single statement macros should not use a do {} while (0) loop
So I reluctantly changed it to this:
#define RTE_MEMPOOL_CACHE_STAT_ADD(cache, name, n) (cache)->stats.name += n
and checkpatch complained: ERROR:COMPLEX_MACRO: Macros with complex values should be enclosed in parentheses
Any suggestions for how to define this macro, without checkpatch throwing a fit?
Med venlig hilsen / Kind regards,
-Morten Brørup
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-11-04 12:13 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-04 12:13 Help with macro Morten Brørup
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).