sparse: can do constant folding of __builtin_bswap*()
diff mbox series

Message ID 20210226092236.99369-1-luc.vanoostenryck@gmail.com
State In Next
Commit 960984d964a9341cf50bf2b4ffdf0beb14467517
Headers show
Series
  • sparse: can do constant folding of __builtin_bswap*()
Related show

Commit Message

Luc Van Oostenryck Feb. 26, 2021, 9:22 a.m. UTC
Sparse can do constant folding of __builtin_bswap*() since 2017.
Also, a much recent version of Sparse is needed anyway, see
commit 6ec4476ac825 ("Raise gcc version requirement to 4.9").

So, remove the comment about sparse not being yet able to constant
fold __builtin_bswap*() and remove the corresponding test of __CHECKER__.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 include/linux/compiler-gcc.h | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

Comments

Arnd Bergmann Feb. 26, 2021, 10:38 a.m. UTC | #1
On Fri, Feb 26, 2021 at 10:22 AM Luc Van Oostenryck
<luc.vanoostenryck@gmail.com> wrote:
>
> Sparse can do constant folding of __builtin_bswap*() since 2017.
> Also, a much recent version of Sparse is needed anyway, see
> commit 6ec4476ac825 ("Raise gcc version requirement to 4.9").
>
> So, remove the comment about sparse not being yet able to constant
> fold __builtin_bswap*() and remove the corresponding test of __CHECKER__.
>
> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>

Acked-by: Arnd Bergmann <arnd@arndb.de>
Miguel Ojeda Feb. 26, 2021, 12:17 p.m. UTC | #2
On Fri, Feb 26, 2021 at 10:22 AM Luc Van Oostenryck
<luc.vanoostenryck@gmail.com> wrote:
>
> Sparse can do constant folding of __builtin_bswap*() since 2017.
> Also, a much recent version of Sparse is needed anyway, see
> commit 6ec4476ac825 ("Raise gcc version requirement to 4.9").
>
> So, remove the comment about sparse not being yet able to constant
> fold __builtin_bswap*() and remove the corresponding test of __CHECKER__.
>
> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>

Acked-by: Miguel Ojeda <ojeda@kernel.org>

Cheers,
Miguel

Patch
diff mbox series

diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index 74c6c0486eed..d1016cc6798a 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -95,15 +95,11 @@ 
  */
 #define asm_volatile_goto(x...)	do { asm goto(x); asm (""); } while (0)
 
-/*
- * sparse (__CHECKER__) pretends to be gcc, but can't do constant
- * folding in __builtin_bswap*() (yet), so don't set these for it.
- */
-#if defined(CONFIG_ARCH_USE_BUILTIN_BSWAP) && !defined(__CHECKER__)
+#if defined(CONFIG_ARCH_USE_BUILTIN_BSWAP)
 #define __HAVE_BUILTIN_BSWAP32__
 #define __HAVE_BUILTIN_BSWAP64__
 #define __HAVE_BUILTIN_BSWAP16__
-#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP && !__CHECKER__ */
+#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */
 
 #if GCC_VERSION >= 70000
 #define KASAN_ABI_VERSION 5