Re: selftests: riscv: add misaligned access testing

0 views
Skip to first unread message

linux.r...@gmail.com

unread,
May 12, 2025, 5:34:43 AMMay 12
to linux-ris...@googlegroups.com, cle...@rivosinc.com
This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the Linux RISC-V mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/linux-riscv/list/?series=961917

---Test result---
Test Summary:
Patch 1: "selftests: riscv: add misaligned access testing" build-rv32-defconfig PASS 104.80 seconds
Patch 1: "selftests: riscv: add misaligned access testing" build-rv64-clang-allmodconfig PASS 875.08 seconds
Patch 1: "selftests: riscv: add misaligned access testing" build-rv64-gcc-allmodconfig PASS 1131.45 seconds
Patch 1: "selftests: riscv: add misaligned access testing" build-rv64-nommu-k210-defconfig PASS 21.31 seconds
Patch 1: "selftests: riscv: add misaligned access testing" build-rv64-nommu-k210-virt PASS 21.18 seconds
Patch 1: "selftests: riscv: add misaligned access testing" checkpatch ERROR 3.61 seconds
Patch 1: "selftests: riscv: add misaligned access testing" dtb-warn-rv64 PASS 66.76 seconds
Patch 1: "selftests: riscv: add misaligned access testing" header-inline PASS 0.35 seconds
Patch 1: "selftests: riscv: add misaligned access testing" kdoc PASS 0.88 seconds
Patch 1: "selftests: riscv: add misaligned access testing" module-param PASS 0.25 seconds
Patch 1: "selftests: riscv: add misaligned access testing" verify-fixes PASS 0.23 seconds
Patch 1: "selftests: riscv: add misaligned access testing" verify-signedoff PASS 0.30 seconds

Details
##############################
Patch 1: "selftests: riscv: add misaligned access testing"
Test: checkpatch - ERROR
Desc: Runs checkpatch.pl on the patch
Output:
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#46:
new file mode 100644

WARNING: 'ment' may be misspelled - perhaps 'meant'?
#81: FILE: tools/testing/selftests/riscv/misaligned/common.S:6:
+ * Clément Léger <cle...@rivosinc.com>
^^^^

WARNING: 'ment' may be misspelled - perhaps 'meant'?
#120: FILE: tools/testing/selftests/riscv/misaligned/fpu.S:6:
+ * Clément Léger <cle...@rivosinc.com>
^^^^

WARNING: 'ment' may be misspelled - perhaps 'meant'?
#306: FILE: tools/testing/selftests/riscv/misaligned/gp.S:6:
+ * Clément Léger <cle...@rivosinc.com>
^^^^

WARNING: 'ment' may be misspelled - perhaps 'meant'?
#415: FILE: tools/testing/selftests/riscv/misaligned/misaligned.c:6:
+ * Clément Léger <cle...@rivosinc.com>
^^^^

ERROR: Macros with complex values should be enclosed in parentheses
#480: FILE: tools/testing/selftests/riscv/misaligned/misaligned.c:71:
+#define fpu_load_proto(__inst, __type) \
+extern __type test_ ## __inst(unsigned long fp_reg, void *addr, unsigned long offset, __type value)

ERROR: Macros with complex values should be enclosed in parentheses
#498: FILE: tools/testing/selftests/riscv/misaligned/misaligned.c:89:
+#define gp_load_proto(__inst, __type) \
+extern __type test_ ## __inst(void *addr, unsigned long offset, __type value)

ERROR: Macros with complex values should be enclosed in parentheses
#520: FILE: tools/testing/selftests/riscv/misaligned/misaligned.c:111:
+#define TEST_GP_LOAD(__inst, __type_size) \
+TEST(gp_load_ ## __inst) \
+{ \
+ int offset, ret; \
+ uint8_t buf[16] __attribute__((aligned(16))); \
+ \
+ ret = prctl(PR_SET_UNALIGN, PR_UNALIGN_NOPRINT); \
+ ASSERT_EQ(ret, 0); \
+ \
+ for (offset = 1; offset < __type_size / 8; offset++) { \
+ uint ## __type_size ## _t val = VAL ## __type_size; \
+ uint ## __type_size ## _t *ptr = (uint ## __type_size ## _t *) (buf + offset); \
+ memcpy(ptr, &val, sizeof(val)); \
+ val = test_ ## __inst(ptr, offset, val); \
+ EXPECT_EQ(VAL ## __type_size, val); \
+ } \
+}

CHECK: Macro argument '__type_size' may be better as '(__type_size)' to avoid precedence issues
#520: FILE: tools/testing/selftests/riscv/misaligned/misaligned.c:111:
+#define TEST_GP_LOAD(__inst, __type_size) \
+TEST(gp_load_ ## __inst) \
+{ \
+ int offset, ret; \
+ uint8_t buf[16] __attribute__((aligned(16))); \
+ \
+ ret = prctl(PR_SET_UNALIGN, PR_UNALIGN_NOPRINT); \
+ ASSERT_EQ(ret, 0); \
+ \
+ for (offset = 1; offset < __type_size / 8; offset++) { \
+ uint ## __type_size ## _t val = VAL ## __type_size; \
+ uint ## __type_size ## _t *ptr = (uint ## __type_size ## _t *) (buf + offset); \
+ memcpy(ptr, &val, sizeof(val)); \
+ val = test_ ## __inst(ptr, offset, val); \
+ EXPECT_EQ(VAL ## __type_size, val); \
+ } \
+}

WARNING: Prefer __aligned(16) over __attribute__((aligned(16)))
#524: FILE: tools/testing/selftests/riscv/misaligned/misaligned.c:115:
+ uint8_t buf[16] __attribute__((aligned(16))); \

CHECK: spaces preferred around that '*' (ctx:WxV)
#531: FILE: tools/testing/selftests/riscv/misaligned/misaligned.c:122:
+ uint ## __type_size ## _t *ptr = (uint ## __type_size ## _t *) (buf + offset); \
^

ERROR: Macros with complex values should be enclosed in parentheses
#549: FILE: tools/testing/selftests/riscv/misaligned/misaligned.c:140:
+#define TEST_GP_STORE(__inst, __type_size) \
+TEST(gp_load_ ## __inst) \
+{ \
+ int offset, ret; \
+ uint8_t buf[16] __attribute__((aligned(16))); \
+ \
+ ret = prctl(PR_SET_UNALIGN, PR_UNALIGN_NOPRINT); \
+ ASSERT_EQ(ret, 0); \
+ \
+ for (offset = 1; offset < __type_size / 8; offset++) { \
+ uint ## __type_size ## _t val = VAL ## __type_size; \
+ uint ## __type_size ## _t *ptr = (uint ## __type_size ## _t *) (buf + offset); \
+ memset(ptr, 0, sizeof(val)); \
+ test_ ## __inst(ptr, offset, val); \
+ memcpy(&val, ptr, sizeof(val)); \
+ EXPECT_EQ(VAL ## __type_size, val); \
+ } \
+}

CHECK: Macro argument '__type_size' may be better as '(__type_size)' to avoid precedence issues
#549: FILE: tools/testing/selftests/riscv/misaligned/misaligned.c:140:
+#define TEST_GP_STORE(__inst, __type_size) \
+TEST(gp_load_ ## __inst) \
+{ \
+ int offset, ret; \
+ uint8_t buf[16] __attribute__((aligned(16))); \
+ \
+ ret = prctl(PR_SET_UNALIGN, PR_UNALIGN_NOPRINT); \
+ ASSERT_EQ(ret, 0); \
+ \
+ for (offset = 1; offset < __type_size / 8; offset++) { \
+ uint ## __type_size ## _t val = VAL ## __type_size; \
+ uint ## __type_size ## _t *ptr = (uint ## __type_size ## _t *) (buf + offset); \
+ memset(ptr, 0, sizeof(val)); \
+ test_ ## __inst(ptr, offset, val); \
+ memcpy(&val, ptr, sizeof(val)); \
+ EXPECT_EQ(VAL ## __type_size, val); \
+ } \
+}

WARNING: Prefer __aligned(16) over __attribute__((aligned(16)))
#553: FILE: tools/testing/selftests/riscv/misaligned/misaligned.c:144:
+ uint8_t buf[16] __attribute__((aligned(16))); \

CHECK: spaces preferred around that '*' (ctx:WxV)
#560: FILE: tools/testing/selftests/riscv/misaligned/misaligned.c:151:
+ uint ## __type_size ## _t *ptr = (uint ## __type_size ## _t *) (buf + offset); \
^

CHECK: Please use a blank line after function/struct/union/enum declarations
#567: FILE: tools/testing/selftests/riscv/misaligned/misaligned.c:158:
+}
+TEST_GP_STORE(sh, 16);

ERROR: Macros with complex values should be enclosed in parentheses
#576: FILE: tools/testing/selftests/riscv/misaligned/misaligned.c:167:
+#define __TEST_FPU_LOAD(__type, __inst, __reg_start, __reg_end) \
+TEST(fpu_load_ ## __inst) \
+{ \
+ int ret, offset, fp_reg; \
+ uint8_t buf[16] __attribute__((aligned(16))); \
+ \
+ ret = prctl(PR_SET_UNALIGN, PR_UNALIGN_NOPRINT); \
+ ASSERT_EQ(ret, 0); \
+ \
+ for (fp_reg = __reg_start; fp_reg < __reg_end; fp_reg++) { \
+ for (offset = 1; offset < 4; offset++) { \
+ void *load_addr = (buf + offset); \
+ __type val = VAL_ ## __type ; \
+ \
+ memcpy(load_addr, &val, sizeof(val)); \
+ val = test_ ## __inst(fp_reg, load_addr, offset, val); \
+ EXPECT_TRUE(__type ##_equal(val, VAL_## __type)); \
+ } \
+ } \
+}

CHECK: Macro argument '__reg_end' may be better as '(__reg_end)' to avoid precedence issues
#576: FILE: tools/testing/selftests/riscv/misaligned/misaligned.c:167:
+#define __TEST_FPU_LOAD(__type, __inst, __reg_start, __reg_end) \
+TEST(fpu_load_ ## __inst) \
+{ \
+ int ret, offset, fp_reg; \
+ uint8_t buf[16] __attribute__((aligned(16))); \
+ \
+ ret = prctl(PR_SET_UNALIGN, PR_UNALIGN_NOPRINT); \
+ ASSERT_EQ(ret, 0); \
+ \
+ for (fp_reg = __reg_start; fp_reg < __reg_end; fp_reg++) { \
+ for (offset = 1; offset < 4; offset++) { \
+ void *load_addr = (buf + offset); \
+ __type val = VAL_ ## __type ; \
+ \
+ memcpy(load_addr, &val, sizeof(val)); \
+ val = test_ ## __inst(fp_reg, load_addr, offset, val); \
+ EXPECT_TRUE(__type ##_equal(val, VAL_## __type)); \
+ } \
+ } \
+}

WARNING: Prefer __aligned(16) over __attribute__((aligned(16)))
#580: FILE: tools/testing/selftests/riscv/misaligned/misaligned.c:171:
+ uint8_t buf[16] __attribute__((aligned(16))); \

CHECK: Please use a blank line after function/struct/union/enum declarations
#596: FILE: tools/testing/selftests/riscv/misaligned/misaligned.c:187:
+}
+#define TEST_FPU_LOAD(__type, __inst) \

ERROR: Macros with complex values should be enclosed in parentheses
#608: FILE: tools/testing/selftests/riscv/misaligned/misaligned.c:199:
+#define __TEST_FPU_STORE(__type, __inst, __reg_start, __reg_end) \
+TEST(fpu_store_ ## __inst) \
+{ \
+ int ret, offset, fp_reg; \
+ uint8_t buf[16] __attribute__((aligned(16))); \
+ \
+ ret = prctl(PR_SET_UNALIGN, PR_UNALIGN_NOPRINT); \
+ ASSERT_EQ(ret, 0); \
+ \
+ for (fp_reg = __reg_start; fp_reg < __reg_end; fp_reg++) { \
+ for (offset = 1; offset < 4; offset++) { \
+ \
+ void *store_addr = (buf + offset); \
+ __type val = VAL_ ## __type ; \
+ \
+ test_ ## __inst(fp_reg, store_addr, offset, val); \
+ memcpy(&val, store_addr, sizeof(val)); \
+ EXPECT_TRUE(__type ## _equal(val, VAL_## __type)); \
+ } \
+ } \
+}

CHECK: Macro argument '__reg_end' may be better as '(__reg_end)' to avoid precedence issues
#608: FILE: tools/testing/selftests/riscv/misaligned/misaligned.c:199:
+#define __TEST_FPU_STORE(__type, __inst, __reg_start, __reg_end) \
+TEST(fpu_store_ ## __inst) \
+{ \
+ int ret, offset, fp_reg; \
+ uint8_t buf[16] __attribute__((aligned(16))); \
+ \
+ ret = prctl(PR_SET_UNALIGN, PR_UNALIGN_NOPRINT); \
+ ASSERT_EQ(ret, 0); \
+ \
+ for (fp_reg = __reg_start; fp_reg < __reg_end; fp_reg++) { \
+ for (offset = 1; offset < 4; offset++) { \
+ \
+ void *store_addr = (buf + offset); \
+ __type val = VAL_ ## __type ; \
+ \
+ test_ ## __inst(fp_reg, store_addr, offset, val); \
+ memcpy(&val, store_addr, sizeof(val)); \
+ EXPECT_TRUE(__type ## _equal(val, VAL_## __type)); \
+ } \
+ } \
+}

WARNING: Prefer __aligned(16) over __attribute__((aligned(16)))
#612: FILE: tools/testing/selftests/riscv/misaligned/misaligned.c:203:
+ uint8_t buf[16] __attribute__((aligned(16))); \

CHECK: Please use a blank line after function/struct/union/enum declarations
#629: FILE: tools/testing/selftests/riscv/misaligned/misaligned.c:220:
+}
+#define TEST_FPU_STORE(__type, __inst) \

WARNING: Prefer __aligned(16) over __attribute__((aligned(16)))
#644: FILE: tools/testing/selftests/riscv/misaligned/misaligned.c:235:
+ uint8_t buf[16] __attribute__((aligned(16)));

total: 6 errors, 10 warnings, 9 checks, 591 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.

Commit 6a91c17461de ("selftests: riscv: add misaligned access testing") has style problems, please review.

NOTE: Ignored message types: ALLOC_SIZEOF_STRUCT CAMELCASE COMMIT_LOG_LONG_LINE GIT_COMMIT_ID MACRO_ARG_REUSE NO_AUTHOR_SIGN_OFF

NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
CHECK: Macro argument '__reg_end' may be better as '(__reg_end)' to avoid precedence issues
CHECK: Macro argument '__type_size' may be better as '(__type_size)' to avoid precedence issues
CHECK: Please use a blank line after function/struct/union/enum declarations
CHECK: spaces preferred around that '*' (ctx:WxV)
ERROR: Macros with complex values should be enclosed in parentheses
WARNING: 'ment' may be misspelled - perhaps 'meant'?
WARNING: Prefer __aligned(16) over __attribute__((aligned(16)))
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?


---
Regards,
Linux RISC-V bot

linux.r...@gmail.com

unread,
May 14, 2025, 5:35:00 AMMay 14
to linux-ris...@googlegroups.com, cle...@rivosinc.com
This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the Linux RISC-V mailing list.
This is a CI test results with your patch series:

PW Link:https://patchwork.kernel.org/project/linux-riscv/list/?series=962732

---Test result---
Test Summary:
Patch 1: "[v2] selftests: riscv: add misaligned access testing" build-rv32-defconfig PASS 105.90 seconds
Patch 1: "[v2] selftests: riscv: add misaligned access testing" build-rv64-clang-allmodconfig PASS 881.25 seconds
Patch 1: "[v2] selftests: riscv: add misaligned access testing" build-rv64-gcc-allmodconfig PASS 1144.12 seconds
Patch 1: "[v2] selftests: riscv: add misaligned access testing" build-rv64-nommu-k210-defconfig PASS 20.68 seconds
Patch 1: "[v2] selftests: riscv: add misaligned access testing" build-rv64-nommu-k210-virt PASS 21.82 seconds
Patch 1: "[v2] selftests: riscv: add misaligned access testing" checkpatch ERROR 3.75 seconds
Patch 1: "[v2] selftests: riscv: add misaligned access testing" dtb-warn-rv64 PASS 67.13 seconds
Patch 1: "[v2] selftests: riscv: add misaligned access testing" header-inline PASS 0.23 seconds
Patch 1: "[v2] selftests: riscv: add misaligned access testing" kdoc PASS 0.83 seconds
Patch 1: "[v2] selftests: riscv: add misaligned access testing" module-param PASS 0.26 seconds
Patch 1: "[v2] selftests: riscv: add misaligned access testing" verify-fixes PASS 0.23 seconds
Patch 1: "[v2] selftests: riscv: add misaligned access testing" verify-signedoff PASS 0.31 seconds

Details
##############################
Patch 1: "[v2] selftests: riscv: add misaligned access testing"


Test: checkpatch - ERROR
Desc: Runs checkpatch.pl on the patch
Output:
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?

#45:
new file mode 100644

WARNING: 'ment' may be misspelled - perhaps 'meant'?

#80: FILE: tools/testing/selftests/riscv/misaligned/common.S:6:


+ * Clément Léger <cle...@rivosinc.com>
^^^^

WARNING: 'ment' may be misspelled - perhaps 'meant'?

#119: FILE: tools/testing/selftests/riscv/misaligned/fpu.S:6:


+ * Clément Léger <cle...@rivosinc.com>
^^^^

WARNING: 'ment' may be misspelled - perhaps 'meant'?

#305: FILE: tools/testing/selftests/riscv/misaligned/gp.S:6:


+ * Clément Léger <cle...@rivosinc.com>
^^^^

WARNING: 'ment' may be misspelled - perhaps 'meant'?

#414: FILE: tools/testing/selftests/riscv/misaligned/misaligned.c:6:


+ * Clément Léger <cle...@rivosinc.com>
^^^^

ERROR: Macros with complex values should be enclosed in parentheses

#479: FILE: tools/testing/selftests/riscv/misaligned/misaligned.c:71:


+#define fpu_load_proto(__inst, __type) \
+extern __type test_ ## __inst(unsigned long fp_reg, void *addr, unsigned long offset, __type value)

ERROR: Macros with complex values should be enclosed in parentheses

#497: FILE: tools/testing/selftests/riscv/misaligned/misaligned.c:89:


+#define gp_load_proto(__inst, __type) \
+extern __type test_ ## __inst(void *addr, unsigned long offset, __type value)

ERROR: Macros with complex values should be enclosed in parentheses

#519: FILE: tools/testing/selftests/riscv/misaligned/misaligned.c:111:


+#define TEST_GP_LOAD(__inst, __type_size) \
+TEST(gp_load_ ## __inst) \
+{ \
+ int offset, ret; \
+ uint8_t buf[16] __attribute__((aligned(16))); \
+ \
+ ret = prctl(PR_SET_UNALIGN, PR_UNALIGN_NOPRINT); \
+ ASSERT_EQ(ret, 0); \
+ \

+ for (offset = 1; offset < (__type_size) / 8; offset++) { \


+ uint ## __type_size ## _t val = VAL ## __type_size; \

+ uint ## __type_size ## _t *ptr = (uint ## __type_size ## _t *)(buf + offset); \


+ memcpy(ptr, &val, sizeof(val)); \
+ val = test_ ## __inst(ptr, offset, val); \
+ EXPECT_EQ(VAL ## __type_size, val); \
+ } \
+}

WARNING: Prefer __aligned(16) over __attribute__((aligned(16)))

#523: FILE: tools/testing/selftests/riscv/misaligned/misaligned.c:115:


+ uint8_t buf[16] __attribute__((aligned(16))); \

CHECK: spaces preferred around that '*' (ctx:WxV)

#530: FILE: tools/testing/selftests/riscv/misaligned/misaligned.c:122:
+ uint ## __type_size ## _t *ptr = (uint ## __type_size ## _t *)(buf + offset); \
^

ERROR: Macros with complex values should be enclosed in parentheses

#548: FILE: tools/testing/selftests/riscv/misaligned/misaligned.c:140:


+#define TEST_GP_STORE(__inst, __type_size) \
+TEST(gp_load_ ## __inst) \
+{ \
+ int offset, ret; \
+ uint8_t buf[16] __attribute__((aligned(16))); \
+ \
+ ret = prctl(PR_SET_UNALIGN, PR_UNALIGN_NOPRINT); \
+ ASSERT_EQ(ret, 0); \
+ \

+ for (offset = 1; offset < (__type_size) / 8; offset++) { \


+ uint ## __type_size ## _t val = VAL ## __type_size; \

+ uint ## __type_size ## _t *ptr = (uint ## __type_size ## _t *)(buf + offset); \


+ memset(ptr, 0, sizeof(val)); \
+ test_ ## __inst(ptr, offset, val); \
+ memcpy(&val, ptr, sizeof(val)); \
+ EXPECT_EQ(VAL ## __type_size, val); \
+ } \
+}

WARNING: Prefer __aligned(16) over __attribute__((aligned(16)))

#552: FILE: tools/testing/selftests/riscv/misaligned/misaligned.c:144:


+ uint8_t buf[16] __attribute__((aligned(16))); \

CHECK: spaces preferred around that '*' (ctx:WxV)

#559: FILE: tools/testing/selftests/riscv/misaligned/misaligned.c:151:
+ uint ## __type_size ## _t *ptr = (uint ## __type_size ## _t *)(buf + offset); \
^

CHECK: Please use a blank line after function/struct/union/enum declarations

#566: FILE: tools/testing/selftests/riscv/misaligned/misaligned.c:158:
+}
+TEST_GP_STORE(sh, 16);

ERROR: Macros with complex values should be enclosed in parentheses

#575: FILE: tools/testing/selftests/riscv/misaligned/misaligned.c:167:


+#define __TEST_FPU_LOAD(__type, __inst, __reg_start, __reg_end) \
+TEST(fpu_load_ ## __inst) \
+{ \
+ int ret, offset, fp_reg; \
+ uint8_t buf[16] __attribute__((aligned(16))); \
+ \
+ ret = prctl(PR_SET_UNALIGN, PR_UNALIGN_NOPRINT); \
+ ASSERT_EQ(ret, 0); \
+ \
+ for (fp_reg = __reg_start; fp_reg < __reg_end; fp_reg++) { \
+ for (offset = 1; offset < 4; offset++) { \
+ void *load_addr = (buf + offset); \
+ __type val = VAL_ ## __type ; \
+ \
+ memcpy(load_addr, &val, sizeof(val)); \
+ val = test_ ## __inst(fp_reg, load_addr, offset, val); \
+ EXPECT_TRUE(__type ##_equal(val, VAL_## __type)); \
+ } \
+ } \
+}

CHECK: Macro argument '__reg_end' may be better as '(__reg_end)' to avoid precedence issues

#575: FILE: tools/testing/selftests/riscv/misaligned/misaligned.c:167:


+#define __TEST_FPU_LOAD(__type, __inst, __reg_start, __reg_end) \
+TEST(fpu_load_ ## __inst) \
+{ \
+ int ret, offset, fp_reg; \
+ uint8_t buf[16] __attribute__((aligned(16))); \
+ \
+ ret = prctl(PR_SET_UNALIGN, PR_UNALIGN_NOPRINT); \
+ ASSERT_EQ(ret, 0); \
+ \
+ for (fp_reg = __reg_start; fp_reg < __reg_end; fp_reg++) { \
+ for (offset = 1; offset < 4; offset++) { \
+ void *load_addr = (buf + offset); \
+ __type val = VAL_ ## __type ; \
+ \
+ memcpy(load_addr, &val, sizeof(val)); \
+ val = test_ ## __inst(fp_reg, load_addr, offset, val); \
+ EXPECT_TRUE(__type ##_equal(val, VAL_## __type)); \
+ } \
+ } \
+}

WARNING: Prefer __aligned(16) over __attribute__((aligned(16)))

#579: FILE: tools/testing/selftests/riscv/misaligned/misaligned.c:171:


+ uint8_t buf[16] __attribute__((aligned(16))); \

CHECK: Please use a blank line after function/struct/union/enum declarations

#595: FILE: tools/testing/selftests/riscv/misaligned/misaligned.c:187:
+}
+#define TEST_FPU_LOAD(__type, __inst) \

ERROR: Macros with complex values should be enclosed in parentheses

#607: FILE: tools/testing/selftests/riscv/misaligned/misaligned.c:199:


+#define __TEST_FPU_STORE(__type, __inst, __reg_start, __reg_end) \
+TEST(fpu_store_ ## __inst) \
+{ \
+ int ret, offset, fp_reg; \
+ uint8_t buf[16] __attribute__((aligned(16))); \
+ \
+ ret = prctl(PR_SET_UNALIGN, PR_UNALIGN_NOPRINT); \
+ ASSERT_EQ(ret, 0); \
+ \
+ for (fp_reg = __reg_start; fp_reg < __reg_end; fp_reg++) { \
+ for (offset = 1; offset < 4; offset++) { \
+ \
+ void *store_addr = (buf + offset); \
+ __type val = VAL_ ## __type ; \
+ \
+ test_ ## __inst(fp_reg, store_addr, offset, val); \
+ memcpy(&val, store_addr, sizeof(val)); \
+ EXPECT_TRUE(__type ## _equal(val, VAL_## __type)); \
+ } \
+ } \
+}

CHECK: Macro argument '__reg_end' may be better as '(__reg_end)' to avoid precedence issues

#607: FILE: tools/testing/selftests/riscv/misaligned/misaligned.c:199:


+#define __TEST_FPU_STORE(__type, __inst, __reg_start, __reg_end) \
+TEST(fpu_store_ ## __inst) \
+{ \
+ int ret, offset, fp_reg; \
+ uint8_t buf[16] __attribute__((aligned(16))); \
+ \
+ ret = prctl(PR_SET_UNALIGN, PR_UNALIGN_NOPRINT); \
+ ASSERT_EQ(ret, 0); \
+ \
+ for (fp_reg = __reg_start; fp_reg < __reg_end; fp_reg++) { \
+ for (offset = 1; offset < 4; offset++) { \
+ \
+ void *store_addr = (buf + offset); \
+ __type val = VAL_ ## __type ; \
+ \
+ test_ ## __inst(fp_reg, store_addr, offset, val); \
+ memcpy(&val, store_addr, sizeof(val)); \
+ EXPECT_TRUE(__type ## _equal(val, VAL_## __type)); \
+ } \
+ } \
+}

WARNING: Prefer __aligned(16) over __attribute__((aligned(16)))

#611: FILE: tools/testing/selftests/riscv/misaligned/misaligned.c:203:


+ uint8_t buf[16] __attribute__((aligned(16))); \

CHECK: Please use a blank line after function/struct/union/enum declarations

#628: FILE: tools/testing/selftests/riscv/misaligned/misaligned.c:220:
+}
+#define TEST_FPU_STORE(__type, __inst) \

WARNING: Prefer __aligned(16) over __attribute__((aligned(16)))

#643: FILE: tools/testing/selftests/riscv/misaligned/misaligned.c:235:


+ uint8_t buf[16] __attribute__((aligned(16)));

total: 6 errors, 10 warnings, 7 checks, 591 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.

Commit f5be6e8e709b ("selftests: riscv: add misaligned access testing") has style problems, please review.

NOTE: Ignored message types: ALLOC_SIZEOF_STRUCT CAMELCASE COMMIT_LOG_LONG_LINE GIT_COMMIT_ID MACRO_ARG_REUSE NO_AUTHOR_SIGN_OFF

NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
CHECK: Macro argument '__reg_end' may be better as '(__reg_end)' to avoid precedence issues

Reply all
Reply to author
Forward
0 new messages