* [PATCH v2] unroll: Drop the unused unrolled and unrolled_none macros
@ 2026-10-23 16:31 Tzu-Ching Yang
0 siblings, 0 replies; only message in thread
From: Tzu-Ching Yang @ 2026-10-23 16:31 UTC (permalink / raw)
To: Eric Biggers
Cc: Jason A. Donenfeld, Ard Biesheuvel, Alexander Lobakin,
Jose E. Marchesi, Jakub Kicinski, Andrew Morton, Simon Horman,
Maciej Fijalkowski, David Laight, linux-crypto, linux-kernel
unrolled and unrolled_none are object-like macros with lower-case
names, and neither has had a user since commit c6594d642717 ("unroll:
add generic loop unroll helpers") added them in February 2025.
The name unrolled also breaks code that uses it for something else. On
GCC the macro expands to an empty _Pragma(), so a function parameter
named unrolled compiles with only -Wunknown-pragmas warnings (errors
only with CONFIG_WERROR) and silently loses its name:
int add(int unrolled, int x) { return unrolled + x; }
builds as "return x;" with GCC 11 to 16 (GCC 8 to 10 and Clang reject
it).
Drop both macros, and retitle the kernel-doc comment from unrolled to
unrolled_count(), the macro its usage example shows. unrolled_full and
unrolled_count() stay; any clash with their names fails to build
instead of compiling silently.
Suggested-by: Alexander Lobakin <aleksander.lobakin@intel.com>
Link: https://lore.kernel.org/all/3c25921c-7bdf-4edd-ba06-838dd1765db6@intel.com/
Signed-off-by: Tzu-Ching Yang <shingekinocore@gmail.com>
---
v2: drop the two unused macros instead of making all three
function-like (Alexander Lobakin).
v1: https://lore.kernel.org/all/20261016025613.2690485-1-shingekinocore@gmail.com/
Eric, this version no longer touches lib/crypto/. Would you still
take it through libcrypto-next, or should it go through Andrew's -mm
tree (unroll.h has no MAINTAINERS entry)?
Testing: an x86_64 defconfig build with the includers of
<linux/unroll.h> enabled (BLAKE2b/s, LSMs, IMA/EVM, BPF LSM, vhost,
i40e/ice/idpf; no debug info) gives byte-identical objects, modules and
vmlinux before and after, with GCC 11.5, GCC 16.2 and Clang 23. In a
file that includes only <linux/unroll.h>, a variable, member or
parameter named unrolled or unrolled_none now builds without warnings
with GCC 8.1 to 16.2 and Clang 17 to 23.
Based on libcrypto-next (20ec6916d871); applies as is to
next-20261022, which has no users of the two macros either.
include/linux/unroll.h | 13 ++-----------
1 file changed, 2 insertions(+), 11 deletions(-)
diff --git a/include/linux/unroll.h b/include/linux/unroll.h
index 186b71de7..d027b37f6 100644
--- a/include/linux/unroll.h
+++ b/include/linux/unroll.h
@@ -16,7 +16,8 @@
#endif
/**
- * unrolled - loop attributes to ask the compiler to unroll it
+ * unrolled_count() - loop attribute to ask the compiler to unroll it
+ * @n: unroll each @n iterations of the loop
*
* Usage:
*
@@ -34,12 +35,6 @@
* provides best performance and object code size.
* Available only on Clang and GCC 8.x onwards.
*/
-
-/* Ask the compiler to pick an optimal unroll count, Clang only */
-#define unrolled \
- __pick_unrolled(clang loop unroll(enable), /* nothing */)
-
-/* Unroll each @n iterations of the loop */
#define unrolled_count(n) \
__pick_unrolled(clang loop unroll_count(n), GCC unroll n)
@@ -47,10 +42,6 @@
#define unrolled_full \
__pick_unrolled(clang loop unroll(full), GCC unroll 65534)
-/* Never unroll the loop */
-#define unrolled_none \
- __pick_unrolled(clang loop unroll(disable), GCC unroll 1)
-
#define UNROLL(N, MACRO, args...) CONCATENATE(__UNROLL_, N)(MACRO, args)
#define __UNROLL_0(MACRO, args...)
base-commit: 20ec6916d8712e84d58e8c688a25cd368ddeb82b
--
2.34.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-10-23 16:31 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-23 16:31 [PATCH v2] unroll: Drop the unused unrolled and unrolled_none macros Tzu-Ching Yang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®