[Ada] Fix imprecise wording for error on scalar storage order
authorEric Botcazou <ebotcazou@adacore.com>
Tue, 13 Jul 2021 09:23:38 +0000 (11:23 +0200)
committerPierre-Marie de Rodat <derodat@adacore.com>
Wed, 22 Sep 2021 15:01:41 +0000 (15:01 +0000)
gcc/ada/

* freeze.adb (Check_Component_Storage_Order): Give a specific error
message for non-byte-aligned component in the packed case.  Replace
"composite" with "record" in both cases.

gcc/ada/freeze.adb

index 15ce832..3f57bc5 100644 (file)
@@ -1352,9 +1352,15 @@ package body Freeze is
             elsif Is_Record_Type (Encl_Base)
               and then not Comp_Byte_Aligned
             then
-               Error_Msg_N
-                 ("type of non-byte-aligned component must have same scalar "
-                  & "storage order as enclosing composite", Err_Node);
+               if Present (Component_Clause (Comp)) then
+                  Error_Msg_N
+                    ("type of non-byte-aligned component must have same scalar"
+                     & " storage order as enclosing record", Err_Node);
+               else
+                  Error_Msg_N
+                    ("type of packed component must have same scalar"
+                     & " storage order as enclosing record", Err_Node);
+               end if;
 
             --  Warn if specified only for the outer composite