Skip to contentSkip to conversation

kselftest/riscv: Replace __ASSEMBLY__ with __ASSEMBLER__

PATCH In review Thomas Huth 3 participants 3 messages Aug 13 – Sep 2

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kselftest/riscv: Replace __ASSEMBLY__ with __ASSEMBLER__

From: Thomas Huth <[email protected]>

While the GCC and Clang compilers already define __ASSEMBLER__ automatically when compiling assembly code, __ASSEMBLY__ is a macro that only gets defined by the Makefiles in the kernel. This can be very confusing when switching between userspace and kernelspace coding, or when dealing with uapi headers that rather should use __ASSEMBLER__ instead. So let's standardize now on the __ASSEMBLER__ macro that is provided by the compilers.

---
 tools/testing/selftests/riscv/cfi/cfi_rv_test.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/riscv/cfi/cfi_rv_test.h +1 -1
index 1c8043f2b778b..184df6903d01c 100644
@@ -56,7 +56,7 @@
 
 #define CSR_SSP 0x011
 
-#ifdef __ASSEMBLY__
+#ifdef __ASSEMBLER__
 #define __ASM_STR(x)    x
 #else
 #define __ASM_STR(x)    #x
Signature · 1 line
2.55.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Thomas Huth

From: Thomas Huth <[email protected]>

While the GCC and Clang compilers already define __ASSEMBLER__ automatically when compiling assembly code, __ASSEMBLY__ is a macro that only gets defined by the Makefiles in the kernel.

Thank you for the patch.

Correct!

$ clang -dM -E -x assembler-with-cpp - < /dev/null | grep ASS
#define __ASSEMBLER__ 1
...
Quoted 4 lines

This can be very confusing when switching between userspace and kernelspace coding, or when dealing with uapi headers that rather should use __ASSEMBLER__ instead. So let's standardize now on the __ASSEMBLER__ macro that is provided by the compilers.

Yes, thanks for cleaning up this legacy cruft. Godspeed on fixing the rest of the kernel.

Quoted 22 lines
---
 tools/testing/selftests/riscv/cfi/cfi_rv_test.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/riscv/cfi/cfi_rv_test.h +1 -2
index 1c8043f2b778b..184df6903d01c 100644
@@ -56,7 +56,7 @@
 
 #define CSR_SSP 0x011
 
-#ifdef __ASSEMBLY__
+#ifdef __ASSEMBLER__
 #define __ASM_STR(x)    x
 #else
 #define __ASM_STR(x)    #x
--

2.55.0

Signature · 2 lines
Thanks,
~Nick Desaulniers
maintainer
#2 lore raw
In reply to Thomas Huth
Quoted 11 lines · Thomas Huth

From: Thomas Huth <[email protected]>

While the GCC and Clang compilers already define __ASSEMBLER__ automatically when compiling assembly code, __ASSEMBLY__ is a macro that only gets defined by the Makefiles in the kernel. This can be very confusing when switching between userspace and kernelspace coding, or when dealing with uapi headers that rather should use __ASSEMBLER__ instead. So let's standardize now on the __ASSEMBLER__ macro that is provided by the compilers.

Thanks, queued for v7.3-rc. Have you considered patching checkpatch.pl to catch this problem? Might save a lot of time.

- Paul