aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2014-01-24 15:00:34 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2014-01-24 15:00:34 +0100
commit0567ae8de77473e32db5942220bf06ec54c57a0d (patch)
tree53dc31646f8570aca5d6a425e6413a2e5d4fde6a /gcc
parent4437ea95cc8a9fd845e435527565718e566fa937 (diff)
downloadgcc-0567ae8de77473e32db5942220bf06ec54c57a0d.zip
gcc-0567ae8de77473e32db5942220bf06ec54c57a0d.tar.gz
gcc-0567ae8de77473e32db5942220bf06ec54c57a0d.tar.bz2
[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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog33
-rw-r--r--gcc/ada/einfo.ads10
-rw-r--r--gcc/ada/gcc-interface/decl.c207
-rw-r--r--gcc/ada/makeutl.adb18
-rw-r--r--gcc/ada/opt.ads2
-rw-r--r--gcc/ada/prj-attr.adb1
-rw-r--r--gcc/ada/projects.texi5
-rw-r--r--gcc/ada/sem_prag.adb13
-rw-r--r--gcc/ada/snames.ads-tmpl1
9 files changed, 171 insertions, 119 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index b553c17..054033e 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,36 @@
+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>
* sem_prag.adb (Analyze_Input_Output): Add missing error check
diff --git a/gcc/ada/einfo.ads b/gcc/ada/einfo.ads
index e43107b..d7fc838 100644
--- a/gcc/ada/einfo.ads
+++ b/gcc/ada/einfo.ads
@@ -1290,7 +1290,6 @@ package Einfo is
--
-- Machine_Attribute pragma
-- Link_Alias pragma
--- Linker_Section pragma
-- Linker_Constructor pragma
-- Linker_Destructor pragma
-- Weak_External pragma
@@ -1299,10 +1298,6 @@ package Einfo is
-- If any of these items are present, then the flag Has_Gigi_Rep_Item is
-- 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
-- messages can easily locate the relevant nodes for posting errors.
-- Note in particular that size clauses are defined only for this
@@ -1559,7 +1554,6 @@ package Einfo is
--
-- Machine_Attribute pragma
-- Linker_Alias pragma
--- Linker_Section pragma
-- Linker_Constructor pragma
-- Linker_Destructor pragma
-- Weak_External pragma
@@ -1569,10 +1563,6 @@ package Einfo is
-- process any of these items that appear. At least one such item will
-- 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)
-- 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.
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
index 5259ad4..c956d97 100644
--- a/gcc/ada/gcc-interface/decl.c
+++ b/gcc/ada/gcc-interface/decl.c
@@ -130,9 +130,10 @@ static GTY ((if_marked ("tree_int_map_marked_p"),
param_is (struct tree_int_map))) htab_t annotate_value_cache;
static bool allocatable_size_p (tree, bool);
-static void prepend_one_attribute_to (struct attrib **,
- enum attr_type, tree, tree, Node_Id);
-static void prepend_attributes (Entity_Id, struct attrib **);
+static void prepend_one_attribute (struct attrib **,
+ enum attr_type, tree, tree, Node_Id);
+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 bool type_has_variable_size (tree);
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)
/* Handle any attributes directly attached to the 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. */
if (is_type)
@@ -377,8 +378,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
if (Base_Type (gnat_entity) != gnat_entity
&& !Is_First_Subtype (gnat_entity)
&& Has_Gigi_Rep_Item (First_Subtype (Base_Type (gnat_entity))))
- prepend_attributes (First_Subtype (Base_Type (gnat_entity)),
- &attr_list);
+ prepend_attributes (&attr_list,
+ First_Subtype (Base_Type (gnat_entity)));
/* Compute a default value for the size of an elementary type. */
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)
(TREE_TYPE (TYPE_FIELDS (gnu_type))))))
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. */
gnu_decl
= 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)
}
}
+ /* Deal with platform-specific calling conventions. */
if (Has_Stdcall_Convention (gnat_entity))
- prepend_one_attribute_to
+ prepend_one_attribute
(&attr_list, ATTR_MACHINE_ATTRIBUTE,
get_identifier ("stdcall"), NULL_TREE,
gnat_entity);
else if (Has_Thiscall_Convention (gnat_entity))
- prepend_one_attribute_to
+ prepend_one_attribute
(&attr_list, ATTR_MACHINE_ATTRIBUTE,
get_identifier ("thiscall"), NULL_TREE,
gnat_entity);
/* If we should request stack realignment for a foreign convention
- subprogram, do so. Note that this applies to task entry points in
- particular. */
+ subprogram, do so. Note that this applies to task entry points
+ in particular. */
if (FOREIGN_FORCE_REALIGN_STACK
&& Has_Foreign_Convention (gnat_entity))
- prepend_one_attribute_to
+ prepend_one_attribute
(&attr_list, ATTR_MACHINE_ATTRIBUTE,
get_identifier ("force_align_arg_pointer"), NULL_TREE,
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. */
gnu_param_list = nreverse (gnu_param_list);
if (has_stub)
@@ -5456,13 +5470,13 @@ get_minimal_subprog_decl (Entity_Id gnat_entity)
gnu_ext_name = create_concat_name (gnat_entity, NULL);
if (Has_Stdcall_Convention (gnat_entity))
- prepend_one_attribute_to (&attr_list, ATTR_MACHINE_ATTRIBUTE,
- get_identifier ("stdcall"), NULL_TREE,
- gnat_entity);
+ prepend_one_attribute (&attr_list, ATTR_MACHINE_ATTRIBUTE,
+ get_identifier ("stdcall"), NULL_TREE,
+ gnat_entity);
else if (Has_Thiscall_Convention (gnat_entity))
- prepend_one_attribute_to (&attr_list, ATTR_MACHINE_ATTRIBUTE,
- get_identifier ("thiscall"), NULL_TREE,
- gnat_entity);
+ prepend_one_attribute (&attr_list, ATTR_MACHINE_ATTRIBUTE,
+ get_identifier ("thiscall"), NULL_TREE,
+ gnat_entity);
if (No (Interface_Name (gnat_entity)) && gnu_ext_name == gnu_entity_name)
gnu_ext_name = NULL_TREE;
@@ -6071,11 +6085,11 @@ allocatable_size_p (tree gnu_size, bool static_p)
NAME, ARGS and ERROR_POINT. */
static void
-prepend_one_attribute_to (struct attrib ** attr_list,
- enum attr_type attr_type,
- tree attr_name,
- tree attr_args,
- Node_Id attr_error_point)
+prepend_one_attribute (struct attrib **attr_list,
+ enum attr_type attr_type,
+ tree attr_name,
+ tree attr_args,
+ Node_Id attr_error_point)
{
struct attrib * attr = (struct attrib *) xmalloc (sizeof (struct attrib));
@@ -6088,100 +6102,103 @@ prepend_one_attribute_to (struct attrib ** attr_list,
*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
-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;
-
- /* Attributes are stored as Representation Item pragmas. */
+ const Node_Id gnat_arg = Pragma_Argument_Associations (gnat_pragma);
+ tree gnu_arg0 = NULL_TREE, gnu_arg1 = NULL_TREE;
+ enum attr_type etype;
- 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;
- Node_Id gnat_assoc = Pragma_Argument_Associations (gnat_temp);
- enum attr_type etype;
+ /* Map the pragma at hand. Skip if this isn't one we know how to handle. */
+ switch (Get_Pragma_Id (Chars (Pragma_Identifier (gnat_pragma))))
+ {
+ case Pragma_Machine_Attribute:
+ etype = ATTR_MACHINE_ATTRIBUTE;
+ break;
- /* Map the kind of pragma at hand. Skip if this is not one
- we know how to handle. */
+ case Pragma_Linker_Alias:
+ etype = ATTR_LINK_ALIAS;
+ break;
- switch (Get_Pragma_Id (Chars (Pragma_Identifier (gnat_temp))))
- {
- case Pragma_Machine_Attribute:
- etype = ATTR_MACHINE_ATTRIBUTE;
- break;
+ case Pragma_Linker_Section:
+ etype = ATTR_LINK_SECTION;
+ break;
- case Pragma_Linker_Alias:
- etype = ATTR_LINK_ALIAS;
- break;
+ case Pragma_Linker_Constructor:
+ etype = ATTR_LINK_CONSTRUCTOR;
+ break;
- case Pragma_Linker_Section:
- etype = ATTR_LINK_SECTION;
- break;
+ case Pragma_Linker_Destructor:
+ etype = ATTR_LINK_DESTRUCTOR;
+ break;
- case Pragma_Linker_Constructor:
- etype = ATTR_LINK_CONSTRUCTOR;
- break;
+ case Pragma_Weak_External:
+ etype = ATTR_WEAK_EXTERNAL;
+ break;
- case Pragma_Linker_Destructor:
- etype = ATTR_LINK_DESTRUCTOR;
- break;
+ case Pragma_Thread_Local_Storage:
+ etype = ATTR_THREAD_LOCAL_STORAGE;
+ break;
- case Pragma_Weak_External:
- etype = ATTR_WEAK_EXTERNAL;
- break;
+ default:
+ return;
+ }
- case Pragma_Thread_Local_Storage:
- etype = ATTR_THREAD_LOCAL_STORAGE;
- break;
+ /* See what arguments we have and turn them into GCC trees for attribute
+ handlers. These expect identifier for strings. We handle at most two
+ arguments and static expressions only. */
+ if (Present (gnat_arg) && Present (First (gnat_arg)))
+ {
+ Node_Id gnat_arg0 = Next (First (gnat_arg));
+ Node_Id gnat_arg1 = Empty;
- default:
- continue;
- }
+ if (Present (gnat_arg0) && Is_Static_Expression (Expression (gnat_arg0)))
+ {
+ gnu_arg0 = gnat_to_gnu (Expression (gnat_arg0));
- /* See what arguments we have and turn them into GCC trees for
- attribute handlers. These expect identifier for strings. We
- handle at most two arguments, static expressions only. */
+ if (TREE_CODE (gnu_arg0) == STRING_CST)
+ {
+ gnu_arg0 = get_identifier (TREE_STRING_POINTER (gnu_arg0));
+ if (IDENTIFIER_LENGTH (gnu_arg0) == 0)
+ return;
+ }
- if (Present (gnat_assoc) && Present (First (gnat_assoc)))
- {
- Node_Id gnat_arg0 = Next (First (gnat_assoc));
- Node_Id gnat_arg1 = Empty;
+ gnat_arg1 = Next (gnat_arg0);
+ }
- if (Present (gnat_arg0)
- && Is_Static_Expression (Expression (gnat_arg0)))
- {
- gnu_arg0 = gnat_to_gnu (Expression (gnat_arg0));
+ if (Present (gnat_arg1) && Is_Static_Expression (Expression (gnat_arg1)))
+ {
+ gnu_arg1 = gnat_to_gnu (Expression (gnat_arg1));
- if (TREE_CODE (gnu_arg0) == STRING_CST)
- gnu_arg0 = get_identifier (TREE_STRING_POINTER (gnu_arg0));
+ if (TREE_CODE (gnu_arg1) == STRING_CST)
+ gnu_arg1 = get_identifier (TREE_STRING_POINTER (gnu_arg1));
+ }
+ }
- gnat_arg1 = Next (gnat_arg0);
- }
+ /* Prepend to the list. Make a list of the argument we might have, as GCC
+ expects it. */
+ prepend_one_attribute (attr_list, etype, gnu_arg0,
+ gnu_arg1
+ ? build_tree_list (NULL_TREE, gnu_arg1) : NULL_TREE,
+ Present (Next (First (gnat_arg)))
+ ? Expression (Next (First (gnat_arg))) : gnat_pragma);
+}
- if (Present (gnat_arg1)
- && Is_Static_Expression (Expression (gnat_arg1)))
- {
- gnu_arg1 = gnat_to_gnu (Expression (gnat_arg1));
+/* Prepend to ATTR_LIST the list of attributes for GNAT_ENTITY, if any. */
- if (TREE_CODE (gnu_arg1) == STRING_CST)
- gnu_arg1 = get_identifier (TREE_STRING_POINTER (gnu_arg1));
- }
- }
+static void
+prepend_attributes (struct attrib **attr_list, Entity_Id gnat_entity)
+{
+ Node_Id gnat_temp;
- /* Prepend to the list now. Make a list of the argument we might
- have, as GCC expects it. */
- prepend_one_attribute_to
- (attr_list,
- etype, gnu_arg0,
- (gnu_arg1 != NULL_TREE)
- ? build_tree_list (NULL_TREE, gnu_arg1) : NULL_TREE,
- Present (Next (First (gnat_assoc)))
- ? Expression (Next (First (gnat_assoc))) : 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
diff --git a/gcc/ada/makeutl.adb b/gcc/ada/makeutl.adb
index aef82cb..4a8f8a8 100644
--- a/gcc/ada/makeutl.adb
+++ b/gcc/ada/makeutl.adb
@@ -2485,6 +2485,24 @@ package body Makeutl is
return False;
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
Write_Str ("Adding """);
Debug_Display (Source);
diff --git a/gcc/ada/opt.ads b/gcc/ada/opt.ads
index 8f0fa52..568d025 100644
--- a/gcc/ada/opt.ads
+++ b/gcc/ada/opt.ads
@@ -1956,7 +1956,7 @@ package Opt is
procedure Restore_Opt_Config_Switches (Save : Config_Switches_Type);
-- 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;
-- This procedure is called after processing the gnat.adc file and other
diff --git a/gcc/ada/prj-attr.adb b/gcc/ada/prj-attr.adb
index 4f818f8..297d49b 100644
--- a/gcc/ada/prj-attr.adb
+++ b/gcc/ada/prj-attr.adb
@@ -369,6 +369,7 @@ package body Prj.Attr is
"Premote#" &
"SVroot_dir#" &
+ "LVexcluded_patterns#" &
-- package Stack
diff --git a/gcc/ada/projects.texi b/gcc/ada/projects.texi
index bb06787..148589f 100644
--- a/gcc/ada/projects.texi
+++ b/gcc/ada/projects.texi
@@ -4963,7 +4963,12 @@ invoking @code{gnatpp} for the source.
@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
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index 15679a4..28b020b 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -15570,19 +15570,6 @@ package body Sem_Prag is
when E_Constant | E_Variable =>
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
when Type_Kind =>
diff --git a/gcc/ada/snames.ads-tmpl b/gcc/ada/snames.ads-tmpl
index 8259976..671c5b4 100644
--- a/gcc/ada/snames.ads-tmpl
+++ b/gcc/ada/snames.ads-tmpl
@@ -1263,6 +1263,7 @@ package Snames is
Name_Excluded_Source_List_File : constant Name_Id := N + $;
Name_Exec_Dir : 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_Suffix : constant Name_Id := N + $;
Name_Extends : constant Name_Id := N + $;