|WARNING| pw159686 [PATCH v3 v3 1/2] eal: RTE_PTR_ADD/SUB char* for compiler optimizations

checkpatch at dpdk.org checkpatch at dpdk.org
Sun Jan 11 17:02:29 CET 2026


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

_coding style issues_


ERROR:COMPLEX_MACRO: Macros with complex values should be enclosed in parentheses
#340: 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
#340: 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
#340: 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
#344: 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:563:
+		 * and char* arithmetic for pointer types (enables optimization). */ \

ERROR:SPACING: spaces required around that ':' (ctx:VxW)
#353: FILE: lib/eal/include/rte_common.h:568:
+			long:               ((void *)((uintptr_t)(ptr) + (x))), \
 			    ^

WARNING:INDENTED_LABEL: labels should not be indented
#353: FILE: lib/eal/include/rte_common.h:568:
+			long:               ((void *)((uintptr_t)(ptr) + (x))), \

ERROR:SPACING: spaces required around that ':' (ctx:VxW)
#355: FILE: lib/eal/include/rte_common.h:570:
+			int:                ((void *)((uintptr_t)(ptr) + (x))), \
 			   ^

WARNING:INDENTED_LABEL: labels should not be indented
#355: FILE: lib/eal/include/rte_common.h:570:
+			int:                ((void *)((uintptr_t)(ptr) + (x))), \

ERROR:SPACING: spaces required around that ':' (ctx:VxW)
#357: FILE: lib/eal/include/rte_common.h:572:
+			short:              ((void *)((uintptr_t)(ptr) + (x))), \
 			     ^

WARNING:INDENTED_LABEL: labels should not be indented
#357: FILE: lib/eal/include/rte_common.h:572:
+			short:              ((void *)((uintptr_t)(ptr) + (x))), \

ERROR:SPACING: spaces required around that ':' (ctx:VxW)
#360: FILE: lib/eal/include/rte_common.h:575:
+			char:               ((void *)((uintptr_t)(ptr) + (x))), \
 			    ^

WARNING:INDENTED_LABEL: labels should not be indented
#360: FILE: lib/eal/include/rte_common.h:575:
+			char:               ((void *)((uintptr_t)(ptr) + (x))), \

ERROR:SPACING: spaces required around that ':' (ctx:VxW)
#361: FILE: lib/eal/include/rte_common.h:576:
+			_Bool:              ((void *)((uintptr_t)(ptr) + (x))), \
 			     ^

WARNING:INDENTED_LABEL: labels should not be indented
#361: FILE: lib/eal/include/rte_common.h:576:
+			_Bool:              ((void *)((uintptr_t)(ptr) + (x))), \

ERROR:SPACING: spaces required around that ':' (ctx:VxW)
#362: FILE: lib/eal/include/rte_common.h:577:
+			default:            ((void *)((char *)(ptr) + (x))) \
 			       ^

ERROR:TRAILING_STATEMENTS: trailing statements should be on next line
#362: 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
#375: 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
#375: 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
#375: 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
#379: FILE: lib/eal/include/rte_common.h:594:
+		 * triggering warnings with no external impact. */ \

WARNING:LINE_CONTINUATIONS: Avoid unnecessary line continuations
#383: FILE: lib/eal/include/rte_common.h:598:
+		 * and char* arithmetic for pointer types (enables optimization). */ \

ERROR:SPACING: spaces required around that ':' (ctx:VxW)
#388: FILE: lib/eal/include/rte_common.h:603:
+			long:               ((void *)((uintptr_t)(ptr) - (x))), \
 			    ^

WARNING:INDENTED_LABEL: labels should not be indented
#388: FILE: lib/eal/include/rte_common.h:603:
+			long:               ((void *)((uintptr_t)(ptr) - (x))), \

ERROR:SPACING: spaces required around that ':' (ctx:VxW)
#390: FILE: lib/eal/include/rte_common.h:605:
+			int:                ((void *)((uintptr_t)(ptr) - (x))), \
 			   ^

WARNING:INDENTED_LABEL: labels should not be indented
#390: FILE: lib/eal/include/rte_common.h:605:
+			int:                ((void *)((uintptr_t)(ptr) - (x))), \

ERROR:SPACING: spaces required around that ':' (ctx:VxW)
#392: FILE: lib/eal/include/rte_common.h:607:
+			short:              ((void *)((uintptr_t)(ptr) - (x))), \
 			     ^

WARNING:INDENTED_LABEL: labels should not be indented
#392: FILE: lib/eal/include/rte_common.h:607:
+			short:              ((void *)((uintptr_t)(ptr) - (x))), \

ERROR:SPACING: spaces required around that ':' (ctx:VxW)
#395: FILE: lib/eal/include/rte_common.h:610:
+			char:               ((void *)((uintptr_t)(ptr) - (x))), \
 			    ^

WARNING:INDENTED_LABEL: labels should not be indented
#395: FILE: lib/eal/include/rte_common.h:610:
+			char:               ((void *)((uintptr_t)(ptr) - (x))), \

ERROR:SPACING: spaces required around that ':' (ctx:VxW)
#396: FILE: lib/eal/include/rte_common.h:611:
+			_Bool:              ((void *)((uintptr_t)(ptr) - (x))), \
 			     ^

WARNING:INDENTED_LABEL: labels should not be indented
#396: FILE: lib/eal/include/rte_common.h:611:
+			_Bool:              ((void *)((uintptr_t)(ptr) - (x))), \

ERROR:SPACING: spaces required around that ':' (ctx:VxW)
#397: FILE: lib/eal/include/rte_common.h:612:
+			default:            ((void *)((char *)(ptr) - (x))) \
 			       ^

ERROR:TRAILING_STATEMENTS: trailing statements should be on next line
#397: 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