diff options
author | Thomas Quinot <quinot@adacore.com> | 2013-01-02 09:39:36 +0000 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2013-01-02 10:39:36 +0100 |
commit | 6a04272a9a6981d30d4c21d99f10405c9a48a5c6 (patch) | |
tree | 1b67dd78c7c751ad2367e4a79f12f547237cb5d4 /gcc | |
parent | c5d00db06fdfa662780ddbb179a684e221655b34 (diff) | |
download | gcc-6a04272a9a6981d30d4c21d99f10405c9a48a5c6.zip gcc-6a04272a9a6981d30d4c21d99f10405c9a48a5c6.tar.gz gcc-6a04272a9a6981d30d4c21d99f10405c9a48a5c6.tar.bz2 |
sem_ch13.adb (Analyze_Aspect_Specifications): For a Pre/Post aspect that applies to a library subprogram...
2013-01-02 Thomas Quinot <quinot@adacore.com>
* sem_ch13.adb (Analyze_Aspect_Specifications): For a Pre/Post
aspect that applies to a library subprogram, prepend corresponding
pragma to the Pragmas_After list, in order for split AND THEN
sections to be processed in the expected order.
From-SVN: r194783
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/ada/sem_ch13.adb | 17 |
2 files changed, 21 insertions, 3 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index e92b0d7..607bcb8 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,5 +1,12 @@ 2013-01-02 Thomas Quinot <quinot@adacore.com> + * sem_ch13.adb (Analyze_Aspect_Specifications): For a Pre/Post + aspect that applies to a library subprogram, prepend corresponding + pragma to the Pragmas_After list, in order for split AND THEN + sections to be processed in the expected order. + +2013-01-02 Thomas Quinot <quinot@adacore.com> + * exp_prag.adb (Expand_Pragma_Check): The statements generated for the pragma must have the sloc of the pragma, not the sloc of the condition, otherwise this creates anomalies in the diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index 235af18..221c866 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -1602,10 +1602,21 @@ package body Sem_Ch13 is -- with delay of visibility for the expression analysis. -- If the entity is a library-level subprogram, the pre/ - -- postconditions must be treated as late pragmas. + -- postconditions must be treated as late pragmas. Note + -- that they must be prepended, not appended, to the list, + -- so that split AND THEN sections are processed in the + -- correct order. if Nkind (Parent (N)) = N_Compilation_Unit then - Add_Global_Declaration (Aitem); + declare + Aux : constant Node_Id := Aux_Decls_Node (Parent (N)); + begin + if No (Pragmas_After (Aux)) then + Set_Pragmas_After (Aux, New_List); + end if; + + Prepend (Aitem, Pragmas_After (Aux)); + end; -- If it is a subprogram body, add pragmas to list of -- declarations in body. @@ -1930,7 +1941,7 @@ package body Sem_Ch13 is else if No (Pragmas_After (Aux)) then - Set_Pragmas_After (Aux, Empty_List); + Set_Pragmas_After (Aux, New_List); end if; Append (Aitem, Pragmas_After (Aux)); |