[Ada] Add expected and actual size to "bit number out of range" error message
authorGhjuvan Lacambre <lacambre@adacore.com>
Mon, 18 May 2020 13:41:09 +0000 (15:41 +0200)
committerPierre-Marie de Rodat <derodat@adacore.com>
Wed, 8 Jul 2020 14:55:51 +0000 (10:55 -0400)
gcc/ada/

* sem_ch13.adb (Analyze_Record_Representation_Clause,
Check_Record_Representation_Clause): Add expected and actual
size to error message.

gcc/ada/sem_ch13.adb

index 476503c2e78938ef09669f8f4445b902118ffe1d..e440069c7da0d158c15b437cdb4ad20767180056 100644 (file)
@@ -8105,8 +8105,10 @@ package body Sem_Ch13 is
                      if Has_Size_Clause (Rectype)
                        and then RM_Size (Rectype) <= Lbit
                      then
-                        Error_Msg_N
-                          ("bit number out of range of specified size",
+                        Error_Msg_Uint_1 := RM_Size (Rectype);
+                        Error_Msg_Uint_2 := Lbit + 1;
+                        Error_Msg_N ("bit number out of range of specified "
+                           & "size (expected ^, got ^)",
                            Last_Bit (CC));
                      else
                         Set_Component_Clause     (Comp, CC);
@@ -11552,8 +11554,10 @@ package body Sem_Ch13 is
             if Has_Size_Clause (Rectype)
               and then RM_Size (Rectype) <= Lbit
             then
-               Error_Msg_N
-                 ("bit number out of range of specified size",
+               Error_Msg_Uint_1 := RM_Size (Rectype);
+               Error_Msg_Uint_2 := Lbit + 1;
+               Error_Msg_N ("bit number out of range of specified "
+                  & "size (expected ^, got ^)",
                   Last_Bit (CC));
 
                --  Check for overlap with tag or parent component