|WARNING| pw159688 [PATCH v4 1/2] eal: RTE_PTR_ADD/SUB char* for compiler optimizations
checkpatch at dpdk.org
checkpatch at dpdk.org
Sun Jan 11 17:07:43 CET 2026
Test-Label: checkpatch
Test-Status: WARNING
http://dpdk.org/patch/159688
_coding style issues_
ERROR:COMPLEX_MACRO: Macros with complex values should be enclosed in parentheses
#338: FILE: lib/eal/include/rte_common.h:555:
+#define RTE_PTR_ADD(ptr, x) \
+ (__extension__ ({ \
+ /* Diagnostics suppressed for internal macro operations only. \
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.
WARNING:MACRO_ARG_UNUSED: Argument 'ptr' is not used in function-like macro
#338: FILE: lib/eal/include/rte_common.h:555:
+#define RTE_PTR_ADD(ptr, x) \
+ (__extension__ ({ \
+ /* Diagnostics suppressed for internal macro operations only. \
WARNING:MACRO_ARG_UNUSED: Argument 'x' is not used in function-like macro
#338: FILE: lib/eal/include/rte_common.h:555:
+#define RTE_PTR_ADD(ptr, x) \
+ (__extension__ ({ \
+ /* Diagnostics suppressed for internal macro operations only. \
WARNING:LINE_CONTINUATIONS: Avoid unnecessary line continuations
#342: FILE: lib/eal/include/rte_common.h:559:
+ * triggering warnings with no external impact. */ \
WARNING:LINE_CONTINUATIONS: Avoid unnecessary line continuations
#346: FILE: lib/eal/include/rte_common.h:563:
+ * and char* arithmetic for pointer types (enables optimization). */ \
ERROR:SPACING: spaces required around that ':' (ctx:VxW)
#351: FILE: lib/eal/include/rte_common.h:568:
+ long: ((void *)((uintptr_t)(ptr) + (x))), \
^
WARNING:INDENTED_LABEL: labels should not be indented
#351: FILE: lib/eal/include/rte_common.h:568:
+ long: ((void *)((uintptr_t)(ptr) + (x))), \
ERROR:SPACING: spaces required around that ':' (ctx:VxW)
#353: FILE: lib/eal/include/rte_common.h:570:
+ int: ((void *)((uintptr_t)(ptr) + (x))), \
^
WARNING:INDENTED_LABEL: labels should not be indented
#353: FILE: lib/eal/include/rte_common.h:570:
+ int: ((void *)((uintptr_t)(ptr) + (x))), \
ERROR:SPACING: spaces required around that ':' (ctx:VxW)
#355: FILE: lib/eal/include/rte_common.h:572:
+ short: ((void *)((uintptr_t)(ptr) + (x))), \
^
WARNING:INDENTED_LABEL: labels should not be indented
#355: FILE: lib/eal/include/rte_common.h:572:
+ short: ((void *)((uintptr_t)(ptr) + (x))), \
ERROR:SPACING: spaces required around that ':' (ctx:VxW)
#358: FILE: lib/eal/include/rte_common.h:575:
+ char: ((void *)((uintptr_t)(ptr) + (x))), \
^
WARNING:INDENTED_LABEL: labels should not be indented
#358: FILE: lib/eal/include/rte_common.h:575:
+ char: ((void *)((uintptr_t)(ptr) + (x))), \
ERROR:SPACING: spaces required around that ':' (ctx:VxW)
#359: FILE: lib/eal/include/rte_common.h:576:
+ _Bool: ((void *)((uintptr_t)(ptr) + (x))), \
^
WARNING:INDENTED_LABEL: labels should not be indented
#359: FILE: lib/eal/include/rte_common.h:576:
+ _Bool: ((void *)((uintptr_t)(ptr) + (x))), \
ERROR:SPACING: spaces required around that ':' (ctx:VxW)
#360: FILE: lib/eal/include/rte_common.h:577:
+ default: ((void *)((char *)(ptr) + (x))) \
^
ERROR:TRAILING_STATEMENTS: trailing statements should be on next line
#360: FILE: lib/eal/include/rte_common.h:577:
+ default: ((void *)((char *)(ptr) + (x))) \
ERROR:COMPLEX_MACRO: Macros with complex values should be enclosed in parentheses
#373: FILE: lib/eal/include/rte_common.h:590:
+#define RTE_PTR_SUB(ptr, x) \
+ (__extension__ ({ \
+ /* Diagnostics suppressed for internal macro operations only. \
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.
WARNING:MACRO_ARG_UNUSED: Argument 'ptr' is not used in function-like macro
#373: FILE: lib/eal/include/rte_common.h:590:
+#define RTE_PTR_SUB(ptr, x) \
+ (__extension__ ({ \
+ /* Diagnostics suppressed for internal macro operations only. \
WARNING:MACRO_ARG_UNUSED: Argument 'x' is not used in function-like macro
#373: FILE: lib/eal/include/rte_common.h:590:
+#define RTE_PTR_SUB(ptr, x) \
+ (__extension__ ({ \
+ /* Diagnostics suppressed for internal macro operations only. \
WARNING:LINE_CONTINUATIONS: Avoid unnecessary line continuations
#377: FILE: lib/eal/include/rte_common.h:594:
+ * triggering warnings with no external impact. */ \
WARNING:LINE_CONTINUATIONS: Avoid unnecessary line continuations
#381: FILE: lib/eal/include/rte_common.h:598:
+ * and char* arithmetic for pointer types (enables optimization). */ \
ERROR:SPACING: spaces required around that ':' (ctx:VxW)
#386: FILE: lib/eal/include/rte_common.h:603:
+ long: ((void *)((uintptr_t)(ptr) - (x))), \
^
WARNING:INDENTED_LABEL: labels should not be indented
#386: FILE: lib/eal/include/rte_common.h:603:
+ long: ((void *)((uintptr_t)(ptr) - (x))), \
ERROR:SPACING: spaces required around that ':' (ctx:VxW)
#388: FILE: lib/eal/include/rte_common.h:605:
+ int: ((void *)((uintptr_t)(ptr) - (x))), \
^
WARNING:INDENTED_LABEL: labels should not be indented
#388: FILE: lib/eal/include/rte_common.h:605:
+ int: ((void *)((uintptr_t)(ptr) - (x))), \
ERROR:SPACING: spaces required around that ':' (ctx:VxW)
#390: FILE: lib/eal/include/rte_common.h:607:
+ short: ((void *)((uintptr_t)(ptr) - (x))), \
^
WARNING:INDENTED_LABEL: labels should not be indented
#390: FILE: lib/eal/include/rte_common.h:607:
+ short: ((void *)((uintptr_t)(ptr) - (x))), \
ERROR:SPACING: spaces required around that ':' (ctx:VxW)
#393: FILE: lib/eal/include/rte_common.h:610:
+ char: ((void *)((uintptr_t)(ptr) - (x))), \
^
WARNING:INDENTED_LABEL: labels should not be indented
#393: FILE: lib/eal/include/rte_common.h:610:
+ char: ((void *)((uintptr_t)(ptr) - (x))), \
ERROR:SPACING: spaces required around that ':' (ctx:VxW)
#394: FILE: lib/eal/include/rte_common.h:611:
+ _Bool: ((void *)((uintptr_t)(ptr) - (x))), \
^
WARNING:INDENTED_LABEL: labels should not be indented
#394: FILE: lib/eal/include/rte_common.h:611:
+ _Bool: ((void *)((uintptr_t)(ptr) - (x))), \
ERROR:SPACING: spaces required around that ':' (ctx:VxW)
#395: FILE: lib/eal/include/rte_common.h:612:
+ default: ((void *)((char *)(ptr) - (x))) \
^
ERROR:TRAILING_STATEMENTS: trailing statements should be on next line
#395: FILE: lib/eal/include/rte_common.h:612:
+ default: ((void *)((char *)(ptr) - (x))) \
total: 16 errors, 18 warnings, 269 lines checked
More information about the test-report
mailing list