* |WARNING| pw159684 [PATCH v2 1/2] eal: RTE_PTR_ADD/SUB char* for compiler optimizations
[not found] <20260111151758.89015-2-scott.k.mitch1@gmail.com>
@ 2026-01-11 15:18 ` checkpatch
0 siblings, 0 replies; only message in thread
From: checkpatch @ 2026-01-11 15:18 UTC (permalink / raw)
To: test-report; +Cc: scott.k.mitch1
Test-Label: checkpatch
Test-Status: WARNING
http://dpdk.org/patch/159684
_coding style issues_
ERROR:COMPLEX_MACRO: Macros with complex values should be enclosed in parentheses
#339: 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
#339: 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
#339: 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
#343: FILE: lib/eal/include/rte_common.h:559:
+ * triggering warnings with no external impact. */ \
WARNING:LINE_CONTINUATIONS: Avoid unnecessary line continuations
#348: FILE: lib/eal/include/rte_common.h:564:
+ * and char* arithmetic for pointer types (enables optimization). */ \
ERROR:SPACING: spaces required around that ':' (ctx:VxW)
#353: FILE: lib/eal/include/rte_common.h:569:
+ long: ((void *)((uintptr_t)(ptr) + (x))), \
^
WARNING:INDENTED_LABEL: labels should not be indented
#353: FILE: lib/eal/include/rte_common.h:569:
+ long: ((void *)((uintptr_t)(ptr) + (x))), \
ERROR:SPACING: spaces required around that ':' (ctx:VxW)
#355: FILE: lib/eal/include/rte_common.h:571:
+ int: ((void *)((uintptr_t)(ptr) + (x))), \
^
WARNING:INDENTED_LABEL: labels should not be indented
#355: FILE: lib/eal/include/rte_common.h:571:
+ int: ((void *)((uintptr_t)(ptr) + (x))), \
ERROR:SPACING: spaces required around that ':' (ctx:VxW)
#357: FILE: lib/eal/include/rte_common.h:573:
+ short: ((void *)((uintptr_t)(ptr) + (x))), \
^
WARNING:INDENTED_LABEL: labels should not be indented
#357: FILE: lib/eal/include/rte_common.h:573:
+ short: ((void *)((uintptr_t)(ptr) + (x))), \
ERROR:SPACING: spaces required around that ':' (ctx:VxW)
#360: FILE: lib/eal/include/rte_common.h:576:
+ char: ((void *)((uintptr_t)(ptr) + (x))), \
^
WARNING:INDENTED_LABEL: labels should not be indented
#360: FILE: lib/eal/include/rte_common.h:576:
+ char: ((void *)((uintptr_t)(ptr) + (x))), \
ERROR:SPACING: spaces required around that ':' (ctx:VxW)
#361: FILE: lib/eal/include/rte_common.h:577:
+ _Bool: ((void *)((uintptr_t)(ptr) + (x))), \
^
WARNING:INDENTED_LABEL: labels should not be indented
#361: FILE: lib/eal/include/rte_common.h:577:
+ _Bool: ((void *)((uintptr_t)(ptr) + (x))), \
WARNING:LINE_CONTINUATIONS: Avoid unnecessary line continuations
#365: FILE: lib/eal/include/rte_common.h:581:
+ * const T* to const void* and T* to void*. */ \
ERROR:SPACING: spaces required around that ':' (ctx:VxW)
#366: FILE: lib/eal/include/rte_common.h:582:
+ default: _Generic((1 ? (ptr) : (void *)0), \
^
ERROR:TRAILING_STATEMENTS: trailing statements should be on next line
#366: FILE: lib/eal/include/rte_common.h:582:
+ default: _Generic((1 ? (ptr) : (void *)0), \
ERROR:SPACING: need consistent spacing around '*' (ctx:WxO)
#367: FILE: lib/eal/include/rte_common.h:583:
+ const void *: ((void *)((const char *)(ptr) + (x))), \
^
ERROR:SPACING: spaces required around that ':' (ctx:OxW)
#367: FILE: lib/eal/include/rte_common.h:583:
+ const void *: ((void *)((const char *)(ptr) + (x))), \
^
ERROR:SPACING: spaces required around that ':' (ctx:VxW)
#368: FILE: lib/eal/include/rte_common.h:584:
+ default: ((void *)((char *)(ptr) + (x))) \
^
ERROR:TRAILING_STATEMENTS: trailing statements should be on next line
#368: FILE: lib/eal/include/rte_common.h:584:
+ default: ((void *)((char *)(ptr) + (x))) \
ERROR:COMPLEX_MACRO: Macros with complex values should be enclosed in parentheses
#382: FILE: lib/eal/include/rte_common.h:598:
+#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
#382: FILE: lib/eal/include/rte_common.h:598:
+#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
#382: FILE: lib/eal/include/rte_common.h:598:
+#define RTE_PTR_SUB(ptr, x) \
+ (__extension__ ({ \
+ /* Diagnostics suppressed for internal macro operations only. \
WARNING:LINE_CONTINUATIONS: Avoid unnecessary line continuations
#386: FILE: lib/eal/include/rte_common.h:602:
+ * triggering warnings with no external impact. */ \
WARNING:LINE_CONTINUATIONS: Avoid unnecessary line continuations
#391: FILE: lib/eal/include/rte_common.h:607:
+ * and char* arithmetic for pointer types (enables optimization). */ \
ERROR:SPACING: spaces required around that ':' (ctx:VxW)
#396: FILE: lib/eal/include/rte_common.h:612:
+ long: ((void *)((uintptr_t)(ptr) - (x))), \
^
WARNING:INDENTED_LABEL: labels should not be indented
#396: FILE: lib/eal/include/rte_common.h:612:
+ long: ((void *)((uintptr_t)(ptr) - (x))), \
ERROR:SPACING: spaces required around that ':' (ctx:VxW)
#398: FILE: lib/eal/include/rte_common.h:614:
+ int: ((void *)((uintptr_t)(ptr) - (x))), \
^
WARNING:INDENTED_LABEL: labels should not be indented
#398: FILE: lib/eal/include/rte_common.h:614:
+ int: ((void *)((uintptr_t)(ptr) - (x))), \
ERROR:SPACING: spaces required around that ':' (ctx:VxW)
#400: FILE: lib/eal/include/rte_common.h:616:
+ short: ((void *)((uintptr_t)(ptr) - (x))), \
^
WARNING:INDENTED_LABEL: labels should not be indented
#400: FILE: lib/eal/include/rte_common.h:616:
+ short: ((void *)((uintptr_t)(ptr) - (x))), \
ERROR:SPACING: spaces required around that ':' (ctx:VxW)
#403: FILE: lib/eal/include/rte_common.h:619:
+ char: ((void *)((uintptr_t)(ptr) - (x))), \
^
WARNING:INDENTED_LABEL: labels should not be indented
#403: FILE: lib/eal/include/rte_common.h:619:
+ char: ((void *)((uintptr_t)(ptr) - (x))), \
ERROR:SPACING: spaces required around that ':' (ctx:VxW)
#404: FILE: lib/eal/include/rte_common.h:620:
+ _Bool: ((void *)((uintptr_t)(ptr) - (x))), \
^
WARNING:INDENTED_LABEL: labels should not be indented
#404: FILE: lib/eal/include/rte_common.h:620:
+ _Bool: ((void *)((uintptr_t)(ptr) - (x))), \
WARNING:LINE_CONTINUATIONS: Avoid unnecessary line continuations
#408: FILE: lib/eal/include/rte_common.h:624:
+ * const T* to const void* and T* to void*. */ \
ERROR:SPACING: spaces required around that ':' (ctx:VxW)
#409: FILE: lib/eal/include/rte_common.h:625:
+ default: _Generic((1 ? (ptr) : (void *)0), \
^
ERROR:TRAILING_STATEMENTS: trailing statements should be on next line
#409: FILE: lib/eal/include/rte_common.h:625:
+ default: _Generic((1 ? (ptr) : (void *)0), \
ERROR:SPACING: need consistent spacing around '*' (ctx:WxO)
#410: FILE: lib/eal/include/rte_common.h:626:
+ const void *: ((void *)((const char *)(ptr) - (x))), \
^
ERROR:SPACING: spaces required around that ':' (ctx:OxW)
#410: FILE: lib/eal/include/rte_common.h:626:
+ const void *: ((void *)((const char *)(ptr) - (x))), \
^
ERROR:SPACING: spaces required around that ':' (ctx:VxW)
#411: FILE: lib/eal/include/rte_common.h:627:
+ default: ((void *)((char *)(ptr) - (x))) \
^
ERROR:TRAILING_STATEMENTS: trailing statements should be on next line
#411: FILE: lib/eal/include/rte_common.h:627:
+ default: ((void *)((char *)(ptr) - (x))) \
total: 24 errors, 20 warnings, 285 lines checked
^ permalink raw reply [flat|nested] only message in thread