Commit 0567ae8d by Arnaud Charlet

[multiple changes]

2014-01-24  Pascal Obry  <obry@adacore.com>

	* prj-attr.adb, projects.texi, snames.ads-tmpl: Add Excluded_Patterns
	attribute definition.

2014-01-24  Vincent Celier  <celier@adacore.com>

	* makeutl.adb (Queue.Insert_No_Roots): In gprbuild, do not put
	in the Queue the same source (same path, same multi-source index)
	from the same project file, to avoid compiling several times
	the same source.

2014-01-24  Eric Botcazou  <ebotcazou@adacore.com>

	* einfo.ads (First_Rep_Item): Remove obsolete stuff.
	(Has_Gigi_Rep_Item): Likewise.
	* sem_prag.adb (Analyze_Pragma) <Pragma_Linker_Section>: Do not set
	Has_Gigi_Rep_Item for objects.
	* gcc-interface/decl.c (prepend_one_attribute_to): Rename into...
	(prepend_one_attribute): ...this.
	(prepend_one_attribute_pragma): New function extracted from...
	(prepend_attributes): ...here.  Swap the parameters for consistency.
	(gnat_to_gnu_entity): Adjust calls to prepend_one_attribute_to and to
	prepend_attributes.
	<object>: Deal with a pragma Linker_Section on a constant
	or variable.  <E_Function>: Deal with a pragma Linker_Section
	on a subprogram.
	(get_minimal_subprog_decl): Adjust calls to prepend_one_attribute_to.

2014-01-24  Vincent Celier  <celier@adacore.com>

	* opt.ads: Minor comment update.

From-SVN: r207028
parent 4437ea95
2014-01-24 Pascal Obry <obry@adacore.com>
* prj-attr.adb, projects.texi, snames.ads-tmpl: Add Excluded_Patterns
attribute definition.
2014-01-24 Vincent Celier <celier@adacore.com>
* makeutl.adb (Queue.Insert_No_Roots): In gprbuild, do not put
in the Queue the same source (same path, same multi-source index)
from the same project file, to avoid compiling several times
the same source.
2014-01-24 Eric Botcazou <ebotcazou@adacore.com>
* einfo.ads (First_Rep_Item): Remove obsolete stuff.
(Has_Gigi_Rep_Item): Likewise.
* sem_prag.adb (Analyze_Pragma) <Pragma_Linker_Section>: Do not set
Has_Gigi_Rep_Item for objects.
* gcc-interface/decl.c (prepend_one_attribute_to): Rename into...
(prepend_one_attribute): ...this.
(prepend_one_attribute_pragma): New function extracted from...
(prepend_attributes): ...here. Swap the parameters for consistency.
(gnat_to_gnu_entity): Adjust calls to prepend_one_attribute_to and to
prepend_attributes.
<object>: Deal with a pragma Linker_Section on a constant
or variable. <E_Function>: Deal with a pragma Linker_Section
on a subprogram.
(get_minimal_subprog_decl): Adjust calls to prepend_one_attribute_to.
2014-01-24 Vincent Celier <celier@adacore.com>
* opt.ads: Minor comment update.
2014-01-24 Robert Dewar <dewar@adacore.com> 2014-01-24 Robert Dewar <dewar@adacore.com>
* sem_prag.adb (Analyze_Input_Output): Add missing error check * sem_prag.adb (Analyze_Input_Output): Add missing error check
......
...@@ -1290,7 +1290,6 @@ package Einfo is ...@@ -1290,7 +1290,6 @@ package Einfo is
-- --
-- Machine_Attribute pragma -- Machine_Attribute pragma
-- Link_Alias pragma -- Link_Alias pragma
-- Linker_Section pragma
-- Linker_Constructor pragma -- Linker_Constructor pragma
-- Linker_Destructor pragma -- Linker_Destructor pragma
-- Weak_External pragma -- Weak_External pragma
...@@ -1299,10 +1298,6 @@ package Einfo is ...@@ -1299,10 +1298,6 @@ package Einfo is
-- If any of these items are present, then the flag Has_Gigi_Rep_Item is -- If any of these items are present, then the flag Has_Gigi_Rep_Item is
-- set, indicating that Gigi should search the chain. -- set, indicating that Gigi should search the chain.
-- --
-- Note that in the case of Linker_Section, this is set only for objects,
-- and only for transitional use until the new Linker_Section_Pragma
-- field is properly processed by the back end.
--
-- Other representation items are included in the chain so that error -- Other representation items are included in the chain so that error
-- messages can easily locate the relevant nodes for posting errors. -- messages can easily locate the relevant nodes for posting errors.
-- Note in particular that size clauses are defined only for this -- Note in particular that size clauses are defined only for this
...@@ -1559,7 +1554,6 @@ package Einfo is ...@@ -1559,7 +1554,6 @@ package Einfo is
-- --
-- Machine_Attribute pragma -- Machine_Attribute pragma
-- Linker_Alias pragma -- Linker_Alias pragma
-- Linker_Section pragma
-- Linker_Constructor pragma -- Linker_Constructor pragma
-- Linker_Destructor pragma -- Linker_Destructor pragma
-- Weak_External pragma -- Weak_External pragma
...@@ -1569,10 +1563,6 @@ package Einfo is ...@@ -1569,10 +1563,6 @@ package Einfo is
-- process any of these items that appear. At least one such item will -- process any of these items that appear. At least one such item will
-- be present. -- be present.
-- --
-- Note that in the case of Linker_Section, this is set only for objects,
-- and only for transitional use until the new Linker_Section_Pragma
-- field is properly processed by the back end.
-- Has_Homonym (Flag56) -- Has_Homonym (Flag56)
-- Defined in all entities. Set if an entity has a homonym in the same -- Defined in all entities. Set if an entity has a homonym in the same
-- scope. Used by Gigi to generate unique names for such entities. -- scope. Used by Gigi to generate unique names for such entities.
......
...@@ -130,9 +130,10 @@ static GTY ((if_marked ("tree_int_map_marked_p"), ...@@ -130,9 +130,10 @@ static GTY ((if_marked ("tree_int_map_marked_p"),
param_is (struct tree_int_map))) htab_t annotate_value_cache; param_is (struct tree_int_map))) htab_t annotate_value_cache;
static bool allocatable_size_p (tree, bool); static bool allocatable_size_p (tree, bool);
static void prepend_one_attribute_to (struct attrib **, static void prepend_one_attribute (struct attrib **,
enum attr_type, tree, tree, Node_Id); enum attr_type, tree, tree, Node_Id);
static void prepend_attributes (Entity_Id, struct attrib **); static void prepend_one_attribute_pragma (struct attrib **, Node_Id);
static void prepend_attributes (struct attrib **, Entity_Id);
static tree elaborate_expression (Node_Id, Entity_Id, tree, bool, bool, bool); static tree elaborate_expression (Node_Id, Entity_Id, tree, bool, bool, bool);
static bool type_has_variable_size (tree); static bool type_has_variable_size (tree);
static tree elaborate_expression_1 (tree, Entity_Id, tree, bool, bool); static tree elaborate_expression_1 (tree, Entity_Id, tree, bool, bool);
...@@ -363,7 +364,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ...@@ -363,7 +364,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
/* Handle any attributes directly attached to the entity. */ /* Handle any attributes directly attached to the entity. */
if (Has_Gigi_Rep_Item (gnat_entity)) if (Has_Gigi_Rep_Item (gnat_entity))
prepend_attributes (gnat_entity, &attr_list); prepend_attributes (&attr_list, gnat_entity);
/* Do some common processing for types. */ /* Do some common processing for types. */
if (is_type) if (is_type)
...@@ -377,8 +378,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ...@@ -377,8 +378,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
if (Base_Type (gnat_entity) != gnat_entity if (Base_Type (gnat_entity) != gnat_entity
&& !Is_First_Subtype (gnat_entity) && !Is_First_Subtype (gnat_entity)
&& Has_Gigi_Rep_Item (First_Subtype (Base_Type (gnat_entity)))) && Has_Gigi_Rep_Item (First_Subtype (Base_Type (gnat_entity))))
prepend_attributes (First_Subtype (Base_Type (gnat_entity)), prepend_attributes (&attr_list,
&attr_list); First_Subtype (Base_Type (gnat_entity)));
/* Compute a default value for the size of an elementary type. */ /* Compute a default value for the size of an elementary type. */
if (Known_Esize (gnat_entity) && Is_Elementary_Type (gnat_entity)) if (Known_Esize (gnat_entity) && Is_Elementary_Type (gnat_entity))
...@@ -1470,6 +1471,12 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ...@@ -1470,6 +1471,12 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
(TREE_TYPE (TYPE_FIELDS (gnu_type)))))) (TREE_TYPE (TYPE_FIELDS (gnu_type))))))
static_p = true; static_p = true;
/* Deal with a pragma Linker_Section on a constant or variable. */
if ((kind == E_Constant || kind == E_Variable)
&& Present (Linker_Section_Pragma (gnat_entity)))
prepend_one_attribute_pragma (&attr_list,
Linker_Section_Pragma (gnat_entity));
/* Now create the variable or the constant and set various flags. */ /* Now create the variable or the constant and set various flags. */
gnu_decl gnu_decl
= create_var_decl (gnu_entity_name, gnu_ext_name, gnu_type, = create_var_decl (gnu_entity_name, gnu_ext_name, gnu_type,
...@@ -4575,27 +4582,34 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ...@@ -4575,27 +4582,34 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
} }
} }
/* Deal with platform-specific calling conventions. */
if (Has_Stdcall_Convention (gnat_entity)) if (Has_Stdcall_Convention (gnat_entity))
prepend_one_attribute_to prepend_one_attribute
(&attr_list, ATTR_MACHINE_ATTRIBUTE, (&attr_list, ATTR_MACHINE_ATTRIBUTE,
get_identifier ("stdcall"), NULL_TREE, get_identifier ("stdcall"), NULL_TREE,
gnat_entity); gnat_entity);
else if (Has_Thiscall_Convention (gnat_entity)) else if (Has_Thiscall_Convention (gnat_entity))
prepend_one_attribute_to prepend_one_attribute
(&attr_list, ATTR_MACHINE_ATTRIBUTE, (&attr_list, ATTR_MACHINE_ATTRIBUTE,
get_identifier ("thiscall"), NULL_TREE, get_identifier ("thiscall"), NULL_TREE,
gnat_entity); gnat_entity);
/* If we should request stack realignment for a foreign convention /* If we should request stack realignment for a foreign convention
subprogram, do so. Note that this applies to task entry points in subprogram, do so. Note that this applies to task entry points
particular. */ in particular. */
if (FOREIGN_FORCE_REALIGN_STACK if (FOREIGN_FORCE_REALIGN_STACK
&& Has_Foreign_Convention (gnat_entity)) && Has_Foreign_Convention (gnat_entity))
prepend_one_attribute_to prepend_one_attribute
(&attr_list, ATTR_MACHINE_ATTRIBUTE, (&attr_list, ATTR_MACHINE_ATTRIBUTE,
get_identifier ("force_align_arg_pointer"), NULL_TREE, get_identifier ("force_align_arg_pointer"), NULL_TREE,
gnat_entity); gnat_entity);
/* Deal with a pragma Linker_Section on a subprogram. */
if ((kind == E_Function || kind == E_Procedure)
&& Present (Linker_Section_Pragma (gnat_entity)))
prepend_one_attribute_pragma (&attr_list,
Linker_Section_Pragma (gnat_entity));
/* The lists have been built in reverse. */ /* The lists have been built in reverse. */
gnu_param_list = nreverse (gnu_param_list); gnu_param_list = nreverse (gnu_param_list);
if (has_stub) if (has_stub)
...@@ -5456,11 +5470,11 @@ get_minimal_subprog_decl (Entity_Id gnat_entity) ...@@ -5456,11 +5470,11 @@ get_minimal_subprog_decl (Entity_Id gnat_entity)
gnu_ext_name = create_concat_name (gnat_entity, NULL); gnu_ext_name = create_concat_name (gnat_entity, NULL);
if (Has_Stdcall_Convention (gnat_entity)) if (Has_Stdcall_Convention (gnat_entity))
prepend_one_attribute_to (&attr_list, ATTR_MACHINE_ATTRIBUTE, prepend_one_attribute (&attr_list, ATTR_MACHINE_ATTRIBUTE,
get_identifier ("stdcall"), NULL_TREE, get_identifier ("stdcall"), NULL_TREE,
gnat_entity); gnat_entity);
else if (Has_Thiscall_Convention (gnat_entity)) else if (Has_Thiscall_Convention (gnat_entity))
prepend_one_attribute_to (&attr_list, ATTR_MACHINE_ATTRIBUTE, prepend_one_attribute (&attr_list, ATTR_MACHINE_ATTRIBUTE,
get_identifier ("thiscall"), NULL_TREE, get_identifier ("thiscall"), NULL_TREE,
gnat_entity); gnat_entity);
...@@ -6071,7 +6085,7 @@ allocatable_size_p (tree gnu_size, bool static_p) ...@@ -6071,7 +6085,7 @@ allocatable_size_p (tree gnu_size, bool static_p)
NAME, ARGS and ERROR_POINT. */ NAME, ARGS and ERROR_POINT. */
static void static void
prepend_one_attribute_to (struct attrib ** attr_list, prepend_one_attribute (struct attrib **attr_list,
enum attr_type attr_type, enum attr_type attr_type,
tree attr_name, tree attr_name,
tree attr_args, tree attr_args,
...@@ -6088,27 +6102,17 @@ prepend_one_attribute_to (struct attrib ** attr_list, ...@@ -6088,27 +6102,17 @@ prepend_one_attribute_to (struct attrib ** attr_list,
*attr_list = attr; *attr_list = attr;
} }
/* Prepend to ATTR_LIST the list of attributes for GNAT_ENTITY, if any. */ /* Prepend to ATTR_LIST an entry for an attribute provided by GNAT_PRAGMA. */
static void static void
prepend_attributes (Entity_Id gnat_entity, struct attrib ** attr_list) prepend_one_attribute_pragma (struct attrib **attr_list, Node_Id gnat_pragma)
{ {
Node_Id gnat_temp; const Node_Id gnat_arg = Pragma_Argument_Associations (gnat_pragma);
/* Attributes are stored as Representation Item pragmas. */
for (gnat_temp = First_Rep_Item (gnat_entity); Present (gnat_temp);
gnat_temp = Next_Rep_Item (gnat_temp))
if (Nkind (gnat_temp) == N_Pragma)
{
tree gnu_arg0 = NULL_TREE, gnu_arg1 = NULL_TREE; tree gnu_arg0 = NULL_TREE, gnu_arg1 = NULL_TREE;
Node_Id gnat_assoc = Pragma_Argument_Associations (gnat_temp);
enum attr_type etype; enum attr_type etype;
/* Map the kind of pragma at hand. Skip if this is not one /* Map the pragma at hand. Skip if this isn't one we know how to handle. */
we know how to handle. */ switch (Get_Pragma_Id (Chars (Pragma_Identifier (gnat_pragma))))
switch (Get_Pragma_Id (Chars (Pragma_Identifier (gnat_temp))))
{ {
case Pragma_Machine_Attribute: case Pragma_Machine_Attribute:
etype = ATTR_MACHINE_ATTRIBUTE; etype = ATTR_MACHINE_ATTRIBUTE;
...@@ -6139,31 +6143,32 @@ prepend_attributes (Entity_Id gnat_entity, struct attrib ** attr_list) ...@@ -6139,31 +6143,32 @@ prepend_attributes (Entity_Id gnat_entity, struct attrib ** attr_list)
break; break;
default: default:
continue; return;
} }
/* See what arguments we have and turn them into GCC trees for /* See what arguments we have and turn them into GCC trees for attribute
attribute handlers. These expect identifier for strings. We handlers. These expect identifier for strings. We handle at most two
handle at most two arguments, static expressions only. */ arguments and static expressions only. */
if (Present (gnat_arg) && Present (First (gnat_arg)))
if (Present (gnat_assoc) && Present (First (gnat_assoc)))
{ {
Node_Id gnat_arg0 = Next (First (gnat_assoc)); Node_Id gnat_arg0 = Next (First (gnat_arg));
Node_Id gnat_arg1 = Empty; Node_Id gnat_arg1 = Empty;
if (Present (gnat_arg0) if (Present (gnat_arg0) && Is_Static_Expression (Expression (gnat_arg0)))
&& Is_Static_Expression (Expression (gnat_arg0)))
{ {
gnu_arg0 = gnat_to_gnu (Expression (gnat_arg0)); gnu_arg0 = gnat_to_gnu (Expression (gnat_arg0));
if (TREE_CODE (gnu_arg0) == STRING_CST) if (TREE_CODE (gnu_arg0) == STRING_CST)
{
gnu_arg0 = get_identifier (TREE_STRING_POINTER (gnu_arg0)); gnu_arg0 = get_identifier (TREE_STRING_POINTER (gnu_arg0));
if (IDENTIFIER_LENGTH (gnu_arg0) == 0)
return;
}
gnat_arg1 = Next (gnat_arg0); gnat_arg1 = Next (gnat_arg0);
} }
if (Present (gnat_arg1) if (Present (gnat_arg1) && Is_Static_Expression (Expression (gnat_arg1)))
&& Is_Static_Expression (Expression (gnat_arg1)))
{ {
gnu_arg1 = gnat_to_gnu (Expression (gnat_arg1)); gnu_arg1 = gnat_to_gnu (Expression (gnat_arg1));
...@@ -6172,16 +6177,28 @@ prepend_attributes (Entity_Id gnat_entity, struct attrib ** attr_list) ...@@ -6172,16 +6177,28 @@ prepend_attributes (Entity_Id gnat_entity, struct attrib ** attr_list)
} }
} }
/* Prepend to the list now. Make a list of the argument we might /* Prepend to the list. Make a list of the argument we might have, as GCC
have, as GCC expects it. */ expects it. */
prepend_one_attribute_to prepend_one_attribute (attr_list, etype, gnu_arg0,
(attr_list, gnu_arg1
etype, gnu_arg0,
(gnu_arg1 != NULL_TREE)
? build_tree_list (NULL_TREE, gnu_arg1) : NULL_TREE, ? build_tree_list (NULL_TREE, gnu_arg1) : NULL_TREE,
Present (Next (First (gnat_assoc))) Present (Next (First (gnat_arg)))
? Expression (Next (First (gnat_assoc))) : gnat_temp); ? Expression (Next (First (gnat_arg))) : gnat_pragma);
} }
/* Prepend to ATTR_LIST the list of attributes for GNAT_ENTITY, if any. */
static void
prepend_attributes (struct attrib **attr_list, Entity_Id gnat_entity)
{
Node_Id gnat_temp;
/* Attributes are stored as Representation Item pragmas. */
for (gnat_temp = First_Rep_Item (gnat_entity);
Present (gnat_temp);
gnat_temp = Next_Rep_Item (gnat_temp))
if (Nkind (gnat_temp) == N_Pragma)
prepend_one_attribute_pragma (attr_list, gnat_temp);
} }
/* Given a GNAT tree GNAT_EXPR, for an expression which is a value within a /* Given a GNAT tree GNAT_EXPR, for an expression which is a value within a
......
...@@ -2485,6 +2485,24 @@ package body Makeutl is ...@@ -2485,6 +2485,24 @@ package body Makeutl is
return False; return False;
end if; end if;
-- For gprbuild, check if a source has already been inserted in the
-- queue from the same project in a different project tree.
if Source.Format = Format_Gprbuild then
for J in 1 .. Q.Last loop
if Source.Id.Path.Name = Q.Table (J).Info.Id.Path.Name
and then Source.Id.Index = Q.Table (J).Info.Id.Index
and then Source.Id.Project.Path.Name =
Q.Table (J).Info.Id.Project.Path.Name
then
-- No need to insert this source in the queue, but still
-- return True as we may need to insert its roots.
return True;
end if;
end loop;
end if;
if Current_Verbosity = High then if Current_Verbosity = High then
Write_Str ("Adding """); Write_Str ("Adding """);
Debug_Display (Source); Debug_Display (Source);
......
...@@ -1956,7 +1956,7 @@ package Opt is ...@@ -1956,7 +1956,7 @@ package Opt is
procedure Restore_Opt_Config_Switches (Save : Config_Switches_Type); procedure Restore_Opt_Config_Switches (Save : Config_Switches_Type);
-- This procedure restores a set of switch values previously saved by a -- This procedure restores a set of switch values previously saved by a
-- call to Save_Opt_Switches. -- call to Save_Opt_Config_Switches (Save).
procedure Register_Opt_Config_Switches; procedure Register_Opt_Config_Switches;
-- This procedure is called after processing the gnat.adc file and other -- This procedure is called after processing the gnat.adc file and other
......
...@@ -369,6 +369,7 @@ package body Prj.Attr is ...@@ -369,6 +369,7 @@ package body Prj.Attr is
"Premote#" & "Premote#" &
"SVroot_dir#" & "SVroot_dir#" &
"LVexcluded_patterns#" &
-- package Stack -- package Stack
......
...@@ -4963,7 +4963,12 @@ invoking @code{gnatpp} for the source. ...@@ -4963,7 +4963,12 @@ invoking @code{gnatpp} for the source.
@itemize @bullet @itemize @bullet
@item @b{Excluded_Patterns}: list
Set of patterns to ignore when synchronizing sources from the build
master to the slaves. A set of predefined patterns are supported
(e.g. *.o, *.ali, *.exe, etc.), this attributes make it possible to
add some more patterns.
@item @b{Root_Dir}: single @item @b{Root_Dir}: single
......
...@@ -15570,19 +15570,6 @@ package body Sem_Prag is ...@@ -15570,19 +15570,6 @@ package body Sem_Prag is
when E_Constant | E_Variable => when E_Constant | E_Variable =>
Set_Linker_Section_Pragma (Ent, N); Set_Linker_Section_Pragma (Ent, N);
-- For now, for objects, we also link onto the rep item
-- chain and set the gigi rep item flag. This is here for
-- transition purposes only. When the processing for the
-- Linker_Section_Pragma field is completed, this can be
-- removed, since it will no longer be used.
-- This is accomplished by the call to Rep_Item_Too_Late
-- (when no error is detected and False is returned).
if not Rep_Item_Too_Late (Ent, N) then
Set_Has_Gigi_Rep_Item (Ent);
end if;
-- Types -- Types
when Type_Kind => when Type_Kind =>
......
...@@ -1263,6 +1263,7 @@ package Snames is ...@@ -1263,6 +1263,7 @@ package Snames is
Name_Excluded_Source_List_File : constant Name_Id := N + $; Name_Excluded_Source_List_File : constant Name_Id := N + $;
Name_Exec_Dir : constant Name_Id := N + $; Name_Exec_Dir : constant Name_Id := N + $;
Name_Exec_Subdir : constant Name_Id := N + $; Name_Exec_Subdir : constant Name_Id := N + $;
Name_Excluded_Patterns : constant Name_Id := N + $;
Name_Executable : constant Name_Id := N + $; Name_Executable : constant Name_Id := N + $;
Name_Executable_Suffix : constant Name_Id := N + $; Name_Executable_Suffix : constant Name_Id := N + $;
Name_Extends : constant Name_Id := N + $; Name_Extends : constant Name_Id := N + $;
......
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