mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-07 21:33:54 +00:00
Enable -Wlogical-op always
-Wlogical-op prevents common errors with using numerical constants where a boolean one is expected as well as when the operands of a logical operator are the same. While these are perfectly valid behavior, they can be a sign that something is slightly off. This patch adds this warning to gcc and it's closest equivalent to clang, while also fixing any warnings that enabling them causes. Change-Id: Iabadfc1e6ee0c44eef6685a23b0aed8abef8ce89 Signed-off-by: Justin Chadwell <justin.chadwell@arm.com>
This commit is contained in:
parent
b7f6525db6
commit
d7b4cd4111
3 changed files with 8 additions and 9 deletions
11
Makefile
11
Makefile
|
@ -246,7 +246,6 @@ WARNING1 += -Wunused-const-variable
|
|||
WARNING2 := -Waggregate-return
|
||||
WARNING2 += -Wcast-align
|
||||
WARNING2 += -Wnested-externs
|
||||
WARNING2 += -Wlogical-op
|
||||
|
||||
WARNING3 := -Wbad-function-cast
|
||||
WARNING3 += -Wcast-qual
|
||||
|
@ -268,13 +267,13 @@ endif
|
|||
# Compiler specific warnings
|
||||
ifeq ($(findstring clang,$(notdir $(CC))),)
|
||||
# not using clang
|
||||
WARNINGS += -Wunused-but-set-variable \
|
||||
-Wmaybe-uninitialized \
|
||||
-Wpacked-bitfield-compat \
|
||||
-Wshift-overflow=2
|
||||
WARNINGS += -Wunused-but-set-variable -Wmaybe-uninitialized \
|
||||
-Wpacked-bitfield-compat -Wshift-overflow=2 \
|
||||
-Wlogical-op
|
||||
else
|
||||
# using clang
|
||||
WARNINGS += -Wshift-overflow -Wshift-sign-overflow
|
||||
WARNINGS += -Wshift-overflow -Wshift-sign-overflow \
|
||||
-Wlogical-op-parentheses
|
||||
endif
|
||||
|
||||
ifneq (${E},0)
|
||||
|
|
|
@ -81,14 +81,14 @@ static void mentor_i2c_interrupt_clear(void)
|
|||
udelay(1);
|
||||
}
|
||||
|
||||
static int mentor_i2c_interrupt_get(void)
|
||||
static bool mentor_i2c_interrupt_get(void)
|
||||
{
|
||||
uint32_t reg;
|
||||
|
||||
/* get the interrupt flag bit */
|
||||
reg = mmio_read_32((uintptr_t)&base->control);
|
||||
reg &= I2C_CONTROL_IFLG;
|
||||
return reg && I2C_CONTROL_IFLG;
|
||||
return (reg != 0U);
|
||||
}
|
||||
|
||||
static int mentor_i2c_wait_interrupt(void)
|
||||
|
|
|
@ -58,7 +58,7 @@ static enum pm_ret_status pm_ioctl_set_rpu_oper_mode(unsigned int mode)
|
|||
{
|
||||
unsigned int val;
|
||||
|
||||
if (mmio_read_32(CRL_APB_RST_LPD_TOP) && CRL_APB_RPU_AMBA_RESET)
|
||||
if (mmio_read_32(CRL_APB_RST_LPD_TOP) & CRL_APB_RPU_AMBA_RESET)
|
||||
return PM_RET_ERROR_ACCESS;
|
||||
|
||||
val = mmio_read_32(ZYNQMP_RPU_GLBL_CNTL);
|
||||
|
|
Loading…
Add table
Reference in a new issue