[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.
This commit is contained in:
Bob Duff 2022-04-07 10:59:32 -04:00 committed by Pierre-Marie de Rodat
parent c697f593f4
commit 5cc07f401a
5 changed files with 20 additions and 16 deletions

View File

@ -979,7 +979,7 @@ package body System.Object_Reader is
-- Map section table
Opt_Stream := Create_Stream (Res.Mf, Signature_Loc_Offset, 4);
Opt_Stream := Create_Stream (Res.MF, Signature_Loc_Offset, 4);
Hdr_Offset := Offset (uint32'(Read (Opt_Stream)));
Close (Opt_Stream);
Res.Sectab_Stream := Create_Stream
@ -999,7 +999,7 @@ package body System.Object_Reader is
Opt_32 : Optional_Header_PE32;
begin
Opt_Stream := Create_Stream
(Res.Mf, Opt_Offset, Opt_32'Size / SSU);
(Res.MF, Opt_Offset, Opt_32'Size / SSU);
Read_Raw
(Opt_Stream, Opt_32'Address, uint32 (Opt_32'Size / SSU));
Res.ImageBase := uint64 (Opt_32.ImageBase);
@ -1011,7 +1011,7 @@ package body System.Object_Reader is
Opt_64 : Optional_Header_PE64;
begin
Opt_Stream := Create_Stream
(Res.Mf, Opt_Offset, Opt_64'Size / SSU);
(Res.MF, Opt_Offset, Opt_64'Size / SSU);
Read_Raw
(Opt_Stream, Opt_64'Address, uint32 (Opt_64'Size / SSU));
Res.ImageBase := Opt_64.ImageBase;
@ -1367,7 +1367,7 @@ package body System.Object_Reader is
Strtab_Sz : uint32;
begin
Res.Mf := F;
Res.MF := F;
Res.In_Exception := In_Exception;
Res.Arch := PPC;
@ -1515,14 +1515,14 @@ package body System.Object_Reader is
end Arch;
function Create_Stream
(Mf : Mapped_File;
(MF : Mapped_File;
File_Offset : File_Size;
File_Length : File_Size)
return Mapped_Stream
is
Region : Mapped_Region;
begin
Read (Mf, Region, File_Offset, File_Length, False);
Read (MF, Region, File_Offset, File_Length, False);
return (Region, 0, Offset (File_Length));
end Create_Stream;
@ -1531,7 +1531,7 @@ package body System.Object_Reader is
Sec : Object_Section) return Mapped_Stream
is
begin
return Create_Stream (Obj.Mf, File_Size (Sec.Off), File_Size (Sec.Size));
return Create_Stream (Obj.MF, File_Size (Sec.Off), File_Size (Sec.Size));
end Create_Stream;
procedure Tell (Obj : in out Mapped_Stream; Off : out Offset) is
@ -1573,7 +1573,7 @@ package body System.Object_Reader is
null;
end case;
Close (Obj.Mf);
Close (Obj.MF);
end Close;
------------------------

View File

@ -187,7 +187,7 @@ package System.Object_Reader is
type Mapped_Stream is private;
-- Provide an abstraction of a stream on a memory mapped file
function Create_Stream (Mf : System.Mmap.Mapped_File;
function Create_Stream (MF : System.Mmap.Mapped_File;
File_Offset : System.Mmap.File_Size;
File_Length : System.Mmap.File_Size)
return Mapped_Stream;
@ -381,7 +381,7 @@ private
subtype Any_PECOFF is Object_Format range PECOFF .. PECOFF_PLUS;
type Object_File (Format : Object_Format) is record
Mf : System.Mmap.Mapped_File := System.Mmap.Invalid_Mapped_File;
MF : System.Mmap.Mapped_File := System.Mmap.Invalid_Mapped_File;
Arch : Object_Arch := Unknown;
Num_Sections : uint32 := 0;

View File

@ -3169,9 +3169,8 @@ package Sem_Util is
-- This procedure has the same calling sequence as Set_Entity, but it
-- performs additional checks as follows:
--
-- If Style_Check is set, then it calls a style checking routine which
-- can check identifier spelling style. This procedure also takes care
-- of checking the restriction No_Implementation_Identifiers.
-- If Style_Check is set, then it calls a style checking routine that
-- can check identifier spelling style.
--
-- If restriction No_Abort_Statements is set, then it checks that the
-- entity is not Ada.Task_Identification.Abort_Task.

View File

@ -126,9 +126,14 @@ package body Style is
elsif Error_Posted (Ref) or else Error_Posted (Def) then
return;
-- Case of definition comes from source
-- Case of definition comes from source, or a record component whose
-- Original_Record_Component comes from source.
elsif Comes_From_Source (Def) then
elsif Comes_From_Source (Def) or else
(Ekind (Def) in Record_Field_Kind
and then Present (Original_Record_Component (Def))
and then Comes_From_Source (Original_Record_Component (Def)))
then
-- Check same casing if we are checking references

View File

@ -715,7 +715,7 @@ package body Uname is
Buf : Bounded_String;
begin
Get_Unit_Name_String (Buf, N);
Write_Str (Buf.chars (1 .. Buf.Length));
Write_Str (Buf.Chars (1 .. Buf.Length));
end Write_Unit_Name;
-------------------------------