aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2015-01-06 10:03:43 +0000
committerArnaud Charlet <charlet@gcc.gnu.org>2015-01-06 11:03:43 +0100
commit6ced6aa2aa6d1e7040c9114b96f64e4a220dc473 (patch)
tree04c8ffd6bf12732cbbdff334b5671a16613c2d02 /gcc
parent61ae296d2beb645bd0aed720cf408891d67913d9 (diff)
downloadgcc-6ced6aa2aa6d1e7040c9114b96f64e4a220dc473.zip
gcc-6ced6aa2aa6d1e7040c9114b96f64e4a220dc473.tar.gz
gcc-6ced6aa2aa6d1e7040c9114b96f64e4a220dc473.tar.bz2
einfo.ads (Is_Independent): Document extended usage.
2015-01-06 Eric Botcazou <ebotcazou@adacore.com> * einfo.ads (Is_Independent): Document extended usage. * einfo.adb (Is_Independent): Remove obsolete assertion. (Set_Is_Independent): Likewise. * sem_prag.adb (Process_Atomic_Shared_Volatile): Rename into... (Process_Atomic_Independent_Shared_Volatile): ...this. Deal with pragma Independent here. (Analyze_Pragma): Adjust to above renaming and also invoke it for pragma Independent. Adjust comment for Independent_Components. From-SVN: r219245
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog12
-rw-r--r--gcc/ada/einfo.adb2
-rw-r--r--gcc/ada/einfo.ads10
-rw-r--r--gcc/ada/sem_prag.adb121
4 files changed, 70 insertions, 75 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 7eeb8cc..d991649a 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,15 @@
+2015-01-06 Eric Botcazou <ebotcazou@adacore.com>
+
+ * einfo.ads (Is_Independent): Document extended usage.
+ * einfo.adb (Is_Independent): Remove obsolete assertion.
+ (Set_Is_Independent): Likewise.
+ * sem_prag.adb (Process_Atomic_Shared_Volatile): Rename into...
+ (Process_Atomic_Independent_Shared_Volatile): ...this.
+ Deal with pragma Independent here.
+ (Analyze_Pragma): Adjust
+ to above renaming and also invoke it for pragma Independent.
+ Adjust comment for Independent_Components.
+
2015-01-06 Robert Dewar <dewar@adacore.com>
* snames.ads-tmpl: Remove entries for attribute Enum_Image.
diff --git a/gcc/ada/einfo.adb b/gcc/ada/einfo.adb
index 3e0c0c7..c5ff28e 100644
--- a/gcc/ada/einfo.adb
+++ b/gcc/ada/einfo.adb
@@ -2117,7 +2117,6 @@ package body Einfo is
function Is_Independent (Id : E) return B is
begin
- pragma Assert (Ekind (Id) = E_Component);
return Flag268 (Id);
end Is_Independent;
@@ -4967,7 +4966,6 @@ package body Einfo is
procedure Set_Is_Independent (Id : E; V : B := True) is
begin
- pragma Assert (Ekind_In (Id, E_Component, E_Void));
Set_Flag268 (Id, V);
end Set_Is_Independent;
diff --git a/gcc/ada/einfo.ads b/gcc/ada/einfo.ads
index 4bb05c4..21518e9 100644
--- a/gcc/ada/einfo.ads
+++ b/gcc/ada/einfo.ads
@@ -2483,9 +2483,13 @@ package Einfo is
-- Applies to all entities, true for incomplete types and subtypes
-- Is_Independent (Flag268)
--- Defined in record components. Set if a valid pragma or aspect
--- Independent applies to the component, or if a valid pragma or aspect
--- Independent_Components applies to the enclosing record type.
+-- Defined in all type entities, and also in constants, components and
+-- variables. Set if a valid pragma or aspect Independent applies to the
+-- entity, or if a valid pragma or aspect Independent_Components applies
+-- to the enclosing record type for a component. Also set if a pragma
+-- Shared or pragma Atomic applies to the entity. In the case of private
+-- and incomplete types, this flag is set in both the partial view and
+-- the full view.
-- Is_Inlined (Flag11)
-- Defined in all entities. Set for functions and procedures which are
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index 3ced30d..d5c1599 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -3114,10 +3114,10 @@ package body Sem_Prag is
pragma No_Return (Pragma_Misplaced);
-- Issue fatal error message for misplaced pragma
- procedure Process_Atomic_Shared_Volatile;
- -- Common processing for pragmas Atomic, Shared, Volatile. Note that
- -- Shared is an obsolete Ada 83 pragma, treated as being identical
- -- in effect to pragma Atomic.
+ procedure Process_Atomic_Independent_Shared_Volatile;
+ -- Common processing for pragmas Atomic, Independent, Shared, Volatile.
+ -- Note that Shared is an obsolete Ada 83 pragma and treated as being
+ -- identical in effect to pragma Atomic.
procedure Process_Compile_Time_Warning_Or_Error;
-- Common processing for Compile_Time_Error and Compile_Time_Warning
@@ -6152,11 +6152,11 @@ package body Sem_Prag is
Error_Pragma ("incorrect placement of pragma%");
end Pragma_Misplaced;
- ------------------------------------
- -- Process_Atomic_Shared_Volatile --
- ------------------------------------
+ ------------------------------------------------
+ -- Process_Atomic_Independent_Shared_Volatile --
+ ------------------------------------------------
- procedure Process_Atomic_Shared_Volatile is
+ procedure Process_Atomic_Independent_Shared_Volatile is
E_Id : Node_Id;
E : Entity_Id;
D : Node_Id;
@@ -6182,7 +6182,7 @@ package body Sem_Prag is
end if;
end Set_Atomic;
- -- Start of processing for Process_Atomic_Shared_Volatile
+ -- Start of processing for Process_Atomic_Independent_Shared_Volatile
begin
Check_Ada_83_Warning;
@@ -6215,20 +6215,34 @@ package body Sem_Prag is
Check_First_Subtype (Arg1);
end if;
- if Prag_Id /= Pragma_Volatile then
+ if Prag_Id = Pragma_Atomic or else Prag_Id = Pragma_Shared then
Set_Atomic (E);
Set_Atomic (Underlying_Type (E));
Set_Atomic (Base_Type (E));
end if;
+ -- Atomic/Shared imply both Independent and Volatile
+
+ if Prag_Id /= Pragma_Volatile then
+ Set_Is_Independent (E);
+ Set_Is_Independent (Underlying_Type (E));
+ Set_Is_Independent (Base_Type (E));
+
+ if Prag_Id = Pragma_Independent then
+ Independence_Checks.Append ((N, Base_Type (E)));
+ end if;
+ end if;
+
-- Attribute belongs on the base type. If the view of the type is
-- currently private, it also belongs on the underlying type.
- Set_Is_Volatile (Base_Type (E));
- Set_Is_Volatile (Underlying_Type (E));
+ if Prag_Id /= Pragma_Independent then
+ Set_Is_Volatile (Base_Type (E));
+ Set_Is_Volatile (Underlying_Type (E));
- Set_Treat_As_Volatile (E);
- Set_Treat_As_Volatile (Underlying_Type (E));
+ Set_Treat_As_Volatile (E);
+ Set_Treat_As_Volatile (Underlying_Type (E));
+ end if;
elsif K = N_Object_Declaration
or else (K = N_Component_Declaration
@@ -6238,7 +6252,7 @@ package body Sem_Prag is
return;
end if;
- if Prag_Id /= Pragma_Volatile then
+ if Prag_Id = Pragma_Atomic or else Prag_Id = Pragma_Shared then
Set_Is_Atomic (E);
-- If the object declaration has an explicit initialization, a
@@ -6284,8 +6298,20 @@ package body Sem_Prag is
end if;
end if;
- Set_Is_Volatile (E);
- Set_Treat_As_Volatile (E);
+ -- Atomic/Shared imply both Independent and Volatile
+
+ if Prag_Id /= Pragma_Volatile then
+ Set_Is_Independent (E);
+
+ if Prag_Id = Pragma_Independent then
+ Independence_Checks.Append ((N, E));
+ end if;
+ end if;
+
+ if Prag_Id /= Pragma_Independent then
+ Set_Is_Volatile (E);
+ Set_Treat_As_Volatile (E);
+ end if;
else
Error_Pragma_Arg ("inappropriate entity for pragma%", Arg1);
@@ -6305,7 +6331,7 @@ package body Sem_Prag is
("argument of pragma % must denote a full type or object "
& "declaration", Arg1);
end if;
- end Process_Atomic_Shared_Volatile;
+ end Process_Atomic_Independent_Shared_Volatile;
-------------------------------------------
-- Process_Compile_Time_Warning_Or_Error --
@@ -11408,7 +11434,7 @@ package body Sem_Prag is
-- pragma Atomic (LOCAL_NAME);
when Pragma_Atomic =>
- Process_Atomic_Shared_Volatile;
+ Process_Atomic_Independent_Shared_Volatile;
-----------------------
-- Atomic_Components --
@@ -14903,61 +14929,16 @@ package body Sem_Prag is
-- Independent --
-----------------
- -- pragma Independent (record_component_LOCAL_NAME);
-
- when Pragma_Independent => Independent : declare
- E_Id : Node_Id;
- E : Entity_Id;
-
- begin
- Check_Ada_83_Warning;
- Ada_2012_Pragma;
- Check_No_Identifiers;
- Check_Arg_Count (1);
- Check_Arg_Is_Local_Name (Arg1);
- E_Id := Get_Pragma_Arg (Arg1);
-
- if Etype (E_Id) = Any_Type then
- return;
- end if;
-
- E := Entity (E_Id);
-
- -- Check we have a record component. We have not yet setup
- -- components fully, so identify by syntactic structure.
-
- if Nkind (Declaration_Node (E)) /= N_Component_Declaration then
- Error_Pragma_Arg
- ("argument for pragma% must be record component", Arg1);
- end if;
-
- -- Check duplicate before we chain ourselves
-
- Check_Duplicate_Pragma (E);
-
- -- Chain pragma
-
- if Rep_Item_Too_Early (E, N)
- or else
- Rep_Item_Too_Late (E, N)
- then
- return;
- end if;
-
- -- Set flag in component
-
- Set_Is_Independent (E);
+ -- pragma Independent (LOCAL_NAME);
- Independence_Checks.Append ((N, E));
- end Independent;
+ when Pragma_Independent =>
+ Process_Atomic_Independent_Shared_Volatile;
----------------------------
-- Independent_Components --
----------------------------
- -- pragma Atomic_Components (array_LOCAL_NAME);
-
- -- This processing is shared by Volatile_Components
+ -- pragma Independent_Components (array_or_record_LOCAL_NAME);
when Pragma_Independent_Components => Independent_Components : declare
E_Id : Node_Id;
@@ -19358,7 +19339,7 @@ package body Sem_Prag is
when Pragma_Shared =>
GNAT_Pragma;
- Process_Atomic_Shared_Volatile;
+ Process_Atomic_Independent_Shared_Volatile;
--------------------
-- Shared_Passive --
@@ -21239,7 +21220,7 @@ package body Sem_Prag is
-- pragma Volatile (LOCAL_NAME);
when Pragma_Volatile =>
- Process_Atomic_Shared_Volatile;
+ Process_Atomic_Independent_Shared_Volatile;
-------------------------
-- Volatile_Components --