1*9b00c160SMarco Elver // SPDX-License-Identifier: GPL-2.0-only 2*9b00c160SMarco Elver /* 3*9b00c160SMarco Elver * Compile-only tests for common patterns that should not generate false 4*9b00c160SMarco Elver * positive errors when compiled with Clang's context analysis. 5*9b00c160SMarco Elver */ 6*9b00c160SMarco Elver 7*9b00c160SMarco Elver #include <linux/build_bug.h> 8*9b00c160SMarco Elver 9*9b00c160SMarco Elver /* 10*9b00c160SMarco Elver * Test that helper macros work as expected. 11*9b00c160SMarco Elver */ 12*9b00c160SMarco Elver static void __used test_common_helpers(void) 13*9b00c160SMarco Elver { 14*9b00c160SMarco Elver BUILD_BUG_ON(context_unsafe(3) != 3); /* plain expression */ 15*9b00c160SMarco Elver BUILD_BUG_ON(context_unsafe((void)2; 3) != 3); /* does not swallow semi-colon */ 16*9b00c160SMarco Elver BUILD_BUG_ON(context_unsafe((void)2, 3) != 3); /* does not swallow commas */ 17*9b00c160SMarco Elver context_unsafe(do { } while (0)); /* works with void statements */ 18*9b00c160SMarco Elver } 19