|WARNING| pw163437 [RFC PATCH 40/44] eal_cfg: add basic setters and getters

checkpatch at dpdk.org checkpatch at dpdk.org
Wed Apr 29 19:05:22 CEST 2026


Test-Label: checkpatch
Test-Status: WARNING
http://dpdk.org/patch/163437

_coding style issues_


WARNING:LONG_LINE: line length of 106 exceeds 100 columns
#300: FILE: app/test/test_eal_cfg.c:320:
+	TEST_ASSERT(rte_eal_cfg_set_iova_mode(cfg, (enum rte_iova_mode)(RTE_IOVA_PA | RTE_IOVA_VA)) == -1,

WARNING:MACRO_WITH_FLOW_CONTROL: Macros with flow control statements should be avoided
#533: FILE: lib/eal_cfg/eal_cfg.c:34:
+#define CFG_REQUIRE_NOT_NULL(cfg) do {				\
+	if ((cfg) == NULL) {					\
+		EAL_CFG_LOG(ERR, "%s: cfg is NULL", __func__);  \
+		rte_errno = EINVAL;				\
+		return -1;					\
+	}							\
+} while (0)

ERROR:COMPLEX_MACRO: Macros with complex values should be enclosed in parentheses
#545: FILE: lib/eal_cfg/eal_cfg.c:46:
+#define EAL_CFG_GETTER(type, name, null_val)				\
+type									\
+rte_eal_cfg_get_##name(const struct rte_eal_cfg *cfg)			\
+{									\
+	if (cfg == NULL)						\
+		return (null_val);					\
+	return cfg->user_cfg.name;					\
+}

BUT SEE:

   do {} while (0) advice is over-stated in a few situations:

   The more obvious case is macros, like MODULE_PARM_DESC, invoked at
   file-scope, where C disallows code (it must be in functions).  See
   $exceptions if you have one to add by name.

   More troublesome is declarative macros used at top of new scope,
   like DECLARE_PER_CPU.  These might just compile with a do-while-0
   wrapper, but would be incorrect.  Most of these are handled by
   detecting struct,union,etc declaration primitives in $exceptions.

   Theres also macros called inside an if (block), which "return" an
   expression.  These cannot do-while, and need a ({}) wrapper.

   Enjoy this qualification while we work to improve our heuristics.

ERROR:TRAILING_STATEMENTS: trailing statements should be on next line
#565: FILE: lib/eal_cfg/eal_cfg.c:66:
+	if (cfg == NULL) return false;						\

WARNING:BLOCK_COMMENT_STYLE: Block comments use a trailing */ on a separate line
#735: FILE: lib/eal_cfg/eal_cfg.c:264:
+ * semantics. */

total: 2 errors, 3 warnings, 1123 lines checked


More information about the test-report mailing list