diff options
author | Bob Duff <duff@adacore.com> | 2022-04-07 10:59:32 -0400 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2022-05-19 14:05:28 +0000 |
commit | 5cc07f401a69f14638cfd37b27401e4e0fd8fc65 (patch) | |
tree | c6bde4d44348b663b2698eb91711a6be40f9a122 /gcc | |
parent | [Ada] Get rid of secondary stack for controlled components (diff) | |
download | gcc-5cc07f401a69f14638cfd37b27401e4e0fd8fc65.tar.gz gcc-5cc07f401a69f14638cfd37b27401e4e0fd8fc65.tar.bz2 gcc-5cc07f401a69f14638cfd37b27401e4e0fd8fc65.tar.xz |
[Ada] Casing style on record components
This patch fixes a bug where the -gnatyr switch fails to detect
incorrect casing of record components.
gcc/ada/
* style.adb (Check_Identifier): Deal with the case where a
record component definition has been transformed; we want to
warn if the original came from source.
* libgnat/s-objrea.ads, libgnat/s-objrea.adb: Fix casing of MF
to be consistent.
* uname.adb: Fix casing of Chars to be consistent.
* sem_util.ads: Minor comment fix.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/libgnat/s-objrea.adb | 16 | ||||
-rw-r--r-- | gcc/ada/libgnat/s-objrea.ads | 4 | ||||
-rw-r--r-- | gcc/ada/sem_util.ads | 5 | ||||
-rw-r--r-- | gcc/ada/style.adb | 9 | ||||
-rw-r--r-- | gcc/ada/uname.adb | 2 |
5 files changed, 20 insertions, 16 deletions
diff --git a/gcc/ada/libgnat/s-objrea.adb b/gcc/ada/libgnat/s-objrea.adb index 854bbb290e4..843ccf5915a 100644 --- a/gcc/ada/libgnat/s-objrea.adb +++ b/gcc/ada/libgnat/s-objrea.adb | |||
@@ -979,7 +979,7 @@ package body System.Object_Reader is | |||
979 | 979 | ||
980 | -- Map section table | 980 | -- Map section table |
981 | 981 | ||
982 | Opt_Stream := Create_Stream (Res.Mf, Signature_Loc_Offset, 4); | 982 | Opt_Stream := Create_Stream (Res.MF, Signature_Loc_Offset, 4); |
983 | Hdr_Offset := Offset (uint32'(Read (Opt_Stream))); | 983 | Hdr_Offset := Offset (uint32'(Read (Opt_Stream))); |
984 | Close (Opt_Stream); | 984 | Close (Opt_Stream); |
985 | Res.Sectab_Stream := Create_Stream | 985 | Res.Sectab_Stream := Create_Stream |
@@ -999,7 +999,7 @@ package body System.Object_Reader is | |||
999 | Opt_32 : Optional_Header_PE32; | 999 | Opt_32 : Optional_Header_PE32; |
1000 | begin | 1000 | begin |
1001 | Opt_Stream := Create_Stream | 1001 | Opt_Stream := Create_Stream |
1002 | (Res.Mf, Opt_Offset, Opt_32'Size / SSU); | 1002 | (Res.MF, Opt_Offset, Opt_32'Size / SSU); |
1003 | Read_Raw | 1003 | Read_Raw |
1004 | (Opt_Stream, Opt_32'Address, uint32 (Opt_32'Size / SSU)); | 1004 | (Opt_Stream, Opt_32'Address, uint32 (Opt_32'Size / SSU)); |
1005 | Res.ImageBase := uint64 (Opt_32.ImageBase); | 1005 | Res.ImageBase := uint64 (Opt_32.ImageBase); |
@@ -1011,7 +1011,7 @@ package body System.Object_Reader is | |||
1011 | Opt_64 : Optional_Header_PE64; | 1011 | Opt_64 : Optional_Header_PE64; |
1012 | begin | 1012 | begin |
1013 | Opt_Stream := Create_Stream | 1013 | Opt_Stream := Create_Stream |
1014 | (Res.Mf, Opt_Offset, Opt_64'Size / SSU); | 1014 | (Res.MF, Opt_Offset, Opt_64'Size / SSU); |
1015 | Read_Raw | 1015 | Read_Raw |
1016 | (Opt_Stream, Opt_64'Address, uint32 (Opt_64'Size / SSU)); | 1016 | (Opt_Stream, Opt_64'Address, uint32 (Opt_64'Size / SSU)); |
1017 | Res.ImageBase := Opt_64.ImageBase; | 1017 | Res.ImageBase := Opt_64.ImageBase; |
@@ -1367,7 +1367,7 @@ package body System.Object_Reader is | |||
1367 | Strtab_Sz : uint32; | 1367 | Strtab_Sz : uint32; |
1368 | 1368 | ||
1369 | begin | 1369 | begin |
1370 | Res.Mf := F; | 1370 | Res.MF := F; |
1371 | Res.In_Exception := In_Exception; | 1371 | Res.In_Exception := In_Exception; |
1372 | 1372 | ||
1373 | Res.Arch := PPC; | 1373 | Res.Arch := PPC; |
@@ -1515,14 +1515,14 @@ package body System.Object_Reader is | |||
1515 | end Arch; | 1515 | end Arch; |
1516 | 1516 | ||
1517 | function Create_Stream | 1517 | function Create_Stream |
1518 | (Mf : Mapped_File; | 1518 | (MF : Mapped_File; |
1519 | File_Offset : File_Size; | 1519 | File_Offset : File_Size; |
1520 | File_Length : File_Size) | 1520 | File_Length : File_Size) |
1521 | return Mapped_Stream | 1521 | return Mapped_Stream |
1522 | is | 1522 | is |
1523 | Region : Mapped_Region; | 1523 | Region : Mapped_Region; |
1524 | begin | 1524 | begin |
1525 | Read (Mf, Region, File_Offset, File_Length, False); | 1525 | Read (MF, Region, File_Offset, File_Length, False); |
1526 | return (Region, 0, Offset (File_Length)); | 1526 | return (Region, 0, Offset (File_Length)); |
1527 | end Create_Stream; | 1527 | end Create_Stream; |
1528 | 1528 | ||
@@ -1531,7 +1531,7 @@ package body System.Object_Reader is | |||
1531 | Sec : Object_Section) return Mapped_Stream | 1531 | Sec : Object_Section) return Mapped_Stream |
1532 | is | 1532 | is |
1533 | begin | 1533 | begin |
1534 | return Create_Stream (Obj.Mf, File_Size (Sec.Off), File_Size (Sec.Size)); | 1534 | return Create_Stream (Obj.MF, File_Size (Sec.Off), File_Size (Sec.Size)); |
1535 | end Create_Stream; | 1535 | end Create_Stream; |
1536 | 1536 | ||
1537 | procedure Tell (Obj : in out Mapped_Stream; Off : out Offset) is | 1537 | procedure Tell (Obj : in out Mapped_Stream; Off : out Offset) is |
@@ -1573,7 +1573,7 @@ package body System.Object_Reader is | |||
1573 | null; | 1573 | null; |
1574 | end case; | 1574 | end case; |
1575 | 1575 | ||
1576 | Close (Obj.Mf); | 1576 | Close (Obj.MF); |
1577 | end Close; | 1577 | end Close; |
1578 | 1578 | ||
1579 | ------------------------ | 1579 | ------------------------ |
diff --git a/gcc/ada/libgnat/s-objrea.ads b/gcc/ada/libgnat/s-objrea.ads index fc440ffc5db..ee72114819b 100644 --- a/gcc/ada/libgnat/s-objrea.ads +++ b/gcc/ada/libgnat/s-objrea.ads | |||
@@ -187,7 +187,7 @@ package System.Object_Reader is | |||
187 | type Mapped_Stream is private; | 187 | type Mapped_Stream is private; |
188 | -- Provide an abstraction of a stream on a memory mapped file | 188 | -- Provide an abstraction of a stream on a memory mapped file |
189 | 189 | ||
190 | function Create_Stream (Mf : System.Mmap.Mapped_File; | 190 | function Create_Stream (MF : System.Mmap.Mapped_File; |
191 | File_Offset : System.Mmap.File_Size; | 191 | File_Offset : System.Mmap.File_Size; |
192 | File_Length : System.Mmap.File_Size) | 192 | File_Length : System.Mmap.File_Size) |
193 | return Mapped_Stream; | 193 | return Mapped_Stream; |
@@ -381,7 +381,7 @@ private | |||
381 | subtype Any_PECOFF is Object_Format range PECOFF .. PECOFF_PLUS; | 381 | subtype Any_PECOFF is Object_Format range PECOFF .. PECOFF_PLUS; |
382 | 382 | ||
383 | type Object_File (Format : Object_Format) is record | 383 | type Object_File (Format : Object_Format) is record |
384 | Mf : System.Mmap.Mapped_File := System.Mmap.Invalid_Mapped_File; | 384 | MF : System.Mmap.Mapped_File := System.Mmap.Invalid_Mapped_File; |
385 | Arch : Object_Arch := Unknown; | 385 | Arch : Object_Arch := Unknown; |
386 | 386 | ||
387 | Num_Sections : uint32 := 0; | 387 | Num_Sections : uint32 := 0; |
diff --git a/gcc/ada/sem_util.ads b/gcc/ada/sem_util.ads index f9903b8ebdd..1eca815c9d6 100644 --- a/gcc/ada/sem_util.ads +++ b/gcc/ada/sem_util.ads | |||
@@ -3169,9 +3169,8 @@ package Sem_Util is | |||
3169 | -- This procedure has the same calling sequence as Set_Entity, but it | 3169 | -- This procedure has the same calling sequence as Set_Entity, but it |
3170 | -- performs additional checks as follows: | 3170 | -- performs additional checks as follows: |
3171 | -- | 3171 | -- |
3172 | -- If Style_Check is set, then it calls a style checking routine which | 3172 | -- If Style_Check is set, then it calls a style checking routine that |
3173 | -- can check identifier spelling style. This procedure also takes care | 3173 | -- can check identifier spelling style. |
3174 | -- of checking the restriction No_Implementation_Identifiers. | ||
3175 | -- | 3174 | -- |
3176 | -- If restriction No_Abort_Statements is set, then it checks that the | 3175 | -- If restriction No_Abort_Statements is set, then it checks that the |
3177 | -- entity is not Ada.Task_Identification.Abort_Task. | 3176 | -- entity is not Ada.Task_Identification.Abort_Task. |
diff --git a/gcc/ada/style.adb b/gcc/ada/style.adb index 60bfc9370f9..cf7bc19980b 100644 --- a/gcc/ada/style.adb +++ b/gcc/ada/style.adb | |||
@@ -126,9 +126,14 @@ package body Style is | |||
126 | elsif Error_Posted (Ref) or else Error_Posted (Def) then | 126 | elsif Error_Posted (Ref) or else Error_Posted (Def) then |
127 | return; | 127 | return; |
128 | 128 | ||
129 | -- Case of definition comes from source | 129 | -- Case of definition comes from source, or a record component whose |
130 | -- Original_Record_Component comes from source. | ||
130 | 131 | ||
131 | elsif Comes_From_Source (Def) then | 132 | elsif Comes_From_Source (Def) or else |
133 | (Ekind (Def) in Record_Field_Kind | ||
134 | and then Present (Original_Record_Component (Def)) | ||
135 | and then Comes_From_Source (Original_Record_Component (Def))) | ||
136 | then | ||
132 | 137 | ||
133 | -- Check same casing if we are checking references | 138 | -- Check same casing if we are checking references |
134 | 139 | ||
diff --git a/gcc/ada/uname.adb b/gcc/ada/uname.adb index 60ef2b6686a..200c036eee5 100644 --- a/gcc/ada/uname.adb +++ b/gcc/ada/uname.adb | |||
@@ -715,7 +715,7 @@ package body Uname is | |||
715 | Buf : Bounded_String; | 715 | Buf : Bounded_String; |
716 | begin | 716 | begin |
717 | Get_Unit_Name_String (Buf, N); | 717 | Get_Unit_Name_String (Buf, N); |
718 | Write_Str (Buf.chars (1 .. Buf.Length)); | 718 | Write_Str (Buf.Chars (1 .. Buf.Length)); |
719 | end Write_Unit_Name; | 719 | end Write_Unit_Name; |
720 | 720 | ||
721 | ------------------------------- | 721 | ------------------------------- |