STMicroelectronics / STM32CubeF4

STM32Cube MCU Full Package for the STM32F4 series - (HAL + LL Drivers, CMSIS Core, CMSIS Device, MW libraries plus a set of Projects running on all boards provided by ST (Nucleo, Evaluation and Discovery Kits))
Other
827 stars 409 forks source link

Unused parameter warning in LL_ADC_DMA_GetRegAddr() #116

Closed daniel-starke closed 11 months ago

daniel-starke commented 2 years ago

Describe the set-up

Describe the bug The compiler warns that the parameter Register in LL_ADC_DMA_GetRegAddr() is unsed.

https://github.com/STMicroelectronics/STM32CubeF4/blob/3d6be4bd406f275728e0a321cc371c62a3100533/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_adc.h#L1880-L1884

How To Reproduce Compile a file which includes stm32f4xx_ll_adc.h with -Wunused in gcc. The target shall not define ADC_MULTIMODE_SUPPORT.

Additional context I propose to add UNUSED(Register); at the beginning of LL_ADC_DMA_GetRegAddr().

ASELSTM commented 2 years ago

Hi @daniel-starke,

Thank you for this report. The point you raised out has been fixed within other STM32cube packages and still not yet fixed on STM32CubeF4, it will be made available in the frame of a future release.

The fix is as follow :

 __STATIC_INLINE uint32_t LL_ADC_DMA_GetRegAddr(ADC_TypeDef *ADCx, uint32_t Register) 
 { 
+  /* Prevent unused argument compilation warning */
+  (void)Register;

   /* Retrieve address of register DR */ 
   return (uint32_t)&(ADCx->DR); 
 } 

With regards,

ASELSTM commented 2 years ago

ST Internal Reference: 125353

smartel99 commented 2 years ago

The exact same issue is also appearing in LL_ADC_IsActiveFlag_MST_EOCS.

https://github.com/STMicroelectronics/STM32CubeF4/blob/3d6be4bd406f275728e0a321cc371c62a3100533/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_adc.h#L4395-L4398

Would it be possible to fix it in that release as well?

Also, doesn't the HAL usually use the UNUSED macro to mark unused variables?

ALABSTM commented 11 months ago

Fixed in commit d5af56388ff037735ac99de39abf2b46f9921aa3