+2016-05-02 Arnaud Charlet <charlet@adacore.com>
+
+ * exp_ch5.adb, layout.adb, gnatcmd.adb exp_attr.adb, make.adb,
+ bindgen.adb, debug.adb, exp_pakd.adb, freeze.adb, sem_util.adb,
+ gnatlink.adb, switch-m.adb, exp_ch4.adb, repinfo.adb, adabkend.adb,
+ osint.adb: Remove dead code.
+
+2016-05-02 Yannick Moy <moy@adacore.com>
+
+ * a-tigeli.adb (Get_Line): Fix bound for test to
+ decide when to compensate for character 0 added by call to fgets.
+
2016-05-02 Ed Schonberg <schonberg@adacore.com>
* sem_ch4.adb (Analyze_Allocator): If the expression does not
K : Natural := Natural (P - S);
begin
- -- Now Buf (K + 2) should be 0, or otherwise Buf (K) is the 0
- -- put in by fgets, so compensate.
-
- if K + 2 > Buf'Last or else Buf (K + 2) /= ASCII.NUL then
+ -- If K + 2 is greater than N, then Buf (K + 1) cannot be a LM
+ -- character from the source file, as the call to fgets copied at
+ -- most N - 1 characters. Otherwise, either LM is a character from
+ -- the source file and then Buf (K + 2) should be 0, or LM is a
+ -- character put in Buf by memset and then Buf (K) is the 0 put in
+ -- by fgets. In both cases where LM does not come from the source
+ -- file, compensate.
+
+ if K + 2 > N or else Buf (K + 2) /= ASCII.NUL then
-- Incomplete last line, so remove the extra 0
------------------------------------------------------------------------------
-- --
--- GNAAMP COMPILER COMPONENTS --
+-- GNAT COMPILER COMPONENTS --
-- --
-- A D A B K E N D --
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2015, AdaCore --
+-- Copyright (C) 2001-2016, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
return; -- ignore this switch
-- The -x switch and its language name argument will generally be
- -- ignored by non-gcc back ends (e.g. the GNAAMP back end). In any
- -- case, we save the switch and argument in the compilation switches.
+ -- ignored by non-gcc back ends. In any case, we save the switch and
+ -- argument in the compilation switches.
elsif Switch_Chars (First .. Last) = "x" then
Lib.Store_Compilation_Switch (Switch_Chars);
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2015, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2016, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
if CodePeer_Mode then
WBI (" begin");
- -- When compiling for the AAMP small library, where the standard library
- -- is no longer suppressed, we still want to exclude the setting of the
- -- various imported globals, which aren't present for that library.
-
- elsif AAMP_On_Target and then Configurable_Run_Time_On_Target then
- WBI (" begin");
- WBI (" null;");
-
-- If the standard library is suppressed, then the only global variables
-- that might be needed (by the Ravenscar profile) are the priority and
-- the processor for the environment task.
then
Set_String (" E");
Set_Unit_Number (Unum_Spec);
-
- -- The AAMP target has no notion of shared libraries, and
- -- there's no possibility of reelaboration, so we treat the
- -- the elaboration var as a flag instead of a counter and
- -- simply set it.
-
- if AAMP_On_Target then
- Set_String (" := 1;");
-
- -- Otherwise (normal case), increment elaboration counter
-
- else
- Set_String (" := E");
- Set_Unit_Number (Unum_Spec);
- Set_String (" + 1;");
- end if;
-
- Write_Statement_Buffer;
-
- -- In the special case where the target is AAMP and the unit is
- -- a spec with a body, the elaboration entity is initialized
- -- here. This is done because it's the only way to accomplish
- -- initialization of such entities, as there is no mechanism
- -- for load time global variable initialization on AAMP.
-
- elsif AAMP_On_Target
- and then U.Utype = Is_Spec
- and then Units.Table (Unum_Spec).Set_Elab_Entity
- then
- Set_String (" E");
+ Set_String (" := E");
Set_Unit_Number (Unum_Spec);
- Set_String (" := 0;");
+ Set_String (" + 1;");
Write_Statement_Buffer;
end if;
-- variables, only calls to 'Elab* subprograms.
else
- -- In the special case where the target is AAMP and the unit is
- -- a spec with a body, the elaboration entity is initialized
- -- here. This is done because it's the only way to accomplish
- -- initialization of such entities, as there is no mechanism
- -- for load time global variable initialization on AAMP.
-
- if AAMP_On_Target
- and then U.Utype = Is_Spec
- and then Units.Table (Unum_Spec).Set_Elab_Entity
- then
- Set_String (" E");
- Set_Unit_Number (Unum_Spec);
- Set_String (" := 0;");
- Write_Statement_Buffer;
- end if;
-
-- Check incompatibilities with No_Multiple_Elaboration
if not CodePeer_Mode
then
Set_String (" E");
Set_Unit_Number (Unum_Spec);
-
- -- The AAMP target has no notion of shared libraries, and
- -- there's no possibility of reelaboration, so we treat the
- -- the elaboration var as a flag instead of a counter and
- -- simply set it.
-
- if AAMP_On_Target then
- Set_String (" := 1;");
-
- -- Otherwise (normal case), increment elaboration counter
-
- else
- Set_String (" := E");
- Set_Unit_Number (Unum_Spec);
- Set_String (" + 1;");
- end if;
-
+ Set_String (" := E");
+ Set_Unit_Number (Unum_Spec);
+ Set_String (" + 1;");
Write_Statement_Buffer;
end if;
end if;
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2015, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2016, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- d.p
-- d.q
-- d.r Enable OK_To_Reorder_Components in non-variant records
- -- d.s Disable expansion of slice move, use memmove
+ -- d.s
-- d.t Disable static allocation of library level dispatch tables
-- d.u Enable Modify_Tree_For_C (update tree for c)
-- d.v Enable OK_To_Reorder_Components in variant records
-- d.r Forces the flag OK_To_Reorder_Components to be set in all record
-- base types that have no discriminants.
- -- d.s Normally the compiler expands slice moves into loops if overlap
- -- might be possible. This debug flag inhibits that expansion, and
- -- the back end is expected to use an appropriate routine to handle
- -- overlap, based on Forward_OK and Backwards_OK flags.
-
-- d.t The compiler has been modified (a fairly extensive modification)
-- to generate static dispatch tables for library level tagged types.
-- This debug switch disables this modification and reverts to the
-- code generation step.
-- d.z Restore previous front-end support for Inline_Always. In default
- -- mode, for targets that use the GCC back end (i.e. currently all
- -- targets except AAMP and GNATprove), Inline_Always is handled by the
- -- back end. Use of this switch restores the previous handling of
- -- Inline_Always by the front end on such targets. For the targets
- -- that do not use the GCC back end, this switch is ignored.
+ -- mode, for targets that use the GCC back end, Inline_Always is
+ -- handled by the back end. Use of this switch restores the previous
+ -- handling of Inline_Always by the front end on such targets. For the
+ -- targets that do not use the GCC back end, this switch is ignored.
-- d.A There seems to be a problem with ASIS if we activate the circuit
-- for reading and writing the aspect specification hash table, so
-- that appear in GNAT's library, but will generate calls via rtsfind
-- to library routines for user code.
- -- This is disabled for AAMP, to avoid creating dependences on files not
- -- supported in the AAMP library (such as s-fileio.adb).
-
-- Note: In the case of using a configurable run time, it is very likely
-- that stream routines for string types are not present (they require
-- file system support). In this case, the specific stream routines for
-- instead. That is why we include the test Is_Available when dealing
-- with these cases.
- if not AAMP_On_Target
- and then
- not Is_Predefined_File_Name (Unit_File_Name (Current_Sem_Unit))
- then
+ if not Is_Predefined_File_Name (Unit_File_Name (Current_Sem_Unit)) then
-- Storage_Array as defined in package System.Storage_Elements
if Is_RTE (Base_Typ, RE_Storage_Array) then
then
Etyp := Standard_Long_Long_Integer;
- -- Overflow checking is the only choice on the AAMP target, where
- -- arithmetic instructions check overflow automatically, so only
- -- one version of the exponentiation unit is needed.
-
- if Ovflo or AAMP_On_Target then
+ if Ovflo then
Rent := RE_Exp_Long_Long_Integer;
else
Rent := RE_Exn_Long_Long_Integer;
elsif Is_Signed_Integer_Type (Rtyp) then
Etyp := Standard_Integer;
- -- Overflow checking is the only choice on the AAMP target, where
- -- arithmetic instructions check overflow automatically, so only
- -- one version of the exponentiation unit is needed.
-
- if Ovflo or AAMP_On_Target then
+ if Ovflo then
Rent := RE_Exp_Integer;
else
Rent := RE_Exn_Integer;
else
-- Apply optimization x mod 1 = 0. We don't really need that with
- -- gcc, but it is useful with other back ends (e.g. AAMP), and is
- -- certainly harmless.
+ -- gcc, but it is useful with other back ends and is certainly
+ -- harmless.
if Is_Integer_Type (Etype (N))
and then Compile_Time_Known_Value (Right)
Right := Right_Opnd (N);
-- Apply optimization x rem 1 = 0. We don't really need that with gcc,
- -- but it is useful with other back ends (e.g. AAMP), and is certainly
- -- harmless.
+ -- but it is useful with other back ends, and is certainly harmless.
if Is_Integer_Type (Etype (N))
and then Compile_Time_Known_Value (Right)
return;
end if;
- -- Nothing to do if special -gnatd.P debug flag set or target is AAMP.
- -- For AAMP the 64-bit arithmetic package would get dragged in, which
- -- we want to avoid, plus this optimization has limited benefit on AAMP.
+ -- Nothing to do if special -gnatd.P debug flag set.
- if Debug_Flag_Dot_PP or else AAMP_On_Target then
+ if Debug_Flag_Dot_PP then
return;
end if;
with Snames; use Snames;
with Stand; use Stand;
with Stringt; use Stringt;
-with Targparm; use Targparm;
with Tbuild; use Tbuild;
with Uintp; use Uintp;
with Validsw; use Validsw;
-- then the outcome depends on the capabilities of the back end.
if not Loop_Required then
+ -- Assume the back end can deal with all cases of overlap by
+ -- falling back to memmove if it cannot use a more efficient
+ -- approach.
- -- The GCC back end can deal with all cases of overlap by falling
- -- back to memmove if it cannot use a more efficient approach.
-
- if not AAMP_On_Target then
- return;
-
- -- Assume other back ends can handle it if Forwards_OK is set
-
- elsif Forwards_OK (N) then
- return;
-
- -- If Forwards_OK is not set, the back end will need something
- -- like memmove to handle the move. For now, this processing is
- -- activated using the .s debug flag (-gnatd.s).
-
- elsif Debug_Flag_Dot_S then
- return;
- end if;
+ return;
end if;
-- At this stage we have to generate an explicit loop, and we have
Analyze_And_Resolve (Rhs, Ctyp);
end if;
- -- For the AAMP target, indexing of certain packed array is passed
- -- through to the back end without expansion, because the expansion
- -- results in very inefficient code on that target. This allows the
- -- GNAAMP back end to generate specialized macros that support more
- -- efficient indexing of packed arrays with components having sizes
- -- that are small powers of two.
-
- if AAMP_On_Target
- and then (Csiz = 1 or else Csiz = 2 or else Csiz = 4)
- then
- return;
- end if;
-
-- Case of component size 1,2,4 or any component size for the modular
-- case. These are the cases for which we can inline the code.
Ctyp := Component_Type (Atyp);
Csiz := UI_To_Int (Component_Size (Atyp));
- -- For the AAMP target, indexing of certain packed array is passed
- -- through to the back end without expansion, because the expansion
- -- results in very inefficient code on that target. This allows the
- -- GNAAMP back end to generate specialized macros that support more
- -- efficient indexing of packed arrays with components having sizes
- -- that are small powers of two.
-
- if AAMP_On_Target
- and then (Csiz = 1 or else Csiz = 2 or else Csiz = 4)
- then
- return;
- end if;
-
-- Case of component size 1,2,4 or any component size for the modular
-- case. These are the cases for which we can inline the code.
and then Convention (E) /= Convention_Intrinsic
-- Assume that ASM interface knows what it is doing. This deals
- -- with unsigned.ads in the AAMP back end.
+ -- with e.g. unsigned.ads in the AAMP back end.
and then Convention (E) /= Convention_Assembler
then
with Stringt;
with Switch; use Switch;
with Table;
-with Targparm; use Targparm;
with Tempdir;
with Types; use Types;
procedure Output_Version is
begin
- if AAMP_On_Target then
- Put ("GNAAMP ");
- else
- Put ("GNAT ");
- end if;
-
+ Put ("GNAT ");
Put_Line (Gnatvsn.Gnat_Version_String);
Put_Line ("Copyright 1996-" & Gnatvsn.Current_Year
& ", Free Software Foundation, Inc.");
New_Line;
for C in Command_List'Range loop
- if Targparm.AAMP_On_Target then
- Put ("gnaampcmd ");
- else
- Put ("gnat ");
- end if;
-
+ Put ("gnat ");
Put (To_Lower (Command_List (C).Cname.all));
Set_Col (25);
Put (Program_Name (Command_List (C).Unixcmd.all, "gnat").all);
First_Switches.Init;
First_Switches.Set_Last (0);
- -- Set AAMP_On_Target from command name, for testing in Osint.Program_Name
- -- to handle the mapping of GNAAMP tool names. We don't extract it from
- -- system.ads, as there may be no default runtime.
-
- Find_Program_Name;
- AAMP_On_Target := Name_Buffer (1 .. Name_Len) = "gnaampcmd";
-
-- Put the command line in environment variable GNAT_DRIVER_COMMAND_LINE,
-- so that the spawned tool may know the way the GNAT driver was invoked.
Stack_Op : Boolean := False;
begin
- if AAMP_On_Target then
-
- -- Remove extraneous flags not relevant for AAMP
-
- for J in reverse Linker_Options.First .. Linker_Options.Last loop
- if Linker_Options.Table (J)'Length = 0
- or else Linker_Options.Table (J) (1 .. 3) = "-Wl"
- or else Linker_Options.Table (J) (1 .. 3) = "-sh"
- or else Linker_Options.Table (J) (1 .. 2) = "-O"
- or else Linker_Options.Table (J) (1 .. 2) = "-g"
- then
- Linker_Options.Table (J .. Linker_Options.Last - 1) :=
- Linker_Options.Table (J + 1 .. Linker_Options.Last);
- Linker_Options.Decrement_Last;
- Num_Args := Num_Args - 1;
- end if;
- end loop;
- end if;
-
-- Remove duplicate stack size setting from the Linker_Options table.
-- The stack setting option "-Xlinker --stack=R,C" can be found
-- in one line when set by a pragma Linker_Options or in two lines
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2015, Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2016, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
then
Init_Size (E, 2 * System_Address_Size);
- -- When the target is AAMP, access-to-subprogram types are fat
- -- pointers consisting of the subprogram address and a static link,
- -- with the exception of library-level access types (including
- -- library-level anonymous access types, such as for components),
- -- where a simple subprogram address is used.
-
- elsif AAMP_On_Target
- and then
- ((Ekind (E) = E_Access_Subprogram_Type
- and then Present (Enclosing_Subprogram (E)))
- or else
- (Ekind (E) = E_Anonymous_Access_Subprogram_Type
- and then
- (not Is_Local_Anonymous_Access (E)
- or else Present (Enclosing_Subprogram (E)))))
- then
- Init_Size (E, 2 * System_Address_Size);
-
-- Normal case of thin pointer
else
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2015, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2016, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
Comp_Last := Comp_Last + 1;
Comp_Args (Comp_Last) := AdaSCIL_Flag;
- elsif not Ada_File_Name (S) and then not Targparm.AAMP_On_Target then
+ elsif not Ada_File_Name (S) then
Comp_Last := Comp_Last + 1;
Comp_Args (Comp_Last) := Ada_Flag_1;
Comp_Last := Comp_Last + 1;
Finish_Program (Project_Tree, E_Success);
else
- -- Call Get_Target_Parameters to ensure that AAMP_On_Target gets
+ -- Call Get_Target_Parameters to ensure that flags are properly
-- set before calling Usage.
Targparm.Get_Target_Parameters;
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2015, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2016, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
Start_Of_Suffix : Positive;
begin
- -- GNAAMP tool names require special treatment
-
- if AAMP_On_Target then
-
- -- The name "gcc" is mapped to "gnaamp" (the compiler driver)
-
- if Nam = "gcc" then
- return new String'("gnaamp");
-
- -- Tool names starting with "gnat" are mapped by substituting the
- -- string "gnaamp" for "gnat" (for example, "gnatpp" => "gnaamppp").
-
- elsif Nam'Length >= 4
- and then Nam (Nam'First .. Nam'First + 3) = "gnat"
- then
- return new String'("gnaamp" & Nam (Nam'First + 4 .. Nam'Last));
-
- -- No other mapping rules, so we continue and handle any other forms
- -- of tool names the same as on other targets.
-
- else
- null;
- end if;
- end if;
-
-- Get the name of the current program being executed
Find_Program_Name;
-- --
-- B o d y --
-- --
--- Copyright (C) 1999-2015, Free Software Foundation, Inc. --
+-- Copyright (C) 1999-2016, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- this introduces problematic dependencies in ASIS, and in any case this
-- value is assumed to be 8 for the implementation of the DDA.
- -- This is wrong for AAMP???
-
---------------------------------------
-- Representation of gcc Expressions --
---------------------------------------
-- Addressable --
-----------------
- -- For now, just 8/16/32/64. but analyze later if AAMP is special???
+ -- For now, just 8/16/32/64
function Addressable (V : Uint) return Boolean is
begin
-- --
-- B o d y --
-- --
--- Copyright (C) 2001-2014, Free Software Foundation, Inc. --
+-- Copyright (C) 2001-2016, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
Add_Switch_Component ("-mrtp");
end if;
- -- Switch for universal addressing on AAMP target
-
- elsif Switch_Chars'Length >= 5
- and then
- Switch_Chars
- (Switch_Chars'First .. Switch_Chars'First + 4) = "-univ"
- then
- Add_Switch_Component (Switch_Chars);
-
- -- Switch for specifying AAMP target library
-
- elsif Switch_Chars'Length > 13
- and then
- Switch_Chars (Switch_Chars'First .. Switch_Chars'First + 12)
- = "-aamp_target="
- then
- Add_Switch_Component (Switch_Chars);
-
-- Special case for -fstack-check (alias for
-- -fstack-check=specific)