]> git.ipfire.org Git - people/ms/gcc.git/commit
[Ada] Fix bugs in check-related warnings.
authorBob Duff <duff@adacore.com>
Tue, 23 Aug 2022 16:51:01 +0000 (12:51 -0400)
committerMarc Poulhiès <poulhies@adacore.com>
Mon, 12 Sep 2022 08:16:50 +0000 (10:16 +0200)
commit65d76c55931c076d674def3e6bd035f875e2c55c
tree5aebbe99d816bd4ebee54ff68c778910609ebac2
parent635e98b86497d8c017ea437725b6620572c9de5c
[Ada] Fix bugs in check-related warnings.

Make sure warnings about wrong-length aggregates don't get
suppressed. Such a warning (in a with-ed unit) can be the only
explanation for an error about No_Elaboration_Code violations.

Avoid passing a bogus "#" to Error_Msg. We really should never
construct message templates by concatenating strings that can
come from input data, but there are too many cases of that to
clean up. The message template parameters should really be
of a type other than String, to avoid these kinds of bugs,
but again, that's too much work to clean up now.

gcc/ada/

* checks.adb
(Selected_Length_Checks): In the message for an aggregate that has
too few or too many elements, add "!!" to make sure the warning
gets printed in with'ed units. Note that we have to put "!!"
before the "??", because Compile_Time_Constraint_Error detects
warnings by comparing the last character of the message with '?'
(which is bit dubious, but we're not changing that here).
(Length_Mismatch_Info_Message): Use Unat for some things that
can't be negative. Specify Decimal instead of Auto in calls to
UI_Image.
* sem_util.adb
(Compile_Time_Constraint_Error): Minor.
* uintp.adb
(Image_Uint): It's always better to initialize objects on their
declaration.
gcc/ada/checks.adb
gcc/ada/sem_util.adb
gcc/ada/uintp.adb