Skip to content

Instantly share code, notes, and snippets.

@linux-riscv-bot
Created March 11, 2025 03:26
pw942347-p14010362
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#33:
new file mode 100644
WARNING: 'ment' may be misspelled - perhaps 'meant'?
#68: FILE: tools/testing/selftests/riscv/misaligned/common.S:6:
+ * Clément Léger <cleger@rivosinc.com>
^^^^
WARNING: 'ment' may be misspelled - perhaps 'meant'?
#107: FILE: tools/testing/selftests/riscv/misaligned/fpu.S:6:
+ * Clément Léger <cleger@rivosinc.com>
^^^^
WARNING: 'ment' may be misspelled - perhaps 'meant'?
#293: FILE: tools/testing/selftests/riscv/misaligned/gp.S:6:
+ * Clément Léger <cleger@rivosinc.com>
^^^^
WARNING: 'ment' may be misspelled - perhaps 'meant'?
#402: FILE: tools/testing/selftests/riscv/misaligned/misaligned.c:6:
+ * Clément Léger <cleger@rivosinc.com>
^^^^
ERROR: Macros with complex values should be enclosed in parentheses
#467: 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
#485: 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
#507: 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
#507: 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)))
#511: FILE: tools/testing/selftests/riscv/misaligned/misaligned.c:115:
+ uint8_t buf[16] __attribute__((aligned(16))); \
CHECK: spaces preferred around that '*' (ctx:WxV)
#518: 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
#536: 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
#536: 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)))
#540: FILE: tools/testing/selftests/riscv/misaligned/misaligned.c:144:
+ uint8_t buf[16] __attribute__((aligned(16))); \
CHECK: spaces preferred around that '*' (ctx:WxV)
#547: 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
#554: FILE: tools/testing/selftests/riscv/misaligned/misaligned.c:158:
+}
+TEST_GP_STORE(sh, 16);
ERROR: Macros with complex values should be enclosed in parentheses
#563: FILE: tools/testing/selftests/riscv/misaligned/misaligned.c:167:
+#define __TEST_FPU_LOAD(__type, __inst, __reg_start, __reg_end) \
+TEST(fpu_load_ ## __inst) \
+{ \
+ int i, 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
#563: FILE: tools/testing/selftests/riscv/misaligned/misaligned.c:167:
+#define __TEST_FPU_LOAD(__type, __inst, __reg_start, __reg_end) \
+TEST(fpu_load_ ## __inst) \
+{ \
+ int i, 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)))
#567: 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
#583: 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
#595: FILE: tools/testing/selftests/riscv/misaligned/misaligned.c:199:
+#define __TEST_FPU_STORE(__type, __inst, __reg_start, __reg_end) \
+TEST(fpu_store_ ## __inst) \
+{ \
+ int i, 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
#595: FILE: tools/testing/selftests/riscv/misaligned/misaligned.c:199:
+#define __TEST_FPU_STORE(__type, __inst, __reg_start, __reg_end) \
+TEST(fpu_store_ ## __inst) \
+{ \
+ int i, 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)))
#599: 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
#616: FILE: tools/testing/selftests/riscv/misaligned/misaligned.c:220:
+}
+#define TEST_FPU_STORE(__type, __inst) \
WARNING: Prefer __aligned(16) over __attribute__((aligned(16)))
#631: FILE: tools/testing/selftests/riscv/misaligned/misaligned.c:235:
+ uint8_t buf[16] __attribute__((aligned(16)));
total: 6 errors, 10 warnings, 9 checks, 583 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 2c72350c94c5 ("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?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment