[PATCH weston 4/4] tests: Mark tests as used, so they don’t get removed at link-time.

Emmanuel Gil Peyrot emmanuel.peyrot at collabora.com
Fri Apr 14 18:48:07 UTC 2017


Without this attribute, the test macros were making Weston fail to
build with LTO enabled.

Signed-off-by: Markus Trippelsdorf <markus at trippelsdorf.de>
Signed-off-by: Emmanuel Gil Peyrot <emmanuel.peyrot at collabora.com>
Tested-by: Emmanuel Gil Peyrot <emmanuel.peyrot at collabora.com>
---
 tests/weston-test-runner.h       | 2 +-
 tools/zunitc/inc/zunitc/zunitc.h | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/weston-test-runner.h b/tests/weston-test-runner.h
index b9f966e0..eb9a488a 100644
--- a/tests/weston-test-runner.h
+++ b/tests/weston-test-runner.h
@@ -53,7 +53,7 @@ struct weston_test {
 	static void func(void *);					\
 									\
 	const struct weston_test test##name				\
-		__attribute__ ((section ("test_section"))) =		\
+		__attribute__ ((used, section ("test_section"))) =	\
 	{								\
 		#name, func, data, size, n_elem, ret			\
 	};
diff --git a/tools/zunitc/inc/zunitc/zunitc.h b/tools/zunitc/inc/zunitc/zunitc.h
index 6ac6f391..16b211ba 100644
--- a/tools/zunitc/inc/zunitc/zunitc.h
+++ b/tools/zunitc/inc/zunitc/zunitc.h
@@ -268,7 +268,7 @@ zuc_set_output_junit(bool enable);
 	static void zuctest_##tcase##_##test(void); \
 	\
 	const struct zuc_registration zzz_##tcase##_##test \
-	__attribute__ ((section ("zuc_tsect"))) = \
+	__attribute__ ((used, section ("zuc_tsect"))) = \
 	{ \
 		#tcase, #test, 0,		\
 		zuctest_##tcase##_##test,	\
@@ -298,7 +298,7 @@ zuc_set_output_junit(bool enable);
 	static void zuctest_##tcase##_##test(void *param); \
 	\
 	const struct zuc_registration zzz_##tcase##_##test \
-	__attribute__ ((section ("zuc_tsect"))) = \
+	__attribute__ ((used, section ("zuc_tsect"))) = \
 	{ \
 		#tcase, #test, &tcase,		\
 		0,				\
-- 
2.12.2



More information about the wayland-devel mailing list