Use -Wall compiler warning level

Sets the C and C++ compiler warning level to -Wall. Fixes for
warnings judged to be non-functional are included in this commit.

Signed-off-by: Julian Hall <julian.hall@arm.com>
Change-Id: I783ff274b7fbd802bc25074953e2c2f287114605
diff --git a/components/service/smm_variable/backend/variable_checker.c b/components/service/smm_variable/backend/variable_checker.c
index 81a41d0..81a6cc6 100644
--- a/components/service/smm_variable/backend/variable_checker.c
+++ b/components/service/smm_variable/backend/variable_checker.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021, Arm Limited. All rights reserved.
+ * Copyright (c) 2021-2022, Arm Limited. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  *
@@ -53,6 +53,8 @@
 	uint32_t attributes,
 	size_t data_size)
 {
+	(void)attributes;
+
 	if (constraints->property & VAR_CHECK_VARIABLE_PROPERTY_READ_ONLY)
 		return EFI_WRITE_PROTECTED;
 
diff --git a/components/service/smm_variable/backend/variable_index.c b/components/service/smm_variable/backend/variable_index.c
index 4abb718..68e4c89 100644
--- a/components/service/smm_variable/backend/variable_index.c
+++ b/components/service/smm_variable/backend/variable_index.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021, Arm Limited. All rights reserved.
+ * Copyright (c) 2021-2022, Arm Limited. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  *
@@ -29,7 +29,7 @@
 	}
 
 	/* Extend to cover name up to but not including null terminator */
-	for (int i = 0; i < name_size / sizeof(int16_t); ++i) {
+	for (size_t i = 0; i < name_size / sizeof(int16_t); ++i) {
 
 		if (!name[i]) break;
 		hash = ((hash << 5) + hash) + name[i];
@@ -61,7 +61,7 @@
 	int found_pos = -1;
 	uint64_t uid = name_hash(guid, name_size, name);
 
-	for (int pos = 0; pos < context->max_variables; pos++) {
+	for (size_t pos = 0; pos < context->max_variables; pos++) {
 
 		if ((context->entries[pos].in_use) &&
 			(uid == context->entries[pos].info.metadata.uid)) {
@@ -79,7 +79,7 @@
 {
 	int free_pos = -1;
 
-	for (int pos = 0; pos < context->max_variables; pos++) {
+	for (size_t pos = 0; pos < context->max_variables; pos++) {
 
 		if (!context->entries[pos].in_use) {
 
@@ -174,7 +174,7 @@
 
 				/* Iterate to next used entry */
 				++pos;
-				while (pos < context->max_variables) {
+				while (pos < (int)context->max_variables) {
 
 					if (context->entries[pos].in_use &&
 						context->entries[pos].info.is_variable_set) {
@@ -198,7 +198,7 @@
 			/* Find first */
 			int pos = 0;
 
-			while (pos < context->max_variables) {
+			while (pos < (int)context->max_variables) {
 
 				if (context->entries[pos].in_use &&
 					context->entries[pos].info.is_variable_set) {
@@ -293,6 +293,8 @@
 	struct variable_index *context,
 	struct variable_info *info)
 {
+	(void)context;
+
 	if (info &&
 		!info->is_constraints_set &&
 		!info->is_variable_set) {
@@ -320,6 +322,8 @@
 	struct variable_index *context,
 	struct variable_info *info)
 {
+	(void)context;
+
 	if (info) {
 
 		struct variable_entry *entry = containing_entry(info);
@@ -351,7 +355,7 @@
 	uint8_t *dump_pos = buffer;
 	size_t bytes_dumped = 0;
 
-	for (int pos = 0; pos < context->max_variables; pos++) {
+	for (size_t pos = 0; pos < context->max_variables; pos++) {
 
 		struct variable_entry *entry = &context->entries[pos];
 		struct variable_metadata *metadata = &entry->info.metadata;
diff --git a/components/service/smm_variable/provider/smm_variable_provider.c b/components/service/smm_variable/provider/smm_variable_provider.c
index 52e68d0..5fda0db 100644
--- a/components/service/smm_variable/provider/smm_variable_provider.c
+++ b/components/service/smm_variable/provider/smm_variable_provider.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
+ * Copyright (c) 2021-2022, Arm Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
@@ -357,7 +357,7 @@
 
 static rpc_status_t get_payload_size_handler(void *context, struct call_req *req)
 {
-	struct smm_variable_provider *this_instance = (struct smm_variable_provider*)context;
+	(void)context;
 
 	/* Payload size is constrained by the size of the RPC call buffer.  Because the variable length
 	 * name is also carried in the buffer, the maximum payload size depends on the name size.  This
diff --git a/components/service/smm_variable/test/service/smm_variable_attack_tests.cpp b/components/service/smm_variable/test/service/smm_variable_attack_tests.cpp
index 0a98a22..d9f07b2 100644
--- a/components/service/smm_variable/test/service/smm_variable_attack_tests.cpp
+++ b/components/service/smm_variable/test/service/smm_variable_attack_tests.cpp
@@ -4,6 +4,7 @@
  * SPDX-License-Identifier: BSD-3-Clause
  */
 
+#include <cstring>
 #include <limits>
 #include <service/smm_variable/client/cpp/smm_variable_client.h>
 #include <protocols/rpc/common/packed-c/encoding.h>
@@ -208,7 +209,8 @@
 {
 	efi_status_t efi_status = EFI_SUCCESS;
 	std::wstring var_name;
-	EFI_GUID guid = {0};
+	EFI_GUID guid;
+	memset(&guid, 0, sizeof(guid));
 
 	efi_status = m_client->get_next_variable_name(
 		guid,
@@ -223,7 +225,8 @@
 	efi_status_t efi_status = EFI_SUCCESS;
 	std::wstring var_name_1 = L"varibale_1";
 	std::wstring var_name;
-	EFI_GUID guid = {0};
+	EFI_GUID guid;
+	memset(&guid, 0, sizeof(guid));
 
 	/* Add a variable */
 	efi_status = m_client->set_variable(
@@ -232,6 +235,8 @@
 		std::string("Some data"),
 		EFI_VARIABLE_NON_VOLATILE);
 
+	UNSIGNED_LONGLONGS_EQUAL(EFI_SUCCESS, efi_status);
+
 	/* Initial iteration uses good name length */
 	efi_status = m_client->get_next_variable_name(
 		guid,
diff --git a/components/service/smm_variable/test/service/smm_variable_service_tests.cpp b/components/service/smm_variable/test/service/smm_variable_service_tests.cpp
index 4108d51..8314a08 100644
--- a/components/service/smm_variable/test/service/smm_variable_service_tests.cpp
+++ b/components/service/smm_variable/test/service/smm_variable_service_tests.cpp
@@ -4,6 +4,7 @@
  * SPDX-License-Identifier: BSD-3-Clause
  */
 
+#include <cstring>
 #include <service/smm_variable/client/cpp/smm_variable_client.h>
 #include <protocols/rpc/common/packed-c/encoding.h>
 #include <service_locator.h>
@@ -425,7 +426,8 @@
 
 	/* Enumerate store contents - expect the values we added */
 	std::wstring var_name;
-	EFI_GUID guid = {0};
+	EFI_GUID guid;
+	memset(&guid, 0, sizeof(guid));
 
 	efi_status = m_client->get_next_variable_name(guid, var_name);
 	UNSIGNED_LONGLONGS_EQUAL(EFI_SUCCESS, efi_status);