cancel
Showing results for 
Search instead for 
Did you mean: 

Self-assignment warning bug

Jiajin
Associate II

This warning is occurring in the STM32U5xx HAL driver's low-level ADC header file (stm32u5xx_ll_adc.h). The warning indicates there's a self-assignment of a variable analog_wd_monit_channels where a variable is being assigned to itself.

 

STM32CubeMX/Target_1/STM32CubeMX/Drivers/STM32U5xx_HAL_Driver/Inc/stm32u5xx_ll_adc.h:6920:34: warning: explicitly assigning value of variable of type 'uint32_t' (aka 'unsigned int') to itself [-Wself-assign]
6920 | analog_wd_monit_channels = analog_wd_monit_channels;
| ~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.

1 REPLY 1
Pavel A.
Super User

This usually occurs because of some kind of "unused parameter" macro, which in its turn exists to silence another warning. For example

#define UNUSED_PARAMETER(x) x = x

int junk(int p1, char p2)
{
  UNUSED_PARAMETER(p2);
  return p1;
}

So... decide which of the warnings you hate more, and disable the other.