diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-04-23 09:12:14 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-04-23 09:12:14 +0000 |
commit | 2bd3bd3047f91ab8c0b1ddd1bdaed83d1849658d (patch) | |
tree | 1ed92c2da809b2a957c113489c5298e026e0da1f /gcc/ada/sem_prag.adb | |
parent | be0abd944dc34ec5b6d19759da5cd5202cc16bf5 (diff) | |
download | gcc-2bd3bd3047f91ab8c0b1ddd1bdaed83d1849658d.tar.gz |
2013-04-23 Robert Dewar <dewar@adacore.com>
* sem_prag.adb (Fix_Error): Rewrite to do more accurate job
of getting proper name in the case where pragma comes from
aspect.
* sem_ch3.adb, sinfo.ads, par-ch6.adb, exp_ch6.adb: Minor reformatting.
2013-04-23 Yannick Moy <moy@adacore.com>
* sem_ch6.adb (Process_PPCs): Do not filter postconditions based on
applicable policy.
2013-04-23 Thomas Quinot <quinot@adacore.com>
* par_sco.adb (Traverse_Aux_Decls): Minor code reorganization.
2013-04-23 Doug Rupp <rupp@adacore.com>
* init.c: Move facility macros outside IN_RTS.
2013-04-23 Thomas Quinot <quinot@adacore.com>
* freeze.adb (Freeze_Entity): For the case of a bit-packed
array time that is known at compile time to have more that
Integer'Last+1 elements, issue an error, since such arrays are
not supported.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@198178 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/sem_prag.adb')
-rw-r--r-- | gcc/ada/sem_prag.adb | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index 2deeb8f1410..8d6a38e5c1a 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -827,12 +827,12 @@ package body Sem_Prag is procedure Fix_Error (Msg : in out String); -- This is called prior to issuing an error message. Msg is a string - -- that typically contains the substring "pragma". If the current pragma - -- comes from an aspect, each such "pragma" substring is replaced with - -- the characters "aspect", and if Error_Msg_Name_1 is Name_Precondition - -- (resp Name_Postcondition) it is changed to Name_Pre (resp Name_Post). - -- In addition, if the current pragma results from rewriting another - -- pragma, Error_Msg_Name_1 is set to the original pragma name. + -- that typically contains the substring "pragma". If the pragma comes + -- from an aspect, each such "pragma" substring is replaced with the + -- characters "aspect", and Error_Msg_Name_1 is set to the name of the + -- aspect (which may be different from the pragma name). If the current + -- pragma results from rewriting another pragma, then Error_Msg_Name_1 + -- is set to the original pragma name. procedure Gather_Associations (Names : Name_List; @@ -2864,24 +2864,33 @@ package body Sem_Prag is --------------- procedure Fix_Error (Msg : in out String) is - Orig : constant Node_Id := Original_Node (N); - begin + -- If we have a rewriting of another pragma, go to that pragma + + if Is_Rewrite_Substitution (N) + and then Nkind (Original_Node (N)) = N_Pragma + then + Error_Msg_Name_1 := Pragma_Name (Original_Node (N)); + end if; + + -- Case where pragma comes from an aspect specification + if From_Aspect_Specification (N) then + + -- Change appearence of "pragma" in message to "aspect" + for J in Msg'First .. Msg'Last - 5 loop if Msg (J .. J + 5) = "pragma" then Msg (J .. J + 5) := "aspect"; end if; end loop; - if Error_Msg_Name_1 = Name_Precondition then - Error_Msg_Name_1 := Name_Pre; - elsif Error_Msg_Name_1 = Name_Postcondition then - Error_Msg_Name_1 := Name_Post; - end if; + -- Get name from corresponding aspect - elsif Orig /= N and then Nkind (Orig) = N_Pragma then - Error_Msg_Name_1 := Pragma_Name (Orig); + if Present (Corresponding_Aspect (N)) then + Error_Msg_Name_1 := + Chars (Identifier (Corresponding_Aspect (N))); + end if; end if; end Fix_Error; |