|WARNING| pw162735 [PATCH] test: parenthesize common macro arguments

checkpatch at dpdk.org checkpatch at dpdk.org
Thu Mar 26 18:49:44 CET 2026


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

_coding style issues_


WARNING:MACRO_WITH_FLOW_CONTROL: Macros with flow control statements should be avoided
#145: FILE: app/test/test.h:74:
+#define TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT_OFFSET(a, b, len, off, msg, ...) do { \
+	uint8_t _first_byte_a, _first_byte_b;                                   \
+	uint8_t _first_byte_mask, _first_byte_bits;                             \
+	uint32_t _len_without_first_byte = ((off) % 8) ?                        \
+				(len) - (8 - ((off) % 8)) :                     \
+				(len);                                          \
+	uint32_t _off_in_bytes = ((off) % 8) ? ((off) >> 3) + 1 : ((off) >> 3); \
+	const uint8_t *_a_with_off = (const uint8_t *)(a) + _off_in_bytes;      \
+	const uint8_t *_b_with_off = (const uint8_t *)(b) + _off_in_bytes;      \
+	TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT(_a_with_off, _b_with_off,             \
+				_len_without_first_byte, msg);                  \
+	if ((off) % 8) {                                                        \
+		_first_byte_bits = 8 - ((off) % 8);                             \
+		_first_byte_mask = (1 << _first_byte_bits) - 1;                 \
+		_first_byte_a = *(_a_with_off - 1);                             \
+		_first_byte_b = *(_b_with_off - 1);                             \
+		_first_byte_a &= _first_byte_mask;                              \
+		_first_byte_b &= _first_byte_mask;                              \
+		if (_first_byte_a != _first_byte_b) {                           \
+			printf("TestCase %s() line %d failed: "                 \
+				msg "
", __func__, __LINE__, ##__VA_ARGS__);   \
+			TEST_TRACE_FAILURE(__FILE__, __LINE__, __func__);       \
+			return TEST_FAILED;                                     \
+		}                                                               \
+	}                                                                       \
+} while (0)

total: 0 errors, 1 warnings, 135 lines checked


More information about the test-report mailing list