AdaCore / Ada_Drivers_Library

Ada source code and complete sample GNAT projects for selected bare-board platforms supported by GNAT.
BSD 3-Clause "New" or "Revised" License
236 stars 141 forks source link

Incorrect usage of 'Val instead of 'Enum_Val #431

Open liampwll opened 3 weeks ago

liampwll commented 3 weeks ago

The below line will raise a Constraint_Error if Range_Check is enabled as the enumeration is not continuous, using 'Enum_Val instead would fix this. This error could exist in the other uses of 'Val which I have not checked and it could have potentially worse consequences than this one which will likely be harmless when Range_Check is disabled.

https://github.com/AdaCore/Ada_Drivers_Library/blob/b651d01dcfd7e27836f938c1d494e1ed3212ed43/arch/ARM/STM32/drivers/stm32-adc.adb#L410