Constraint Error warning using Enum in ADA -
i'd know why constraint errors warnings prompted in ada when enums used in example below. i've been using enums can replace them better implementation.
type uart_instance_type (com1, com2, com3); uart_instance_type use ( com1 => 16#0001# , com2 => 16#0002# , com3 => 16#0003# ); type uart_register_type record sr : half_word; -- usart status register reserved_0 : half_word; dr : half_word; -- usart data register reserved_1 : half_word; brr : half_word; -- usart baud rate register reserved_2 : half_word; end record volatile; uart_register_type use record sr @ 0 range 0 .. 15; reserved_0 @ 2 range 0 .. 15; dr @ 4 range 0 .. 15; reserved_1 @ 6 range 0 .. 15; brr @ 8 range 0 .. 15; reserved_2 @ 10 range 0 .. 15; end record; type uart_register_access access uart_register_type; uarts: array (uart_instance_type range com1 .. com3) of aliased uart_register_access;
the compiler prompt @ last line ("uarts: ...) , shows:
warning: "constraint error" may call last_chance_handler
is there better implementation avoid these warnings when using enums?
thanks in advance! :)
i think must compiling restricted (ravenscar?) runtime, why any exception result in call last_chance_handler
.
i encountered lot of irritating warnings this, , traced compiling with
-gnatwa
(“turn on info/warnings marked below +”) enables
-gnatw.x
("turn on warnings non-local exception”).
you can suppress warnings -gnatw.x
.
(for info, can see command line options saying gnatmake -h
(or arm-eabi-gnatmake -h
). there lot.)
Comments
Post a Comment