aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/exp_prag.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2013-10-14 15:31:52 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2013-10-14 15:31:52 +0200
commit1e7bc06555257c73282c7ca1678a74d2cc6c7e6c (patch)
tree83de5b6633cd5a5aeabf422cb2244eb93481f494 /gcc/ada/exp_prag.adb
parent5644b7e8e7fcc55fe544949c58ce049039e671c9 (diff)
downloadgcc-1e7bc06555257c73282c7ca1678a74d2cc6c7e6c.zip
gcc-1e7bc06555257c73282c7ca1678a74d2cc6c7e6c.tar.gz
gcc-1e7bc06555257c73282c7ca1678a74d2cc6c7e6c.tar.bz2
[multiple changes]
2013-10-14 Robert Dewar <dewar@adacore.com> * exp_prag.adb: Minor reformatting. 2013-10-14 Ed Schonberg <schonberg@adacore.com> * sem_case.adb (Check_Against_Predicate): Handle properly an others clause in various cases. 2013-10-14 Hristian Kirtchev <kirtchev@adacore.com> * sem_prag.adb (Check_Matching_Constituent): Do not inspect the hidden states if there are no hidden states. This case arises when the constituents are states coming from a private child. 2013-10-14 Doug Rupp <rupp@adacore.com> * init.c [ARMEL and VxWorks] (__gnat_map_signal): Re-arm guard page by clearing VALID bit vice setting page protection. 2013-10-14 Arnaud Charlet <charlet@adacore.com> * gnat_rm.texi, adaint.c: Fix typo. 2013-10-14 Ed Schonberg <schonberg@adacore.com> * sem_util.adb (Is_Variable, In_Protected_Function): In the body of a protected function, the protected object itself is a constant (not just its components). From-SVN: r203550
Diffstat (limited to 'gcc/ada/exp_prag.adb')
-rw-r--r--gcc/ada/exp_prag.adb55
1 files changed, 33 insertions, 22 deletions
diff --git a/gcc/ada/exp_prag.adb b/gcc/ada/exp_prag.adb
index f47ed1a..f431478 100644
--- a/gcc/ada/exp_prag.adb
+++ b/gcc/ada/exp_prag.adb
@@ -543,30 +543,34 @@ package body Exp_Prag is
-- Expand_Pragma_Import_Or_Interface --
---------------------------------------
- -- When applied to a variable, the default initialization must not be done.
- -- As it is already done when the pragma is found, we just get rid of the
- -- call the initialization procedure which followed the object declaration.
- -- The call is inserted after the declaration, but validity checks may
- -- also have been inserted and the initialization call does not necessarily
- -- appear immediately after the object declaration.
-
- -- We can't use the freezing mechanism for this purpose, since we have to
- -- elaborate the initialization expression when it is first seen (i.e. this
- -- elaboration cannot be deferred to the freeze point).
-
procedure Expand_Pragma_Import_Or_Interface (N : Node_Id) is
Def_Id : Entity_Id;
Init_Call : Node_Id;
begin
Def_Id := Entity (Arg2 (N));
+
+ -- Variable case
+
if Ekind (Def_Id) = E_Variable then
+ -- When applied to a variable, the default initialization must not be
+ -- done. As it is already done when the pragma is found, we just get
+ -- rid of the call the initialization procedure which followed the
+ -- object declaration. The call is inserted after the declaration,
+ -- but validity checks may also have been inserted and thus the
+ -- initialization call does not necessarily appear immediately
+ -- after the object declaration.
+
+ -- We can't use the freezing mechanism for this purpose, since we
+ -- have to elaborate the initialization expression when it is first
+ -- seen (so this elaboration cannot be deferred to the freeze point).
+
-- Find and remove generated initialization call for object, if any
Init_Call := Remove_Init_Call (Def_Id, Rep_Clause => N);
- -- Any default initialization expression should be removed (e.g.,
+ -- Any default initialization expression should be removed (e.g.
-- null defaults for access objects, zero initialization of packed
-- bit arrays). Imported objects aren't allowed to have explicit
-- initialization, so the expression must have been generated by
@@ -575,19 +579,21 @@ package body Exp_Prag is
if No (Init_Call) and then Present (Expression (Parent (Def_Id))) then
Set_Expression (Parent (Def_Id), Empty);
end if;
+
+ -- Case of exception with convention C++
+
elsif Ekind (Def_Id) = E_Exception
and then Convention (Def_Id) = Convention_CPP
then
-
-- Import a C++ convention
declare
- Loc : constant Source_Ptr := Sloc (N);
- Exdata : List_Id;
- Lang_Char : Node_Id;
- Foreign_Data : Node_Id;
- Rtti_Name : constant Node_Id := Arg3 (N);
- Dum : constant Entity_Id := Make_Temporary (Loc, 'D');
+ Loc : constant Source_Ptr := Sloc (N);
+ Rtti_Name : constant Node_Id := Arg3 (N);
+ Dum : constant Entity_Id := Make_Temporary (Loc, 'D');
+ Exdata : List_Id;
+ Lang_Char : Node_Id;
+ Foreign_Data : Node_Id;
begin
Exdata := Component_Associations (Expression (Parent (Def_Id)));
@@ -598,9 +604,8 @@ package body Exp_Prag is
Rewrite (Expression (Lang_Char),
Make_Character_Literal (Loc,
- Chars => Name_uC,
- Char_Literal_Value =>
- UI_From_Int (Character'Pos ('C'))));
+ Chars => Name_uC,
+ Char_Literal_Value => UI_From_Int (Character'Pos ('C'))));
Analyze (Expression (Lang_Char));
-- Change the value of Foreign_Data
@@ -633,6 +638,12 @@ package body Exp_Prag is
Attribute_Name => Name_Address)));
Analyze (Expression (Foreign_Data));
end;
+
+ -- No special expansion required for any other case
+
+ else
+ null;
+
end if;
end Expand_Pragma_Import_Or_Interface;