diff mbox series

[05/16] lib/test_bitmap: disable compile-time test if DEBUG_BITMAP() is enabled

Message ID 20220718192844.1805158-6-yury.norov@gmail.com (mailing list archive)
State New
Headers show
Series Introduce DEBUG_BITMAP config option and bitmap_check_params() | expand

Commit Message

Yury Norov July 18, 2022, 7:28 p.m. UTC
CONFIG_DEBUG_BITMAP, when enabled, injects __bitmap_check_params()
into bitmap functions. It prevents compiler from compile-time
optimizations, which makes corresponding test fail.

Signed-off-by: Yury Norov <yury.norov@gmail.com>
---
 lib/test_bitmap.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Andy Shevchenko July 18, 2022, 9:10 p.m. UTC | #1
On Mon, Jul 18, 2022 at 12:28:33PM -0700, Yury Norov wrote:
> CONFIG_DEBUG_BITMAP, when enabled, injects __bitmap_check_params()
> into bitmap functions. It prevents compiler from compile-time
> optimizations, which makes corresponding test fail.

Does it stays the same for trace points?
diff mbox series

Patch

diff --git a/lib/test_bitmap.c b/lib/test_bitmap.c
index bc48d992d10d..8bd279a7633f 100644
--- a/lib/test_bitmap.c
+++ b/lib/test_bitmap.c
@@ -877,6 +877,7 @@  static void __init test_bitmap_print_buf(void)
 
 static void __init test_bitmap_const_eval(void)
 {
+#ifndef CONFIG_DEBUG_BITMAP
 	DECLARE_BITMAP(bitmap, BITS_PER_LONG);
 	unsigned long initvar = BIT(2);
 	unsigned long bitopvar = 0;
@@ -934,6 +935,7 @@  static void __init test_bitmap_const_eval(void)
 	/* ~BIT(25) */
 	BUILD_BUG_ON(!__builtin_constant_p(~var));
 	BUILD_BUG_ON(~var != ~BIT(25));
+#endif
 }
 
 static void __init selftest(void)