build: add Wextra compile option

This patch add -Wextra compile option to RMM build. The
warning for implicit fallthrough is disabled as this is a
pattern used in the code. Couple of warnings triggered by
-Wextra are also fixed as part of the patch.


Change-Id: I7c0b815e5fadd3d45d4c72508df64d77f916d6d3
Signed-off-by: Soby Mathew <soby.mathew@arm.com>
diff --git a/lib/arch/tests/simd_tests.cpp b/lib/arch/tests/simd_tests.cpp
index c50bebd..1a0a68b 100644
--- a/lib/arch/tests/simd_tests.cpp
+++ b/lib/arch/tests/simd_tests.cpp
@@ -34,21 +34,31 @@
 
 static void fpu_save_regs_cb(struct fpu_regs *regs)
 {
+	(void)regs;
+
 	increment_times_called(FPU_SAVE_REGS);
 }
 
 static void sve_save_regs_cb(struct sve_regs *regs, bool save_ffr)
 {
+	(void)regs;
+	(void)save_ffr;
+
 	increment_times_called(SVE_SAVE_REGS);
 }
 
 static void fpu_restore_regs_cb(struct fpu_regs *regs)
 {
+	(void)regs;
+
 	increment_times_called(FPU_RESTORE_REGS);
 }
 
 static void sve_restore_regs_cb(struct sve_regs *regs, bool restore_ffr)
 {
+	(void)regs;
+	(void)restore_ffr;
+
 	increment_times_called(SVE_RESTORE_REGS);
 }
 
@@ -77,7 +87,9 @@
 TEST(simd, simd_init_TC1)
 {
 	int ret;
-	struct simd_config simd_cfg = { 0 };
+	struct simd_config simd_cfg;
+
+	(void)memset(&simd_cfg, 0, sizeof(simd_cfg));
 
 	/******************************************************************
 	 * TEST CASE 1:
@@ -104,9 +116,11 @@
 {
 	u_register_t saved_cptr;
 	int ret;
-	struct simd_config simd_cfg = { 0 };
+	struct simd_config simd_cfg;
 	union simd_cbs cb;
 
+	(void)memset(&simd_cfg, 0, sizeof(simd_cfg));
+
 	/******************************************************************
 	 * TEST CASE 2:
 	 *
@@ -167,7 +181,9 @@
 	u_register_t saved_cptr;
 	int ret1;
 	int ret2;
-	struct simd_config simd_cfg = { 0 };
+	struct simd_config simd_cfg;
+
+	(void)memset(&simd_cfg, 0, sizeof(simd_cfg));
 
 	/******************************************************************
 	 * TEST CASE 3:
@@ -242,7 +258,9 @@
 {
 	int ret;
 	struct simd_context test_simd_ctx;
-	struct simd_config test_simd_cfg = { 0 };
+	struct simd_config test_simd_cfg;
+
+	(void)memset(&test_simd_cfg, 0, sizeof(test_simd_cfg));
 
 	/******************************************************************
 	 * TEST CASE 1:
@@ -261,7 +279,7 @@
 TEST(simd, simd_context_init_TC2)
 {
 	int ret;
-	struct simd_config test_simd_cfg = { 0 };
+	struct simd_config test_simd_cfg;
 	struct simd_context test_simd_ctx;
 
 	/******************************************************************
@@ -271,6 +289,7 @@
 	 * second call to exit early with exit code -1.
 	 ******************************************************************/
 
+	(void)memset(&test_simd_cfg, 0, sizeof(test_simd_cfg));
 	(void)memset(&test_simd_ctx, 0, sizeof(struct simd_context));
 	simd_test_helpers_setup_id_regs(false, false);
 
@@ -292,9 +311,11 @@
 TEST(simd, simd_context_init_TC3)
 {
 	int ret;
-	struct simd_config test_simd_cfg = { 0 };
+	struct simd_config test_simd_cfg;
 	struct simd_context test_simd_ctx;
 
+	(void)memset(&test_simd_cfg, 0, sizeof(test_simd_cfg));
+
 	/******************************************************************
 	 * TEST CASE 3:
 	 *
@@ -321,11 +342,13 @@
 TEST(simd, simd_context_init_TC4)
 {
 	int ret1, ret2;
-	struct simd_config test_simd_cfg = { 0 };
+	struct simd_config test_simd_cfg;
 	struct simd_context test_simd_ctx;
 	struct simd_config cpu_simd_cfg;
 	union simd_cbs cb;
 
+	(void)memset(&test_simd_cfg, 0, sizeof(test_simd_cfg));
+
 	/******************************************************************
 	 * TEST CASE 4:
 	 *
@@ -365,10 +388,12 @@
 TEST(simd, simd_context_init_TC5)
 {
 	int ret;
-	struct simd_config test_simd_cfg = { 0 };
+	struct simd_config test_simd_cfg;
 	struct simd_context test_simd_ctx;
 	union simd_cbs cb;
 
+	(void)memset(&test_simd_cfg, 0, sizeof(test_simd_cfg));
+
 	/******************************************************************
 	 * TEST CASE 5:
 	 *
@@ -402,9 +427,11 @@
 TEST(simd, simd_context_init_TC6)
 {
 	int ret;
-	struct simd_config test_simd_cfg = { 0 };
+	struct simd_config test_simd_cfg;
 	struct simd_context test_simd_ctx;
 
+	(void)memset(&test_simd_cfg, 0, sizeof(test_simd_cfg));
+
 	/******************************************************************
 	 * TEST CASE 6:
 	 *
@@ -431,12 +458,14 @@
 TEST(simd, simd_context_save_TC1)
 {
 	struct simd_context test_simd_ctx;
-	struct simd_config test_simd_cfg = { 0 };
+	struct simd_config test_simd_cfg;
 	u_register_t cptr_el2;
 	int ret;
 	union simd_cbs cb;
 	int times_called_prev;
 
+	(void)memset(&test_simd_cfg, 0, sizeof(test_simd_cfg));
+
 	/******************************************************************
 	 * TEST CASE 1:
 	 *
@@ -494,9 +523,11 @@
 ASSERT_TEST(simd, simd_context_save_TC3)
 {
 	struct simd_context test_simd_ctx;
-	struct simd_config test_simd_cfg = { 0 };
+	struct simd_config test_simd_cfg;
 	int ret;
 
+	(void)memset(&test_simd_cfg, 0, sizeof(test_simd_cfg));
+
 	/******************************************************************
 	 * TEST CASE 3:
 	 *
@@ -524,9 +555,11 @@
 ASSERT_TEST(simd, simd_context_save_TC4)
 {
 	struct simd_context test_simd_ctx;
-	struct simd_config test_simd_cfg = { 0 };
+	struct simd_config test_simd_cfg;
 	int ret;
 
+	(void)memset(&test_simd_cfg, 0, sizeof(test_simd_cfg));
+
 	/******************************************************************
 	 * TEST CASE 4:
 	 *
@@ -578,9 +611,11 @@
 ASSERT_TEST(simd, simd_context_restore_TC2)
 {
 	struct simd_context test_simd_ctx;
-	struct simd_config test_simd_cfg = { 0 };
+	struct simd_config test_simd_cfg;
 	int ret;
 
+	(void)memset(&test_simd_cfg, 0, sizeof(test_simd_cfg));
+
 	/******************************************************************
 	 * TEST CASE 2:
 	 *
@@ -608,9 +643,11 @@
 ASSERT_TEST(simd, simd_context_restore_TC3)
 {
 	struct simd_context test_simd_ctx;
-	struct simd_config test_simd_cfg = { 0 };
+	struct simd_config test_simd_cfg;
 	int ret;
 
+	(void)memset(&test_simd_cfg, 0, sizeof(test_simd_cfg));
+
 	/******************************************************************
 	 * TEST CASE 3:
 	 *
@@ -639,9 +676,11 @@
 ASSERT_TEST(simd, simd_context_restore_TC4)
 {
 	struct simd_context test_simd_ctx;
-	struct simd_config test_simd_cfg = { 0 };
+	struct simd_config test_simd_cfg;
 	int ret;
 
+	(void)memset(&test_simd_cfg, 0, sizeof(test_simd_cfg));
+
 	/******************************************************************
 	 * TEST CASE 4:
 	 *
@@ -678,11 +717,13 @@
 {
 	struct simd_context simd_ctx_nwd;
 	struct simd_context simd_ctx_rl;
-	struct simd_config test_simd_cfg = { 0 };
+	struct simd_config test_simd_cfg;
 	union simd_cbs cb_save;
 	union simd_cbs cb_restore;
 	int ret1, ret2;
 
+	(void)memset(&test_simd_cfg, 0, sizeof(test_simd_cfg));
+
 	/******************************************************************
 	 * TEST CASE 1:
 	 *
@@ -740,11 +781,13 @@
 {
 	struct simd_context simd_ctx_nwd;
 	struct simd_context simd_ctx_rl;
-	struct simd_config test_simd_cfg = { 0 };
+	struct simd_config test_simd_cfg;
 	union simd_cbs cb_save;
 	union simd_cbs cb_restore;
 	int ret;
 
+	(void)memset(&test_simd_cfg, 0, sizeof(test_simd_cfg));
+
 	/******************************************************************
 	 * TEST CASE 2:
 	 *
@@ -871,11 +914,13 @@
 {
 	struct simd_context simd_ctx_nwd;
 	struct simd_context simd_ctx_rl;
-	struct simd_config test_simd_cfg = { 0 };
+	struct simd_config test_simd_cfg;
 	union simd_cbs cb_save;
 	union simd_cbs cb_restore;
 	int ret;
 
+	(void)memset(&test_simd_cfg, 0, sizeof(test_simd_cfg));
+
 	/******************************************************************
 	 * TEST CASE 4:
 	 *
@@ -935,11 +980,13 @@
 {
 	struct simd_context simd_ctx_nwd;
 	struct simd_context simd_ctx_rl;
-	struct simd_config test_simd_cfg = { 0 };
+	struct simd_config test_simd_cfg;
 	union simd_cbs cb_save;
 	union simd_cbs cb_restore;
 	int ret;
 
+	(void)memset(&test_simd_cfg, 0, sizeof(test_simd_cfg));
+
 	/******************************************************************
 	 * TEST CASE 5:
 	 *
@@ -1008,11 +1055,13 @@
 {
 	struct simd_context simd_ctx_nwd;
 	struct simd_context simd_ctx_rl;
-	struct simd_config test_simd_cfg = { 0 };
+	struct simd_config test_simd_cfg;
 	union simd_cbs cb_save;
 	union simd_cbs cb_restore;
 	int ret1, ret2;
 
+	(void)memset(&test_simd_cfg, 0, sizeof(test_simd_cfg));
+
 	/******************************************************************
 	 * TEST CASE 6:
 	 *
@@ -1069,11 +1118,13 @@
 {
 	struct simd_context simd_ctx_nwd;
 	struct simd_context simd_ctx_rl;
-	struct simd_config test_simd_cfg = { 0 };
+	struct simd_config test_simd_cfg;
 	union simd_cbs cb_save;
 	union simd_cbs cb_restore;
 	int ret;
 
+	(void)memset(&test_simd_cfg, 0, sizeof(test_simd_cfg));
+
 	/******************************************************************
 	 * TEST CASE 7:
 	 *
@@ -1136,7 +1187,7 @@
 {
 	struct simd_context simd_ctx_nwd;
 	struct simd_context simd_ctx_rl;
-	struct simd_config test_simd_cfg = { 0 };
+	struct simd_config test_simd_cfg;
 	union simd_cbs cb_fpu_save;
 	union simd_cbs cb_fpu_restore;
 	union simd_cbs cb_sve_save;
@@ -1144,6 +1195,8 @@
 	union simd_cbs cb_sve_clear_p_ffr;
 	int ret;
 
+	(void)memset(&test_simd_cfg, 0, sizeof(test_simd_cfg));
+
 	/******************************************************************
 	 * TEST CASE 8:
 	 *
@@ -1226,7 +1279,7 @@
 {
 	struct simd_context simd_ctx_nwd;
 	struct simd_context simd_ctx_rl;
-	struct simd_config test_simd_cfg = { 0 };
+	struct simd_config test_simd_cfg;
 	union simd_cbs cb_fpu_save;
 	union simd_cbs cb_fpu_restore;
 	union simd_cbs cb_sve_save;
@@ -1234,6 +1287,8 @@
 	union simd_cbs cb_sve_clear_p_ffr;
 	int ret1, ret2;
 
+	(void)memset(&test_simd_cfg, 0, sizeof(test_simd_cfg));
+
 	/******************************************************************
 	 * TEST CASE 9:
 	 *
@@ -1312,12 +1367,14 @@
 {
 	struct simd_context simd_ctx_nwd;
 	struct simd_context simd_ctx_rl;
-	struct simd_config test_simd_cfg = { 0 };
+	struct simd_config test_simd_cfg;
 	union simd_cbs cb_save;
 	union simd_cbs cb_restore;
 	union simd_cbs cb_sve_clear_p_ffr;
 	int ret1, ret2;
 
+	(void)memset(&test_simd_cfg, 0, sizeof(test_simd_cfg));
+
 	/******************************************************************
 	 * TEST CASE 1:
 	 *
diff --git a/lib/granule/include/granule.h b/lib/granule/include/granule.h
index ee6aa58..75f2eb9 100644
--- a/lib/granule/include/granule.h
+++ b/lib/granule/include/granule.h
@@ -71,6 +71,8 @@
 static inline void __granule_assert_unlocked_invariants(struct granule *g,
 							unsigned char state)
 {
+	(void)g;
+
 	switch (state) {
 	case GRANULE_STATE_NS:
 		assert(REFCOUNT(g) == 0U);
diff --git a/lib/rmm_el3_ifc/src/rmm_el3_runtime.c b/lib/rmm_el3_ifc/src/rmm_el3_runtime.c
index 6d1c454..2379ec8 100644
--- a/lib/rmm_el3_ifc/src/rmm_el3_runtime.c
+++ b/lib/rmm_el3_ifc/src/rmm_el3_runtime.c
@@ -62,6 +62,8 @@
 	unsigned long buffer_pa;
 	unsigned long offset = buf - rmm_shared_buffer_start_va;
 
+	(void)buflen;
+
 	assert((offset + buflen) <= rmm_el3_ifc_get_shared_buf_size());
 	assert((buf & ~PAGE_SIZE_MASK) == rmm_shared_buffer_start_va);
 
diff --git a/lib/s2tt/tests/s2tt_tests_base_g1.cpp b/lib/s2tt/tests/s2tt_tests_base_g1.cpp
index e9f3715..3104f39 100644
--- a/lib/s2tt/tests/s2tt_tests_base_g1.cpp
+++ b/lib/s2tt/tests/s2tt_tests_base_g1.cpp
@@ -109,7 +109,9 @@
 
 		unsigned long pa = s2tt_test_helpers_gen_addr(i, true);
 		unsigned long tte;
-		s2tt_context s2tt_ctx = { 0UL };
+		s2tt_context s2tt_ctx;
+
+		(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 		/*
 		 * Generate an s2tt context to be used for the test.
@@ -154,7 +156,9 @@
 			(unsigned long)s2tt_test_helpers_min_block_lvl(),
 			(unsigned long)S2TT_TEST_HELPERS_MAX_LVL);
 	unsigned long pa = s2tt_test_helpers_gen_addr(level, true);
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	pa += test_helpers_get_rand_in_range(1UL, (unsigned long)GRANULE_SIZE - 1UL);
 
@@ -182,7 +186,9 @@
 
 	long level = s2tt_test_helpers_min_block_lvl() - 1;
 	unsigned long pa = 0UL; /* Valid for any level */
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test.
@@ -208,7 +214,9 @@
 
 	long level = S2TT_TEST_HELPERS_MAX_LVL + 1;
 	unsigned long pa = 0UL; /* Valid for any level */
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test.
@@ -256,7 +264,9 @@
 
 		unsigned long pa = s2tt_test_helpers_gen_addr(i, true);
 		unsigned long tte;
-		s2tt_context s2tt_ctx = { 0UL };
+		s2tt_context s2tt_ctx;
+
+		(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 		/*
 		 * Generate an s2tt context to be used for the test.
@@ -301,7 +311,9 @@
 			(unsigned long)s2tt_test_helpers_min_block_lvl(),
 			(unsigned long)S2TT_TEST_HELPERS_MAX_LVL);
 	unsigned long pa = s2tt_test_helpers_gen_addr(level, true);
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	pa += test_helpers_get_rand_in_range(1UL, (unsigned long)GRANULE_SIZE - 1UL);
 
@@ -329,7 +341,9 @@
 
 	long level = s2tt_test_helpers_min_block_lvl() - 1;
 	unsigned long pa = 0UL; /* Valid for any level */
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test.
@@ -355,7 +369,9 @@
 
 	long level = S2TT_TEST_HELPERS_MAX_LVL + 1;
 	unsigned long pa = 0UL; /* Valid for any level */
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test.
@@ -397,7 +413,9 @@
 	 * verify that it is valid.
 	 ***************************************************************/
 
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test.
@@ -446,7 +464,9 @@
 			(unsigned long)S2TT_TEST_HELPERS_MAX_LVL);
 	unsigned long pa = s2tt_test_helpers_gen_addr(level, true);
 
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test.
@@ -474,7 +494,9 @@
 
 	long level = s2tt_test_helpers_min_block_lvl() - 1;
 	unsigned long pa = 0UL; /* Valid for any level */
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test.
@@ -500,7 +522,9 @@
 
 	long level = S2TT_TEST_HELPERS_MAX_LVL + 1;
 	unsigned long pa = 0UL; /* Valid for any level */
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test.
@@ -550,7 +574,9 @@
 									  false);
 		unsigned long attrs = s2tt_test_helpers_gen_ns_attrs(false,
 								     false);
-		struct s2tt_context s2tt_ctx = { 0UL };
+		struct s2tt_context s2tt_ctx;
+
+		(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 		/*
 		 * Initialize an s2tt_context structure for the test.
@@ -641,7 +667,9 @@
 	 * correct.
 	 ***************************************************************/
 
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test.
@@ -717,7 +745,9 @@
 					RIPAS_EMPTY,
 					RIPAS_DESTROYED);
 	unsigned long pa = s2tt_test_helpers_gen_addr(level, true);
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test.
@@ -748,7 +778,9 @@
 					RIPAS_EMPTY,
 					RIPAS_DESTROYED);
 	unsigned long pa = 0UL; /* Valid for any level */
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test.
@@ -777,7 +809,9 @@
 					RIPAS_EMPTY,
 					RIPAS_DESTROYED);
 	unsigned long pa = 0UL; /* Valid for any level */
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test.
@@ -807,7 +841,9 @@
 	unsigned long ripas = INPLACE(S2TTE_INVALID_RIPAS,
 						S2TT_TEST_RIPAS_INVALID);
 	unsigned long pa = 0UL; /* Valid for any level */
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test.
@@ -854,7 +890,9 @@
 	 * a table tte.
 	 ***************************************************************/
 
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test.
@@ -898,7 +936,9 @@
 			(unsigned long)s2tt_test_helpers_min_block_lvl(),
 			(unsigned long)S2TT_TEST_HELPERS_MAX_LVL);
 	unsigned long pa = s2tt_test_helpers_gen_addr(level, true);
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test.
@@ -925,7 +965,9 @@
 
 	long level = s2tt_test_helpers_min_table_lvl() - 1;
 	unsigned long pa = 0UL; /* Valid for any level */
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test.
@@ -950,7 +992,9 @@
 
 	long level = S2TT_TEST_HELPERS_MAX_LVL;
 	unsigned long pa = 0UL; /* Valid for any level */
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test.
@@ -990,8 +1034,9 @@
 	 * For all valid levels, generate a random ns_s2tte and pass it
 	 * to host_ns_s2tte_is_valid() to validate its behaviour.
 	 ***************************************************************/
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
 
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Initialize an s2tt_context structure for the test.
@@ -1024,8 +1069,9 @@
 	 * and pass them to host_ns_s2tte_is_valid() to validate its
 	 * behaviour.
 	 ***************************************************************/
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
 
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Initialize an s2tt_context structure for the test.
@@ -1076,7 +1122,9 @@
 	 * level.
 	 ***************************************************************/
 
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Initialize an s2tt_context structure for the test.
@@ -1109,7 +1157,9 @@
 	 * level.
 	 ***************************************************************/
 
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Initialize an s2tt_context structure for the test.
@@ -1160,7 +1210,10 @@
 	 * when LPA2 is disabled
 	 **************************************************************/
 
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
+
 	unsigned long host_attrs;
 	unsigned long tte;
 	long level = s2tt_test_helpers_min_block_lvl();
@@ -1192,7 +1245,9 @@
 	 * has been set by the host.
 	 ***************************************************************/
 
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Initialize an s2tt_context structure for the test.
@@ -1236,7 +1291,9 @@
 	 * below the minimum supported.
 	 ***************************************************************/
 
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Initialize an s2tt_context structure for the test.
@@ -1278,7 +1335,9 @@
 	 * above the maximum supported.
 	 ***************************************************************/
 
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate the tte with an assumed PA == 0, which is aligned to
@@ -1317,7 +1376,9 @@
 	unsigned long pa = s2tt_test_helpers_gen_addr(level, true);
 	unsigned long host_attrs = s2tt_test_helpers_gen_ns_attrs(true, false);
 
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Initialize an s2tt_context structure for the test.
@@ -1348,7 +1409,9 @@
 	unsigned long ripas[] = {S2TTE_INVALID_RIPAS_EMPTY,
 				 S2TTE_INVALID_RIPAS_RAM,
 				 S2TTE_INVALID_RIPAS_DESTROYED};
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Initialize an s2tt_context structure for the test.
@@ -1399,7 +1462,9 @@
 	 ***************************************************************/
 
 	unsigned long tte;
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Initialize an s2tt_context structure for the test.
@@ -1634,7 +1699,9 @@
 	unsigned long ripas[] = {S2TTE_NS,
 				 S2TTE_INVALID_RIPAS_RAM,
 				 S2TTE_INVALID_RIPAS_DESTROYED};
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Initialize an s2tt_context structure for the test.
@@ -1689,7 +1756,10 @@
 	unsigned long ripas[] = {S2TTE_INVALID_RIPAS_EMPTY,
 				 S2TTE_INVALID_RIPAS_RAM,
 				 S2TTE_INVALID_RIPAS_DESTROYED};
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
+
 	/*
 	 * Initialize an s2tt_context structure for the test.
 	 * Only 'enable_lpa2' is used by the API, so the rest of fields
@@ -1743,7 +1813,9 @@
 	unsigned long pa = 0UL;
 	unsigned long tte = s2tt_test_helpers_gen_ns_attrs(true, false);
 	long level = s2tt_test_helpers_min_block_lvl();
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Initialize an s2tt_context structure for the test.
@@ -1776,7 +1848,9 @@
 	unsigned long ripas[] = {S2TTE_NS,
 				 S2TTE_INVALID_RIPAS_EMPTY,
 				 S2TTE_INVALID_RIPAS_DESTROYED};
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Initialize an s2tt_context structure for the test.
@@ -1827,7 +1901,9 @@
 	 ***************************************************************/
 	unsigned long pa = 0UL;
 	unsigned long tte;
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Initialize an s2tt_context structure for the test.
@@ -1859,7 +1935,9 @@
 	unsigned long ripas[] = {S2TTE_NS,
 				 S2TTE_INVALID_RIPAS_RAM,
 				 S2TTE_INVALID_RIPAS_EMPTY};
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Initialize an s2tt_context structure for the test.
@@ -1911,7 +1989,9 @@
 	 * as a number of negative tests for each valid level.
 	 ***************************************************************/
 
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Initialize an s2tt_context structure for the test.
@@ -1971,7 +2051,9 @@
 	unsigned long ripas[] = {S2TTE_INVALID_RIPAS_EMPTY,
 				 S2TTE_INVALID_RIPAS_RAM,
 				 S2TTE_INVALID_RIPAS_DESTROYED};
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Initialize an s2tt_context structure for the test.
@@ -2217,7 +2299,9 @@
 	 * S2TTEs and validate its contents.
 	 ***************************************************************/
 
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test. Only
@@ -2261,7 +2345,9 @@
 	unsigned long s2tt[S2TTES_PER_S2TT] = {0};
 	long level = S2TT_TEST_HELPERS_MAX_LVL + 1;
 	unsigned long pa = 0UL; /* Valid for any level */
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test. Only
@@ -2287,7 +2373,9 @@
 	unsigned long s2tt[S2TTES_PER_S2TT] = {0};
 	long level = s2tt_test_helpers_min_block_lvl() - 1L;
 	unsigned long pa = 0UL; /* Valid for any level */
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test. Only
@@ -2311,7 +2399,9 @@
 
 	long level = s2tt_test_helpers_min_block_lvl();
 	unsigned long pa = 0UL; /* Valid for any level */
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test. Only
@@ -2339,7 +2429,9 @@
 					       S2TT_TEST_HELPERS_MAX_LVL);
 	unsigned long pa = s2tt_test_helpers_gen_addr(level, true) +
 		test_helpers_get_rand_in_range(1UL, (unsigned long)GRANULE_SIZE - 1UL);
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test. Only
@@ -2380,7 +2472,9 @@
 	 * S2TTEs and validate its contents.
 	 ***************************************************************/
 
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test. Only
@@ -2424,7 +2518,9 @@
 	unsigned long s2tt[S2TTES_PER_S2TT] = {0};
 	long level = S2TT_TEST_HELPERS_MAX_LVL + 1;
 	unsigned long pa = 0UL; /* Valid for any level */
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test. Only
@@ -2450,7 +2546,9 @@
 	unsigned long s2tt[S2TTES_PER_S2TT] = {0};
 	long level = s2tt_test_helpers_min_block_lvl() - 1L;
 	unsigned long pa = 0UL; /* Valid for any level */
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test. Only
@@ -2474,7 +2572,9 @@
 
 	long level = s2tt_test_helpers_min_block_lvl();
 	unsigned long pa = 0UL; /* Valid for any level */
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test. Only
@@ -2502,7 +2602,9 @@
 					       S2TT_TEST_HELPERS_MAX_LVL);
 	unsigned long pa = s2tt_test_helpers_gen_addr(level, true) +
 		test_helpers_get_rand_in_range(1UL, (unsigned long)GRANULE_SIZE - 1UL);
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test. Only
@@ -2544,7 +2646,9 @@
 	 * S2TTEs and validate its contents.
 	 ***************************************************************/
 
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test. Only
@@ -2700,7 +2804,9 @@
 	 * For each valid level, initialize a table with
 	 * assigned-destroyed S2TTEs and validate its contents.
 	 ***************************************************************/
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test. Only
@@ -2745,7 +2851,9 @@
 	unsigned long s2tt[S2TTES_PER_S2TT] = {0};
 	long level = S2TT_TEST_HELPERS_MAX_LVL + 1;
 	unsigned long pa = 0UL; /* Valid for any level */
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test. Only
@@ -2771,7 +2879,9 @@
 	unsigned long s2tt[S2TTES_PER_S2TT] = {0};
 	long level = s2tt_test_helpers_min_block_lvl() - 1L;
 	unsigned long pa = 0UL; /* Valid for any level */
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test. Only
@@ -2796,7 +2906,9 @@
 
 	long level = s2tt_test_helpers_min_block_lvl();
 	unsigned long pa = 0UL; /* Valid for any level */
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test. Only
@@ -2825,7 +2937,9 @@
 					       S2TT_TEST_HELPERS_MAX_LVL);
 	unsigned long pa = s2tt_test_helpers_gen_addr(level, true) +
 		test_helpers_get_rand_in_range(1UL, (unsigned long)GRANULE_SIZE - 1UL);
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test. Only
@@ -2870,7 +2984,9 @@
 	unsigned long ripas[] = {S2TTE_INVALID_RIPAS_EMPTY,
 				 S2TTE_INVALID_RIPAS_RAM,
 				 S2TTE_INVALID_RIPAS_DESTROYED};
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test. Only
@@ -2923,7 +3039,9 @@
 	long level = test_helpers_get_rand_in_range(
 			s2tt_test_helpers_min_block_lvl(),
 			S2TT_TEST_HELPERS_MAX_LVL);
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test. Only
@@ -2957,7 +3075,9 @@
 
 	long level = S2TT_TEST_HELPERS_MAX_LVL;
 	unsigned long pa = 0UL; /* Valid for any level */
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test. Only
@@ -2992,7 +3112,9 @@
 
 	long level = S2TT_TEST_HELPERS_MAX_LVL;
 	unsigned long pa = 0UL; /* Valid for any level */
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test. Only
@@ -3027,7 +3149,9 @@
 
 	long level = s2tt_test_helpers_min_block_lvl();
 	unsigned long pa = 0UL; /* Valid for any level */
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test. Only
diff --git a/lib/s2tt/tests/s2tt_tests_base_g2.cpp b/lib/s2tt/tests/s2tt_tests_base_g2.cpp
index c942657..1d62005 100644
--- a/lib/s2tt/tests/s2tt_tests_base_g2.cpp
+++ b/lib/s2tt/tests/s2tt_tests_base_g2.cpp
@@ -33,7 +33,9 @@
 	 * validate that add_is_level_aligned() returns the right
 	 * result.
 	 ***************************************************************/
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test. Only
@@ -60,7 +62,9 @@
 	 * PA and validate that add_is_level_aligned() returns the
 	 * right result.
 	 ***************************************************************/
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test. Only
@@ -91,7 +95,9 @@
 
 	long level = S2TT_TEST_HELPERS_MAX_LVL + 1L;
 	unsigned long pa = 0UL; /* Aligned to any level */
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test. Only
@@ -116,7 +122,9 @@
 
 	long level = s2tt_test_helpers_min_table_lvl() - 1L;
 	unsigned long pa = 0UL; /* Aligned to any level */
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test. Only
@@ -176,7 +184,10 @@
 	 * implementation.
 	 **************************************************************/
 
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
+
 	unsigned long ipa = s2tt_test_helpers_gen_addr(S2TT_TEST_HELPERS_MAX_LVL, true);
 
 	s2tt_ctx.vmid = (unsigned int)test_helpers_get_rand_in_range(
@@ -212,7 +223,10 @@
 	 * implementation.
 	 ***************************************************************/
 
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
+
 	unsigned long ipa;
 
 	for (unsigned int level = S2TT_MIN_BLOCK_LEVEL;
@@ -253,7 +267,10 @@
 	 * implementation.
 	 ***************************************************************/
 
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
+
 	unsigned long ipa = s2tt_test_helpers_gen_addr(S2TT_TEST_HELPERS_MAX_LVL, true);
 
 	s2tt_ctx.vmid = (unsigned int)test_helpers_get_rand_in_range(
@@ -341,7 +358,10 @@
 	unsigned long s2tt[S2TTES_PER_S2TT];
 	unsigned int tte_idx = (unsigned int)test_helpers_get_rand_in_range(0UL,
 					     S2TTES_PER_S2TT - 1UL);
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
+
 	unsigned int idx;
 
 	assert(type <= S2TTE_INVALID_NS_INDEX);
@@ -575,7 +595,9 @@
 	 * the expected value
 	 ***************************************************************/
 
-	s2tt_context s2tt_ctx = { 0UL };
+	s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test.
@@ -618,7 +640,9 @@
 	unsigned long assigned_ripas[] = {S2TTE_INVALID_RIPAS_RAM,
 					  S2TTE_NS,
 					  S2TTE_INVALID_RIPAS_DESTROYED};
-	s2tt_context s2tt_ctx = { 0UL };
+	s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test.
@@ -678,7 +702,9 @@
 	long level = s2tt_test_helpers_min_block_lvl();
 	unsigned long s2tt[S2TTES_PER_S2TT];
 	unsigned long pa;
-	s2tt_context s2tt_ctx = { 0UL };
+	s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test.
@@ -712,7 +738,9 @@
 	 ***************************************************************/
 
 	long level = s2tt_test_helpers_min_block_lvl();
-	s2tt_context s2tt_ctx = { 0UL };
+	s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test.
@@ -740,7 +768,9 @@
 	long level = S2TT_TEST_HELPERS_MAX_LVL;
 	unsigned long s2tt[S2TTES_PER_S2TT];
 	unsigned long pa = s2tt_test_helpers_gen_addr(level - 1L, true);
-	s2tt_context s2tt_ctx = { 0UL };
+	s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test.
@@ -772,7 +802,9 @@
 	long level = s2tt_test_helpers_min_block_lvl();
 	unsigned long s2tt[S2TTES_PER_S2TT];
 	unsigned long pa = s2tt_test_helpers_gen_addr(level - 1L, true);
-	s2tt_context s2tt_ctx = { 0UL };
+	s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test.
@@ -805,7 +837,9 @@
 	long level = s2tt_test_helpers_min_block_lvl();
 	unsigned long s2tt[S2TTES_PER_S2TT];
 	unsigned long pa = s2tt_test_helpers_gen_addr(level - 1L, true);
-	s2tt_context s2tt_ctx = { 0UL };
+	s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test.
@@ -835,7 +869,9 @@
 	 * the expected value
 	 ***************************************************************/
 
-	s2tt_context s2tt_ctx = { 0UL };
+	s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test.
@@ -878,7 +914,9 @@
 	unsigned long assigned_ripas[] = {S2TTE_INVALID_RIPAS_EMPTY,
 					  S2TTE_NS,
 					  S2TTE_INVALID_RIPAS_DESTROYED};
-	s2tt_context s2tt_ctx = { 0UL };
+	s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test.
@@ -938,7 +976,9 @@
 	long level = s2tt_test_helpers_min_block_lvl();
 	unsigned long s2tt[S2TTES_PER_S2TT];
 	unsigned long pa;
-	s2tt_context s2tt_ctx = { 0UL };
+	s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test.
@@ -972,7 +1012,9 @@
 	 ***************************************************************/
 
 	long level = s2tt_test_helpers_min_block_lvl();
-	s2tt_context s2tt_ctx = { 0UL };
+	s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test.
@@ -999,7 +1041,9 @@
 	long level = S2TT_TEST_HELPERS_MAX_LVL;
 	unsigned long s2tt[S2TTES_PER_S2TT];
 	unsigned long pa = s2tt_test_helpers_gen_addr(level - 1L, true);
-	s2tt_context s2tt_ctx = { 0UL };
+	s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test.
@@ -1031,7 +1075,9 @@
 	long level = s2tt_test_helpers_min_block_lvl();
 	unsigned long s2tt[S2TTES_PER_S2TT];
 	unsigned long pa = s2tt_test_helpers_gen_addr(level - 1L, true);
-	s2tt_context s2tt_ctx = { 0UL };
+	s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test.
@@ -1063,7 +1109,9 @@
 	long level = s2tt_test_helpers_min_block_lvl();
 	unsigned long s2tt[S2TTES_PER_S2TT];
 	unsigned long pa = s2tt_test_helpers_gen_addr(level - 1L, true);
-	s2tt_context s2tt_ctx = { 0UL };
+	s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test.
@@ -1092,7 +1140,9 @@
 	 * the expected value
 	 ***************************************************************/
 
-	s2tt_context s2tt_ctx = { 0UL };
+	s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test.
@@ -1130,7 +1180,9 @@
 	 * the expected value.
 	 ***************************************************************/
 
-	s2tt_context s2tt_ctx = { 0UL };
+	s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test.
@@ -1189,7 +1241,9 @@
 					  S2TTE_INVALID_RIPAS_DESTROYED};
 
 	unsigned long attrs = s2tt_test_helpers_gen_ns_attrs(true, false);
-	s2tt_context s2tt_ctx = { 0UL };
+	s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test.
@@ -1250,7 +1304,9 @@
 	unsigned long s2tt[S2TTES_PER_S2TT];
 	unsigned long attrs = s2tt_test_helpers_gen_ns_attrs(true, false);
 	unsigned long pa;
-	s2tt_context s2tt_ctx = { 0UL };
+	s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test.
@@ -1285,7 +1341,9 @@
 	 ***************************************************************/
 
 	long level = s2tt_test_helpers_min_block_lvl();
-	s2tt_context s2tt_ctx = { 0UL };
+	s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test.
@@ -1313,7 +1371,9 @@
 	unsigned long s2tt[S2TTES_PER_S2TT];
 	unsigned long pa = s2tt_test_helpers_gen_addr(level - 1L, true);
 	unsigned long attrs = s2tt_test_helpers_gen_ns_attrs(true, false);
-	s2tt_context s2tt_ctx = { 0UL };
+	s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test.
@@ -1345,7 +1405,9 @@
 	unsigned long s2tt[S2TTES_PER_S2TT];
 	unsigned long pa = s2tt_test_helpers_gen_addr(level - 1L, true);
 	unsigned long attrs = s2tt_test_helpers_gen_ns_attrs(true, false);
-	s2tt_context s2tt_ctx = { 0UL };
+	s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test.
@@ -1378,7 +1440,9 @@
 	unsigned long s2tt[S2TTES_PER_S2TT];
 	unsigned long pa = s2tt_test_helpers_gen_addr(level - 1L, true);
 	unsigned long attrs = s2tt_test_helpers_gen_ns_attrs(true, false);
-	s2tt_context s2tt_ctx = { 0UL };
+	s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test.
@@ -1407,7 +1471,9 @@
 	 * the expected value
 	 ***************************************************************/
 
-	s2tt_context s2tt_ctx = { 0UL };
+	s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test.
@@ -1451,7 +1517,9 @@
 	unsigned long assigned_ripas[] = {S2TTE_INVALID_RIPAS_EMPTY,
 					  S2TTE_NS,
 					  S2TTE_INVALID_RIPAS_RAM};
-	s2tt_context s2tt_ctx = { 0UL };
+	s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test.
@@ -1512,7 +1580,9 @@
 	long level = s2tt_test_helpers_min_block_lvl();
 	unsigned long s2tt[S2TTES_PER_S2TT];
 	unsigned long pa;
-	s2tt_context s2tt_ctx = { 0UL };
+	s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test.
@@ -1546,7 +1616,9 @@
 	 ***************************************************************/
 
 	long level = s2tt_test_helpers_min_block_lvl();
-	s2tt_context s2tt_ctx = { 0UL };
+	s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test.
@@ -1574,7 +1646,9 @@
 	long level = S2TT_TEST_HELPERS_MAX_LVL;
 	unsigned long s2tt[S2TTES_PER_S2TT];
 	unsigned long pa = s2tt_test_helpers_gen_addr(level - 1L, true);
-	s2tt_context s2tt_ctx = { 0UL };
+	s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test.
@@ -1606,7 +1680,9 @@
 	long level = s2tt_test_helpers_min_block_lvl();
 	unsigned long s2tt[S2TTES_PER_S2TT];
 	unsigned long pa = s2tt_test_helpers_gen_addr(level - 1L, true);
-	s2tt_context s2tt_ctx = { 0UL };
+	s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test.
@@ -1639,7 +1715,9 @@
 	long level = s2tt_test_helpers_min_block_lvl();
 	unsigned long s2tt[S2TTES_PER_S2TT];
 	unsigned long pa = s2tt_test_helpers_gen_addr(level - 1L, true);
-	s2tt_context s2tt_ctx = { 0UL };
+	s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test.
@@ -1782,7 +1860,9 @@
 		s2tt_init_unassigned_ram,
 		s2tt_init_unassigned_destroyed
 	};
-	s2tt_context s2tt_ctx = { 0UL };
+	s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test.
@@ -1880,7 +1960,10 @@
 	 * Call s2tt_skip_non_live_entries() with a NULL s2tt pointer.
 	 ***************************************************************/
 
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
+
 	struct s2tt_walk wi = {
 		NULL,  /* Not needed */
 		0UL,
@@ -1908,7 +1991,9 @@
 	 ***************************************************************/
 
 	unsigned long s2tt[S2TTES_PER_S2TT];
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/*
 	 * Generate an s2tt context to be used for the test. Only
@@ -1932,7 +2017,10 @@
 	 ***************************************************************/
 
 	unsigned long s2tt[S2TTES_PER_S2TT];
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
+
 	struct s2tt_walk wi = {
 		NULL,  /* Not needed */
 		0UL,
@@ -1959,7 +2047,10 @@
 	 ***************************************************************/
 
 	unsigned long s2tt[S2TTES_PER_S2TT];
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
+
 	struct s2tt_walk wi = {
 		NULL,  /* Not needed */
 		0UL,
@@ -1986,7 +2077,10 @@
 	 ***************************************************************/
 
 	unsigned long s2tt[S2TTES_PER_S2TT];
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
+
 	struct s2tt_walk wi = {
 		NULL,  /* Not needed */
 		S2TTES_PER_S2TT + 1UL,
@@ -2240,7 +2334,9 @@
 	unsigned long tt_walk[end_level - S2TT_TEST_HELPERS_MIN_LVL_LPA2 + 1U];
 	struct s2tt_walk wi;
 	struct granule *val_tt_granule;
-	struct s2tt_context s2tt_ctx = { 0UL };
+	struct s2tt_context s2tt_ctx;
+
+	(void)memset(&s2tt_ctx, 0, sizeof(s2tt_ctx));
 
 	/* Total number of granules, included the concatenated ones */
 	const unsigned int granules = S2TTE_MAX_CONCAT_TABLES +
diff --git a/lib/xlat/tests/xlat_tests_base_g2.cpp b/lib/xlat/tests/xlat_tests_base_g2.cpp
index 1beb2f9..0a89ea3 100644
--- a/lib/xlat/tests/xlat_tests_base_g2.cpp
+++ b/lib/xlat/tests/xlat_tests_base_g2.cpp
@@ -136,6 +136,8 @@
 	uint64_t mmap_start_va = start_va;
 	unsigned int max_table_entries = XLAT_GET_TABLE_ENTRIES(first_lvl);
 
+	(void)mmap_size;
+
 	assert(mmap_size >= 3U);
 	assert(last_lvl > XLAT_TEST_MIN_LVL());
 	assert(last_lvl <= XLAT_TABLE_LEVEL_MAX);
diff --git a/plat/host/common/src/host_console.c b/plat/host/common/src/host_console.c
index f9390d7..8d39fb3 100644
--- a/plat/host/common/src/host_console.c
+++ b/plat/host/common/src/host_console.c
@@ -12,6 +12,8 @@
 /* Serial output - called from console driver */
 static int host_csl_putc(int c, const struct console *csl)
 {
+	(void)csl;
+
 	assert(csl != NULL);
 	return putchar(c);
 }
diff --git a/runtime/rsi/host_call.c b/runtime/rsi/host_call.c
index 53ebc73..13449a4 100644
--- a/runtime/rsi/host_call.c
+++ b/runtime/rsi/host_call.c
@@ -133,9 +133,11 @@
 struct rsi_walk_result complete_rsi_host_call(struct rec *rec,
 					      struct rmi_rec_enter *rec_enter)
 {
-	struct rsi_result res = { (enum rsi_action)0U };
+	struct rsi_result res;
 	struct rsi_walk_result walk_res = { false, 0UL };
 
+	(void)memset(&res, 0, sizeof(res));
+
 	/*
 	 * Do the necessary to walk the S2 RTTs and copy args from NS Host
 	 * to the host call data structure. But it is possible for the
diff --git a/toolchains/common.cmake b/toolchains/common.cmake
index fe2f19c..0d6d55f 100644
--- a/toolchains/common.cmake
+++ b/toolchains/common.cmake
@@ -15,6 +15,7 @@
     string(APPEND CMAKE_${language}_FLAGS_INIT "-ffunction-sections ")
     string(APPEND CMAKE_${language}_FLAGS_INIT "-fdata-sections ")
     string(APPEND CMAKE_${language}_FLAGS_INIT "-Wall -Werror -Wstrict-overflow ")
+    string(APPEND CMAKE_${language}_FLAGS_INIT "-Wextra -Wno-implicit-fallthrough ")
     string(APPEND CMAKE_${language}_FLAGS_INIT "-gdwarf-4 ")
     string(APPEND CMAKE_${language}_FLAGS_INIT "-D_FORTIFY_SOURCE=2 ")
     string(APPEND CMAKE_${language}_FLAGS_DEBUG_INIT "-Og -Wnull-dereference ")