+2018-07-31 Arnaud Charlet <charlet@adacore.com>
+
+ * clean.adb, gnatchop.adb, gnatfind.adb, gnatls.adb,
+ gnatmake.ads, gnatxref.adb, make.adb, make.ads, make_util.ads,
+ sfn_scan.adb, vxaddr2line.adb, xeinfo.adb, xoscons.adb,
+ xr_tabls.adb, xref_lib.adb: Address CodePeer messages.
+
2018-07-31 Arnaud Charlet <charlet@adacore.com>
* gnatlink.adb: Fix potential Constraint_Error if
Arg : constant String := Argument (Index);
procedure Bad_Argument;
+ pragma No_Return (Bad_Argument);
-- Signal bad argument
------------------
Chop_Name : constant String_Access := File.Table (Num).Name;
Save_Stdout : constant File_Descriptor := dup (Standout);
Offset_Name : Temp_File_Name;
- Offset_FD : File_Descriptor;
+ Offset_FD : File_Descriptor := Invalid_FD;
Buffer : String_Access;
Success : Boolean;
Failure : exception;
exception
when Failure | Types.Terminate_Program =>
- Close (Offset_FD);
+ if Offset_FD /= Invalid_FD then
+ Close (Offset_FD);
+ end if;
+
Delete_File (Offset_Name'Address, Success);
return False;
-
end Parse_File;
-----------------------
-- Display the usage
procedure Write_Usage;
+ pragma No_Return (Write_Usage);
-- Print a small help page for program usage and exit program
--------------------
-- Print usage message
procedure Output_License_Information;
+ pragma No_Return (Output_License_Information);
-- Output license statement, and if not found, output reference to COPYING
function Image (Restriction : Restriction_Id) return String;
procedure Output_Token (T : Token_Type) is
begin
- if T in T_No_ALI .. T_Flags then
- for J in 1 .. N_Indents loop
- Write_Str (" ");
- end loop;
+ case T is
+ when T_No_ALI .. T_Flags =>
+ for J in 1 .. N_Indents loop
+ Write_Str (" ");
+ end loop;
- Write_Str (Image (T).all);
+ Write_Str (Image (T).all);
- for J in Image (T)'Length .. 12 loop
- Write_Char (' ');
- end loop;
+ for J in Image (T)'Length .. 12 loop
+ Write_Char (' ');
+ end loop;
- Write_Str ("=>");
+ Write_Str ("=>");
- if T in T_No_ALI .. T_With then
- Write_Eol;
- elsif T in T_Source .. T_Name then
- Write_Char (' ');
- end if;
-
- elsif T in T_Preelaborated .. T_Body then
- if T in T_Preelaborated .. T_Is_Generic then
- if N_Flags = 0 then
- Output_Token (T_Flags);
+ if T in T_No_ALI .. T_With then
+ Write_Eol;
+ elsif T in T_Source .. T_Name then
+ Write_Char (' ');
end if;
- N_Flags := N_Flags + 1;
- end if;
+ when T_Preelaborated .. T_Body =>
+ if T in T_Preelaborated .. T_Is_Generic then
+ if N_Flags = 0 then
+ Output_Token (T_Flags);
+ end if;
- Write_Char (' ');
- Write_Str (Image (T).all);
+ N_Flags := N_Flags + 1;
+ end if;
- else
- Write_Str (Image (T).all);
- end if;
+ Write_Char (' ');
+ Write_Str (Image (T).all);
+ end case;
end Output_Token;
-----------------
------------------------------------------------------------------------------
procedure Gnatmake;
+pragma No_Return (Gnatmake);
-- The driver for the gnatmake tool. This utility can be used to automatically
-- (re)compile a set of ada sources by giving the name of the root compilation
-- unit or the source file containing it. For more information on gnatmake
-- Display the usage
procedure Write_Usage;
+ pragma No_Return (Write_Usage);
-- Print a small help page for program usage
--------------------
procedure Sigint_Intercepted;
pragma Convention (C, Sigint_Intercepted);
+ pragma No_Return (Sigint_Intercepted);
-- Called when the program is interrupted by Ctrl-C to delete the
-- temporary mapping files and configuration pragmas files.
No_Shared_Libgcc_Switch'Access;
procedure Make_Failed (S : String);
+ pragma No_Return (Make_Failed);
-- Delete all temp files created by Gnatmake and call Osint.Fail, with the
-- parameter S (see osint.ads).
-- Display_Executed_Programs is set. The lower bound of Args must be 1.
procedure Report_Compilation_Failed;
+ pragma No_Return (Report_Compilation_Failed);
-- Delete all temporary files and fail graciously
-----------------
Gnatmake_Mapping_File : String_Access := null;
-- The path name of a mapping file specified by switch -C=
- procedure Init_Mapping_File (File_Index : in out Natural);
+ procedure Init_Mapping_File (File_Index : out Natural);
-- Create a new mapping file or reuse one already created.
package Temp_File_Paths is new Table.Table
Full_Lib_File : File_Name_Type := No_File;
Lib_File_Attr : aliased File_Attributes;
Read_Only : Boolean := False;
- ALI : ALI_Id;
+ ALI : ALI_Id := No_ALI_Id;
-- The ALI file and its attributes (size, stamp, ...)
- Obj_File : File_Name_Type;
+ Obj_File : File_Name_Type := No_File;
Obj_Stamp : Time_Stamp_Type;
-- The object file
-- Init_Mapping_File --
-----------------------
- procedure Init_Mapping_File (File_Index : in out Natural) is
+ procedure Init_Mapping_File (File_Index : out Natural) is
FD : File_Descriptor;
Status : Boolean;
-- For call to Close
Look_In_Primary_Dir := False;
elsif Program_Args = Compiler then
- if Argv (3 .. Argv'Last) /= "-" then
- Add_Source_Search_Dir (Argv (3 .. Argv'Last));
- end if;
+ Add_Source_Search_Dir (Argv (3 .. Argv'Last));
elsif Program_Args = Binder then
Add_Library_Search_Dir (Argv (3 .. Argv'Last));
-- -m
- elsif Argv (2) = 'm' and then Argv'Last = 2 then
+ elsif Argv (2) = 'm' then
+ pragma Assert (Argv'Last = 2);
Minimal_Recompilation := True;
-- -u
package Make is
procedure Gnatmake;
+ pragma No_Return (Gnatmake);
-- The driver of gnatmake. For more information on gnatmake and its
-- precise usage please refer to the gnat documentation.
procedure Fail_Program
(S : String;
Flush_Messages : Boolean := True);
+ pragma No_Return (Fail_Program);
-- Terminate program with a message and a fatal status code
procedure Finish_Program
(Exit_Code : Osint.Exit_Code_Type := Osint.E_Success;
S : String := "");
+ pragma No_Return (Finish_Program);
-- Terminate program, with or without a message, setting the status code
-- according to Fatal. This properly removes all temporary files.
-- ('a' .. 'z').
procedure Error (Err : String);
+ pragma No_Return (Error);
-- Called if an error is detected. Raises Syntax_Error_In_GNAT_ADC
-- with a message of the form gnat.adc:line:col: xxx, where xxx is
-- the string Err passed as a parameter.
-- Prints the message and then terminates the program
procedure Usage;
+ pragma No_Return (Usage);
-- Displays the short help message and then terminates the program
function Get_Reference_Offset return Unsigned_64;
declare
Match_String : constant String := Expect_Out_Match (Pd);
Matches : Match_Array (0 .. 1);
- Value : Unsigned_64;
+ Value : Unsigned_64 := 0;
begin
Match (Reference, Match_String, Matches);
Lastinlined : Boolean;
procedure Badfunc;
+ pragma No_Return (Badfunc);
-- Signal bad function in body
function Getlin return VString;
A2 : Long_Unsigned renames V2.Abs_Value;
begin
return (P1 and then not P2)
- or else (P1 and then P2 and then A1 > A2)
+ or else (P1 and then A1 > A2)
or else (not P1 and then not P2 and then A1 < A2);
end ">";
With_Dir : Boolean := False;
Strip : Natural := 0) return String
is
+ pragma Annotate (CodePeer, Skip_Analysis);
+ -- ??? To disable false positives currently generated
+
Tmp : GNAT.OS_Lib.String_Access;
function Internal_Strip (Full_Name : String) return String;
procedure Open
(Name : String;
- File : out ALI_File;
+ File : in out ALI_File;
Dependencies : Boolean := False);
-- Open a new ALI file. If Dependencies is True, the insert every library
-- file 'with'ed in the files database (used for gnatxref)
procedure Open
(Name : String;
- File : out ALI_File;
+ File : in out ALI_File;
Dependencies : Boolean := False)
is
Ali : String_Access renames File.Buffer;