Enable -Wshadow always
Variable shadowing is, according to the C standard, permitted and valid
behaviour. However, allowing a local variable to take the same name as a
global one can cause confusion and can make refactoring and bug hunting
more difficult.
This patch moves -Wshadow from WARNING2 into the general warning group
so it is always used. It also fixes all warnings that this introduces
by simply renaming the local variable to a new name
Change-Id: I6b71bdce6580c6e58b5e0b41e4704ab0aa38576e
Signed-off-by: Justin Chadwell <justin.chadwell@arm.com>
diff --git a/plat/layerscape/common/ns_access.c b/plat/layerscape/common/ns_access.c
index b84fdbd..9717c72 100644
--- a/plat/layerscape/common/ns_access.c
+++ b/plat/layerscape/common/ns_access.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2018-2019, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -13,7 +13,7 @@
#include "ns_access.h"
-static void enable_devices_ns_access(struct csu_ns_dev *ns_dev, uint32_t num)
+static void enable_devices_ns_access(struct csu_ns_dev *_ns_dev, uint32_t num)
{
uint32_t *base = (uint32_t *)CONFIG_SYS_FSL_CSU_ADDR;
uint32_t *reg;
@@ -21,14 +21,14 @@
int i;
for (i = 0; i < num; i++) {
- reg = base + ns_dev[i].ind / 2;
+ reg = base + _ns_dev[i].ind / 2;
val = be32toh(mmio_read_32((uintptr_t)reg));
- if (ns_dev[i].ind % 2 == 0) {
+ if (_ns_dev[i].ind % 2 == 0) {
val &= 0x0000ffff;
- val |= ns_dev[i].val << 16;
+ val |= _ns_dev[i].val << 16;
} else {
val &= 0xffff0000;
- val |= ns_dev[i].val;
+ val |= _ns_dev[i].val;
}
mmio_write_32((uintptr_t)reg, htobe32(val));
}