Commit 447efaab authored by Jerome Hugues's avatar Jerome Hugues

* Clean up restriction pragmas, and add support for GNAT Runtime

parent 49d1de94
......@@ -30,6 +30,7 @@ ADA_SPECS = $(ADA_SPECS_WITH_BODY) $(srcdir)/polyorb_hi.ads \
$(srcdir)/polyorb_hi-transport_low_level.ads
ADA_BODIES = $(ADA_SPECS_WITH_BODY:.ads=.adb) \
$(srcdir)/polyorb_hi-output_low_level_gnatruntime.adb \
$(srcdir)/polyorb_hi-output_low_level_leon.adb \
$(srcdir)/polyorb_hi-output_low_level_native.adb \
$(srcdir)/polyorb_hi-transport_low_level_sockets.adb
......
-- Ada restrictions to be supported by the PolyORB HI, for HI targets
-- Ada restrictions to be supported by PolyORB-HI/Ada, for HI targets
--------------------------------------------------------------------------------
-- Enforce Ravenscar profile.
pragma Profile (Ravenscar); -- D.13.1
pragma Restrictions (No_Dependence => Ada.Finalization); -- 13.12.1 (12)
-- No controlled types, cannot be enforced for native compilers
-- because of the s-tpoben file.
--------------------------------------------------------------------------------
-- Activate SPARK Mode, even if we do not actually use it on the
-- target: the code has Spark_Mode disabled in some occurences,
-- without this pragma the code would be rejected.
--pragma Spark_Mode (On);
--------------------------------------------------------------------------------
-- The following define restrictions to be supported by the
-- PolyORB-HI, common restrictions
--
-- For each restriction, we list its definition place in the Ada 2005
-- reference manual.
pragma Restrictions (No_Allocators); -- H.4 (7)
-- pragma Restrictions (No_Floating_Point); -- H.4 (14)
pragma Restrictions (No_Access_Subprograms); -- H.4 (17)
pragma Restrictions (No_Unchecked_Access); -- H.4 (18)
pragma Restrictions (No_Dispatch); -- H.4 (19)
pragma Restrictions (No_IO); -- H.4 (20)
pragma Restrictions (No_Recursion); -- H.4 (22)
-- pragma Partition_Elaboration_Policy (Sequential); -- H.6 (3)
-- This policy eases task initial synchronization and the bootstrap
-- of the VM, see Ada 2005 Rationale for more details). (Not yet
-- supported by GNAT for Native platforms)
-- pragma Restriction_Warnings (No_Implementation_Attributes); -- 13.12 (2)
-- Style-check to enforce compliance with pure Ada, but also to avoid
-- the 'Unrestricted_Access attribute, which is GNAT specific.
-- pragma Restrictions (No_Obsolescent_Features); -- 13.12 (4)
-- Deactivated as of 20090702: GPL 2009 deprecated
-- GNAT.Sockets.Initialize, but it might still be required for older
-- compilers supported.
pragma Restrictions (No_Unchecked_Deallocation); -- J.13 (4)
-- Sibling of the No_Allocators restriction.
-- XXX to be replaced with a No_Dependence restriction
-- GNAT Specific restrictions
pragma Restrictions (No_Streams); -- GNAT specific
-- pragma Restrictions (No_Dependence => Ada.Streams); -- 13.12.1 (12)
-- No implicit dependency on Ada.Tags and other object oriented
-- compiler units. Cannot be enforced for native platforms because of
-- the g-socket file
-- pragma Restrictions (No_Direct_Boolean_Operators); -- GNAT specific
-- For the use of "and then" and "or else" in boolean operations
-- pragma Restrictions (No_Exception_Handlers); -- GNAT specific
-- Implied by GNAT Pro 5.03a1 for High-Integrity, for the Ravenscar
-- run-time, cannot be enforced for native compilers because of the
-- s-tpoben file.
-- pragma Restrictions (No_Enumeration_Maps); -- GNAT specific
-- Forbids <type>'Image for enumeration types. Cannot be supported
-- because some examples use it
-- pragma Restrictions (No_Secondary_Stack); -- GNAT specific
-- No unconstrained objects, including arrays, but also forbids
-- string concatenation. (GNAT specific)
-- pragma Restrictions (No_Implicit_Conditionals); -- GNAT specific
-- pragma Restrictions (No_Implicit_Loops); -- GNAT specific
-- Ada restrictions to be supported by PolyORB HI, for native targets
-- Ada restrictions to be supported by PolyORB-HI/Ada, for NATIVE targets
pragma Profile_Warnings (Ravenscar); -- D.13.1
--------------------------------------------------------------------------------
-- Enforce Ravenscar profile.
--
-- Note that NATIVE targets are not Ravenscar compatible, we simply
-- look for warning. The user must run the program with admin rights
-- to have the right scheduling behavior.
--pragma Task_Dispatching_Policy (FIFO_Within_Priotities); -- D.13.1
-- Note: GCC 4.3.5 does not support this policy, changed to binder
-- option "-T0" per section A.3 of the GNAT user manual
pragma Locking_Policy (Ceiling_Locking); -- D.13.1
pragma Profile_Warnings (Ravenscar); -- D.13.1
--------------------------------------------------------------------------------
-- Activate SPARK Mode, even if we do not actually use it on the
-- target: the code has Spark_Mode disabled in some occurences,
-- without this pragma the code would be rejected.
--pragma Spark_Mode (On);
--------------------------------------------------------------------------------
-- The following define restrictions to be supported by the
-- PolyORB-HI, common restrictions
--
-- For each restriction, we list its definition place in the Ada 2005
-- reference manual.
pragma Restrictions (No_Allocators); -- H.4 (7)
-- pragma Restrictions (No_Floating_Point); -- H.4 (14)
pragma Restrictions (No_Access_Subprograms); -- H.4 (17)
pragma Restrictions (No_Unchecked_Access); -- H.4 (18)
pragma Restrictions (No_Dispatch); -- H.4 (19)
pragma Restrictions (No_IO); -- H.4 (20)
pragma Restrictions (No_Recursion); -- H.4 (22)
-- pragma Partition_Elaboration_Policy (Sequential); -- H.6 (3)
-- This policy eases task initial synchronization and the bootstrap
-- of the VM, see Ada 2005 Rationale for more details). (Not yet
-- supported by GNAT for Native platforms)
-- pragma Restriction_Warnings (No_Implementation_Attributes); -- 13.12 (2)
-- Style-check to enforce compliance with pure Ada, but also to avoid
-- the 'Unrestricted_Access attribute, which is GNAT specific.
-- pragma Restrictions (No_Obsolescent_Features); -- 13.12 (4)
-- Deactivated as of 20090702: GPL 2009 deprecated
-- GNAT.Sockets.Initialize, but it might still be required for older
-- compilers supported.
pragma Restrictions (No_Unchecked_Deallocation); -- J.13 (4)
-- Sibling of the No_Allocators restriction.
-- XXX to be replaced with a No_Dependence restriction
-- GNAT Specific restrictions
pragma Restrictions (No_Streams); -- GNAT specific
-- pragma Restrictions (No_Direct_Boolean_Operators); -- GNAT specific
-- For the use of "and then" and "or else" in boolean operations
-- pragma Restrictions (No_Enumeration_Maps); -- GNAT specific
-- Forbids <type>'Image for enumeration types. Cannot be supported
-- because some examples use it
-- pragma Restrictions (No_Implicit_Conditionals); -- GNAT specific
-- pragma Restrictions (No_Implicit_Loops); -- GNAT specific
......@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 2006-2009 Telecom ParisTech, 2010-2015 ESA & ISAE. --
-- Copyright (C) 2006-2009 Telecom ParisTech, 2010-2017 ESA & ISAE. --
-- --
-- PolyORB-HI is free software; you can redistribute it and/or modify under --
-- terms of the GNU General Public License as published by the Free Soft- --
......@@ -177,8 +177,10 @@ package body PolyORB_HI.Output is
end if;
PolyORB_HI.Output_Low_Level.Put ("[");
-- XXX The following is disabled as some cross-runtime do not have
-- the capability to build Duration'Image
PolyORB_HI.Output_Low_Level.Put
(Duration'Image (To_Duration (Elapsed * 1000)));
(Integer'Image (Integer (To_Duration (Elapsed * 1000))));
PolyORB_HI.Output_Low_Level.Put ("] ");
PolyORB_HI.Output_Low_Level.Put (Text);
end Unprotected_Put;
......
------------------------------------------------------------------------------
-- --
-- PolyORB HI COMPONENTS --
-- --
-- P O L Y O R B _ H I . O U T P U T _ L O W _ L E V E L --
-- --
-- B o d y --
-- --
-- Copyright (C) 2017 ESA & ISAE. --
-- --
-- PolyORB-HI is free software; you can redistribute it and/or modify under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. PolyORB-HI is distributed in the hope that it will be useful, but --
-- WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- PolyORB-HI/Ada is maintained by the TASTE project --
-- (taste-users@lists.tuxfamily.org) --
-- --
------------------------------------------------------------------------------
package body PolyORB_HI.Output_Low_Level is
---------
-- Put --
---------
procedure Put (S : String) is
begin
null;
end Put;
--------------
-- New_Line --
--------------
procedure New_Line is
begin
null;
end New_Line;
end PolyORB_HI.Output_Low_Level;
......@@ -6,7 +6,7 @@
-- --
-- P r o j e c t --
-- --
-- Copyright (C) 2007-2009 Telecom ParisTech, 2010-2015 ESA & ISAE. --
-- Copyright (C) 2007-2009 Telecom ParisTech, 2010-2017 ESA & ISAE. --
-- --
-- PolyORB-HI is free software; you can redistribute it and/or modify under --
-- terms of the GNU General Public License as published by the Free Soft- --
......@@ -31,7 +31,8 @@
project PolyORB_HI is
type Target_Type is ("NATIVE", "LEON_ORK", "LEON_GNAT", "ERC32", "MARTEOS");
type Target_Type is
("NATIVE", "LEON_ORK", "LEON_GNAT", "ERC32", "MARTEOS", "GNAT_Runtime");
Target : Target_Type := external ("TARGET", "NATIVE");
type Build_Type is ("Debug", "Release", "Analyzable");
......@@ -122,8 +123,15 @@ project PolyORB_HI is
case Target is
when "NATIVE" | "MARTEOS" =>
for Local_Configuration_Pragmas use "native.adc";
when "LEON_ORK" | "LEON_GNAT" | "ERC32" =>
for Local_Configuration_Pragmas use "hi-e.adc";
when "GNAT_Runtime" =>
-- For GNAT runtimes, it is assumed an external configuration file
-- is provided
null;
end case;
end Compiler;
......@@ -132,8 +140,6 @@ project PolyORB_HI is
-------------
package Builder is
for Global_Configuration_Pragmas use "gnat.adc";
case Build is
when "Debug" =>
for Default_Switches ("Ada") use ("-s", "-m", "-g");
......@@ -170,7 +176,17 @@ project PolyORB_HI is
package Linker is
case Build is
when "Debug" =>
for Default_Switches ("ada") use ("-g");
case Target is
when "GNAT_Runtime" =>
-- For GNAT runtimes, we clean up unused symbols.
-- Unfortunately, this does not work for macOS
-- because of clang linker.
for Default_Switches ("ada") use ("-g", "-Wl,--gc-sections");
when others =>
for Default_Switches ("ada") use ("-g");
end case;
when "Release" =>
null;
end case;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment