Commit 54df6737 authored by yoogx's avatar yoogx

* Minor reformatting for GNAT GPL 2014 & GCC 4.9.x

parent 78b6cd55
......@@ -2,25 +2,16 @@ include $(top_srcdir)/Makefile.common
# The order of the project files is important for saving compile time
BUILD_PROJECTS=\
ocarina-core.gpr \
ocarina-frontends.gpr \
ocarina-backends.gpr \
ocarina-config.gpr \
ocarina-transfo.gpr \
BUILD_PROJECTS= ocarina-core.gpr ocarina-frontends.gpr \
ocarina-backends.gpr ocarina-config.gpr ocarina-transfo.gpr \
ocarina-main.gpr
# All project files have to be packaged with "make dist"
EXTRA_DIST=\
$(srcdir)/ocarina.gpr.in \
$(srcdir)/ocarina-frontends.gpr \
$(srcdir)/ocarina-backends.gpr \
$(srcdir)/ocarina-core.gpr \
$(srcdir)/ocarina-main.gpr \
$(srcdir)/ocarina-transfo.gpr \
$(srcdir)/ocarina-config.gpr \
$(srcdir)/restrictions.adc
EXTRA_DIST= $(srcdir)/ocarina.gpr.in $(srcdir)/ocarina-frontends.gpr \
$(srcdir)/ocarina-backends.gpr $(srcdir)/ocarina-core.gpr \
$(srcdir)/ocarina-main.gpr $(srcdir)/ocarina-transfo.gpr \
$(srcdir)/ocarina-config.gpr $(srcdir)/restrictions.adc
BUILD_STAMPS = $(BUILD_PROJECTS:.gpr=.gpr-build)
......@@ -30,20 +21,19 @@ CLEAN_STAMPS = $(CLEAN_PROJECTS:.gpr=.gpr-clean)
# Object directories (*.o, *.ali)
OBJECT_DIRS = $(top_builddir)/src/core/objects \
$(top_builddir)/src/frontends/objects \
$(top_builddir)/src/backends/objects \
$(top_builddir)/src/transfo/objects \
OBJECT_DIRS = $(top_builddir)/src/core/objects \
$(top_builddir)/src/frontends/objects \
$(top_builddir)/src/backends/objects \
$(top_builddir)/src/transfo/objects \
$(top_builddir)/src/main/objects
# Library directories (*.ali, *.a)
LIB_DIRS = $(top_builddir)/src/core/libs \
$(top_builddir)/src/frontends/libs \
$(top_builddir)/src/backends/libs \
$(top_builddir)/src/transfo/libs \
$(top_builddir)/src/config/libs \
$(top_builddir)/src/main/libs
LIB_DIRS = $(top_builddir)/src/core/libs \
$(top_builddir)/src/frontends/libs \
$(top_builddir)/src/backends/libs \
$(top_builddir)/src/transfo/libs \
$(top_builddir)/src/config/libs $(top_builddir)/src/main/libs
# All directories used for the build process. If the configure is
# performed from a directory different from the top source directory,
......@@ -60,17 +50,16 @@ BUILD_DIRS_STAMPS = $(BUILD_DIRS:=-stamp)
# Pseudo-IDL files that are used to generate the tree manipulators.
TREE_PIDL_SPECS = \
src/core/tree/ocarina-me_aadl-aadl_tree-nodes.idl \
src/core/tree/ocarina-me_aadl-aadl_instances-nodes.idl \
src/core/tree/ocarina-me_aadl_ba-ba_tree-nodes.idl \
src/core/tree/ocarina-me_real-real_tree-nodes.idl \
src/backends/ocarina-backends-ada_tree-nodes.idl \
src/backends/ocarina-backends-c_tree-nodes.idl \
src/backends/ocarina-backends-asn1_tree-nodes.idl \
src/backends/ocarina-backends-xml_tree-nodes.idl \
src/backends/ocarina-backends-pn-nodes.idl \
src/backends/ocarina-backends-mast_tree-nodes.idl \
TREE_PIDL_SPECS = src/core/tree/ocarina-me_aadl-aadl_tree-nodes.idl \
src/core/tree/ocarina-me_aadl-aadl_instances-nodes.idl \
src/core/tree/ocarina-me_aadl_ba-ba_tree-nodes.idl \
src/core/tree/ocarina-me_real-real_tree-nodes.idl \
src/backends/ocarina-backends-ada_tree-nodes.idl \
src/backends/ocarina-backends-c_tree-nodes.idl \
src/backends/ocarina-backends-asn1_tree-nodes.idl \
src/backends/ocarina-backends-xml_tree-nodes.idl \
src/backends/ocarina-backends-pn-nodes.idl \
src/backends/ocarina-backends-mast_tree-nodes.idl \
src/backends/ocarina-backends-rtsj_tree-nodes.idl
TREE_ADA_SPECS = ${addprefix $(top_builddir)/, $(TREE_PIDL_SPECS:.idl=.ads)}
......
......@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 2011-2012 ESA & ISAE. --
-- Copyright (C) 2011-2014 ESA & ISAE. --
-- --
-- Ocarina is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the --
......@@ -58,9 +58,10 @@ package body Ocarina.Backends.AADL_XML.Mapping is
function Map_HI_Node (E : Node_Id) return Node_Id is
N : constant Node_Id := New_Node (XTN.K_HI_Node);
begin
pragma Assert (AINU.Is_Process (E)
or else AINU.Is_System (E)
or else AINU.Is_Processor (E));
pragma Assert
(AINU.Is_Process (E)
or else AINU.Is_System (E)
or else AINU.Is_Processor (E));
if AINU.Is_System (E) then
Set_Str_To_Name_Buffer ("general");
......@@ -85,16 +86,16 @@ package body Ocarina.Backends.AADL_XML.Mapping is
-- Map_HI_Unit --
-----------------
function Map_HI_Unit (E : Node_Id)
return Node_Id is
U : Node_Id;
N : Node_Id;
P : Node_Id;
Root : Node_Id;
function Map_HI_Unit (E : Node_Id) return Node_Id is
U : Node_Id;
N : Node_Id;
P : Node_Id;
Root : Node_Id;
begin
pragma Assert (AINU.Is_System (E)
or else AINU.Is_Process (E)
or else AINU.Is_Processor (E));
pragma Assert
(AINU.Is_System (E)
or else AINU.Is_Process (E)
or else AINU.Is_Processor (E));
U := New_Node (XTN.K_HI_Unit, Identifier (E));
......@@ -105,8 +106,7 @@ package body Ocarina.Backends.AADL_XML.Mapping is
else
Get_Name_String
(To_XML_Name
(Display_Name (Identifier (Parent_Subcomponent (E)))));
(To_XML_Name (Display_Name (Identifier (Parent_Subcomponent (E)))));
end if;
Add_Str_To_Name_Buffer ("_aadl_xml");
......
......@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 2006-2009 Telecom ParisTech, 2010-2012 ESA & ISAE. --
-- Copyright (C) 2006-2009 Telecom ParisTech, 2010-2014 ESA & ISAE. --
-- --
-- Ocarina is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the --
......@@ -31,10 +31,10 @@
-- --
------------------------------------------------------------------------------
with Charset; use Charset;
with Locations; use Locations;
with Namet; use Namet;
with Utils; use Utils;
with Charset; use Charset;
with Locations; use Locations;
with Namet; use Namet;
with Utils; use Utils;
with Ocarina.Backends.Ada_Values; use Ocarina.Backends.Ada_Values;
with Ocarina.Backends.Ada_Tree.Nutils;
......@@ -175,25 +175,21 @@ package body Ocarina.Backends.Ada_Tree.Debug is
is
C : Node_Id;
begin
if A = "Next_Node"
or else A = "Package_Declaration"
then
if A = "Next_Node" or else A = "Package_Declaration" then
return;
end if;
N_Indents := N_Indents + 1;
W_Indents;
Write_Str (A);
Write_Str (A);
Write_Char (' ');
Write_Str (K);
Write_Str (K);
Write_Char (' ');
C := Node_Id (N);
if K = "Name_Id" then
Write_Line (Quoted (V));
elsif K = "Node_Id"
and then Present (C)
then
elsif K = "Node_Id" and then Present (C) then
case Kind (C) is
when K_Boolean .. K_String =>
Write_Line ('(' & Image (Kind (Node_Id (N))) & ')');
......@@ -228,9 +224,9 @@ package body Ocarina.Backends.Ada_Tree.Debug is
procedure W_Node_Header (N : Node_Id) is
begin
W_Indents;
Write_Int (Int (N));
Write_Int (Int (N));
Write_Char (' ');
Write_Str (Image (Kind (N)));
Write_Str (Image (Kind (N)));
Write_Char (' ');
Write_Line (Image (Loc (N)));
end W_Node_Header;
......
......@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 2006-2009 Telecom ParisTech, 2010-2012 ESA & ISAE. --
-- Copyright (C) 2006-2009 Telecom ParisTech, 2010-2014 ESA & ISAE. --
-- --
-- Ocarina is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the --
......@@ -39,16 +39,16 @@ package Ocarina.Backends.Ada_Tree.Debug is
N_Indents : Natural := 0;
procedure W_Eol (N : Natural := 1) renames Output.Write_Eol;
procedure W_Int (N : Int) renames Output.Write_Int;
procedure W_Line (N : String) renames Output.Write_Line;
procedure W_Str (N : String) renames Output.Write_Str;
procedure W_Eol (N : Natural := 1) renames Output.Write_Eol;
procedure W_Int (N : Int) renames Output.Write_Int;
procedure W_Line (N : String) renames Output.Write_Line;
procedure W_Str (N : String) renames Output.Write_Str;
procedure W_Indents;
procedure W_Boolean (N : Boolean);
procedure W_Byte (N : Byte);
procedure W_List_Id (L : List_Id);
procedure W_Node_Id (N : Node_Id);
procedure W_Boolean (N : Boolean);
procedure W_Byte (N : Byte);
procedure W_List_Id (L : List_Id);
procedure W_Node_Id (N : Node_Id);
procedure W_Node_Header (N : Node_Id);
procedure W_Node_Attribute
......
......@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 2009 Telecom ParisTech, 2010-2012 ESA & ISAE. --
-- Copyright (C) 2009 Telecom ParisTech, 2010-2014 ESA & ISAE. --
-- --
-- Ocarina is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the --
......@@ -31,8 +31,8 @@
-- --
------------------------------------------------------------------------------
with Namet; use Namet;
with Output; use Output;
with Namet; use Namet;
with Output; use Output;
with Ocarina.Backends.Ada_Tree.Nodes;
with Ocarina.Backends.Ada_Tree.Nutils;
......@@ -67,22 +67,25 @@ package body Ocarina.Backends.Ada_Tree.Generator.Spark is
-- Initialize withed package lists for a package specification
if Kind (N) = K_Package_Specification then
LS := Withed_Packages (N);
LB := Withed_Packages (Package_Implementation
(Package_Declaration (N)));
-- Initialize withed package lists for a subprogram specification
LB :=
Withed_Packages (Package_Implementation (Package_Declaration (N)));
-- Initialize withed package lists for a subprogram specification
elsif Kind (N) = K_Subprogram_Specification then
LS := Withed_Packages (N);
if Subprogram_Implementation
(Main_Subprogram_Unit (N)) /= No_Node then
LB := Withed_Packages (Subprogram_Implementation
(Main_Subprogram_Unit (N)));
if Subprogram_Implementation (Main_Subprogram_Unit (N)) /=
No_Node
then
LB :=
Withed_Packages
(Subprogram_Implementation (Main_Subprogram_Unit (N)));
end if;
-- Initialize withed package lists for a subprogram implementation
elsif Kind (N) = K_Subprogram_Implementation then
-- Initialize withed package lists for a subprogram implementation
elsif Kind (N) = K_Subprogram_Implementation then
LS := Withed_Packages (N);
if Subprogram_Specification (Main_Subprogram_Unit (N)) /= No_Node then
LB := Withed_Packages (Subprogram_Specification
(Main_Subprogram_Unit (N)));
LB :=
Withed_Packages
(Subprogram_Specification (Main_Subprogram_Unit (N)));
end if;
end if;
......
......@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 2006-2009 Telecom ParisTech, 2010-2013 ESA & ISAE. --
-- Copyright (C) 2006-2009 Telecom ParisTech, 2010-2014 ESA & ISAE. --
-- --
-- Ocarina is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the --
......@@ -139,10 +139,11 @@ package body Ocarina.Backends.Ada_Tree.Generator is
-------------------
function Get_File_Name (N : Node_Id) return Name_Id is
pragma Assert (Kind (N) = K_Package_Specification or else
Kind (N) = K_Package_Implementation or else
Kind (N) = K_Subprogram_Specification or else
Kind (N) = K_Subprogram_Implementation);
pragma Assert
(Kind (N) = K_Package_Specification
or else Kind (N) = K_Package_Implementation
or else Kind (N) = K_Subprogram_Specification
or else Kind (N) = K_Subprogram_Implementation);
Package_Spec_Suffix : constant String := ".ads";
Package_Body_Suffix : constant String := ".adb";
......@@ -161,10 +162,8 @@ package body Ocarina.Backends.Ada_Tree.Generator is
else
Get_Name_String
(Conventional_Base_Name
(Fully_Qualified_Name
(Defining_Identifier
(Main_Subprogram_Unit
(N)))));
(Fully_Qualified_Name
(Defining_Identifier (Main_Subprogram_Unit (N)))));
end if;
else
if Has_Custom_File_Name (Package_Declaration (N)) then
......@@ -172,10 +171,8 @@ package body Ocarina.Backends.Ada_Tree.Generator is
else
Get_Name_String
(Conventional_Base_Name
(Fully_Qualified_Name
(Defining_Identifier
(Package_Declaration
(N)))));
(Fully_Qualified_Name
(Defining_Identifier (Package_Declaration (N)))));
end if;
end if;
......@@ -497,7 +494,7 @@ package body Ocarina.Backends.Ada_Tree.Generator is
L := 1;
else
L := 0;
while L + 1 <= Name_Len and then Name_Buffer (L + 1) /= ' ' loop
while L + 1 <= Name_Len and then Name_Buffer (L + 1) /= ' ' loop
L := L + 1;
end loop;
end if;
......@@ -764,20 +761,15 @@ package body Ocarina.Backends.Ada_Tree.Generator is
-- Generate the different part of the component
-- association but add a new line after "=>"
Generate
(Defining_Identifier
(Excp_Handler_Alternative));
Generate (Defining_Identifier (Excp_Handler_Alternative));
Write_Space;
Write (Tok_Arrow);
Write_Eol;
Increment_Indentation;
Write_Indentation;
Generate
(Expression
(Excp_Handler_Alternative));
Generate (Expression (Excp_Handler_Alternative));
Generate_Statement_Delimiter
(Expression
(Excp_Handler_Alternative));
(Expression (Excp_Handler_Alternative));
Decrement_Indentation;
Excp_Handler_Alternative :=
......@@ -1171,9 +1163,9 @@ package body Ocarina.Backends.Ada_Tree.Generator is
-------------------------
procedure Generate_Expression (N : Node_Id) is
L_Expr : constant Node_Id := Left_Expr (N);
Op : constant Operator_Id := Operator (N);
R_Expr : constant Node_Id := Right_Expr (N);
L_Expr : constant Node_Id := Left_Expr (N);
Op : constant Operator_Id := Operator (N);
R_Expr : constant Node_Id := Right_Expr (N);
begin
-- Each expression having a right part and a left part is
-- systematically put between two parentheses.
......@@ -1455,7 +1447,7 @@ package body Ocarina.Backends.Ada_Tree.Generator is
---------------------------------------------
procedure Generate_Main_Subprogram_Implementation (N : Node_Id) is
Fd : File_Descriptor;
Fd : File_Descriptor;
begin
if Present (Subprogram_Specification (N)) then
Fd := Set_Output (Get_File_Name (Subprogram_Specification (N)));
......@@ -1537,8 +1529,8 @@ package body Ocarina.Backends.Ada_Tree.Generator is
Generate (Renamed_Entity (N));
Decrement_Indentation;
-- If an object renames another object, it cannot be
-- initialized,
-- If an object renames another object, it cannot be
-- initialized,
else
if Present (Expression (N)) then
Write_Space;
......@@ -1584,8 +1576,7 @@ package body Ocarina.Backends.Ada_Tree.Generator is
-- If the user wants to generates only the spec, or if the
-- package body is empty, we don't generate it.
if Disable_Pkg_Body_Gen
or else Is_Empty (Statements (N)) then
if Disable_Pkg_Body_Gen or else Is_Empty (Statements (N)) then
return;
end if;
......@@ -1648,12 +1639,11 @@ package body Ocarina.Backends.Ada_Tree.Generator is
Write_Indentation;
end if;
Write (Tok_End);
Write (Tok_End);
Write_Space;
Generate (Defining_Identifier (Package_Declaration (N)));
Generate_Statement_Delimiter
(Defining_Identifier
(Package_Declaration (N)));
(Defining_Identifier (Package_Declaration (N)));
Release_Output (Fd);
end Generate_Package_Implementation;
......@@ -1712,9 +1702,9 @@ package body Ocarina.Backends.Ada_Tree.Generator is
-- Do not generate empty non instanciated specs
if not Is_Instantiated_Package (N) and then
Is_Empty (Visible_Part (N)) and then
Is_Empty (Private_Part (N))
if not Is_Instantiated_Package (N)
and then Is_Empty (Visible_Part (N))
and then Is_Empty (Private_Part (N))
then
return;
end if;
......@@ -1792,8 +1782,7 @@ package body Ocarina.Backends.Ada_Tree.Generator is
Write_Space;
Generate (Defining_Identifier (Package_Declaration (N)));
Generate_Statement_Delimiter
(Defining_Identifier
(Package_Declaration (N)));
(Defining_Identifier (Package_Declaration (N)));
end if;
Release_Output (Fd);
......@@ -1814,7 +1803,7 @@ package body Ocarina.Backends.Ada_Tree.Generator is
Write_Str (Name_Buffer (1 .. Name_Len));
Write_Space;
Write (Tok_Colon);
Write (Tok_Colon);
Write_Space;
if Kind (Parameter_Type (N)) /= K_Access_Type_Definition then
......@@ -2285,7 +2274,7 @@ package body Ocarina.Backends.Ada_Tree.Generator is
Write (Tok_Is);
Write_Eol;