summaryrefslogtreecommitdiff
path: root/gcc/ada/sem_warn.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2009-07-15 09:59:16 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2009-07-15 09:59:16 +0000
commit902e21825ec901db53142595695f43568de7e16a (patch)
tree7269667b0fc6e29ea066148c0a41903f090ce070 /gcc/ada/sem_warn.adb
parentb05b9ac656db4e914ed78d7c6e391fbb6ece6ea9 (diff)
downloadgcc-902e21825ec901db53142595695f43568de7e16a.tar.gz
2009-07-15 Robert Dewar <dewar@adacore.com>
* debug.adb: Add -gnatd.O to output SCO table * lib-writ.adb (Write_Unit_Information): Use SCO_Output to output SCO information. * lib-writ.ads: Document addition of SCO lines to ALI file * par_sco.ads, par_sco.adb: New files. * opt.ads (Generate_SCO): New switch * par.adb (Par): Call SCO_Record to record SCO information * sem_warn.adb (Warn_On_Constant_Condition): Adjust SCO condition * switch-c.adb: Recognize -gnateS to generate SCO information * usage.adb: Add line for -gnateS * gcc-interface/Make-lang.in: Add dependency on par_sco.o for gnat1 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149669 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/sem_warn.adb')
-rw-r--r--gcc/ada/sem_warn.adb33
1 files changed, 32 insertions, 1 deletions
diff --git a/gcc/ada/sem_warn.adb b/gcc/ada/sem_warn.adb
index 7ca0b864b4e..2b7ecf3fc78 100644
--- a/gcc/ada/sem_warn.adb
+++ b/gcc/ada/sem_warn.adb
@@ -33,6 +33,7 @@ with Lib; use Lib;
with Namet; use Namet;
with Nlists; use Nlists;
with Opt; use Opt;
+with Par_SCO; use Par_SCO;
with Rtsfind; use Rtsfind;
with Sem; use Sem;
with Sem_Ch8; use Sem_Ch8;
@@ -3307,7 +3308,8 @@ package body Sem_Warn is
-----------------------------
procedure Warn_On_Known_Condition (C : Node_Id) is
- P : Node_Id;
+ P : Node_Id;
+ Orig : constant Node_Id := Original_Node (C);
procedure Track (N : Node_Id; Loc : Node_Id);
-- Adds continuation warning(s) pointing to reason (assignment or test)
@@ -3356,6 +3358,35 @@ package body Sem_Warn is
-- Start of processing for Warn_On_Known_Condition
begin
+ -- Adjust SCO condition if from source
+
+ if Comes_From_Source (Orig) then
+ declare
+ Start : Source_Ptr;
+ Dummy : Source_Ptr;
+ Typ : Character;
+ Atrue : Boolean;
+
+ begin
+ Sloc_Range (Orig, Start, Dummy);
+ Atrue := Entity (C) = Standard_True;
+
+ if Present (Parent (C))
+ and then Nkind (Parent (C)) = N_Op_Not
+ then
+ Atrue := not Atrue;
+ end if;
+
+ if Atrue then
+ Typ := 't';
+ else
+ Typ := 'f';
+ end if;
+
+ Set_SCO_Condition (Start, Typ);
+ end;
+ end if;
+
-- Argument replacement in an inlined body can make conditions static.
-- Do not emit warnings in this case.