diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-10-31 18:05:19 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-10-31 18:05:19 +0000 |
commit | 63776baf924523c5599ec559c905e3d22e897fbe (patch) | |
tree | 7e8babcc62128fb11dce00aba20ff8ee49859956 /gcc/ada/restrict.adb | |
parent | b855d8cef1e3ac7eaf18c0445e0c80dcbf5f1520 (diff) | |
download | gcc-63776baf924523c5599ec559c905e3d22e897fbe.tar.gz |
2006-10-31 Arnaud Charlet <charlet@adacore.com>
Robert Dewar <dewar@adacore.com>
* restrict.ads, restrict.adb (Restriction_Active): Now returns False if
only a restriction warning is active for the given restriction. This is
desirable because we do not want to modify code in the case where only
a warning is set.
(Set_Profile_Restrictions): Make sure that a Profile_Warnings never
causes overriding of real restrictions.
Take advantage of new No_Restrictions constant.
* raise.h: (__gnat_set_globals): Change profile.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@118295 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/restrict.adb')
-rw-r--r-- | gcc/ada/restrict.adb | 43 |
1 files changed, 28 insertions, 15 deletions
diff --git a/gcc/ada/restrict.adb b/gcc/ada/restrict.adb index f12c1eb1c83..93fd6f0b045 100644 --- a/gcc/ada/restrict.adb +++ b/gcc/ada/restrict.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2005, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2006, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -484,7 +484,7 @@ package body Restrict is function Restriction_Active (R : All_Restrictions) return Boolean is begin - return Restrictions.Set (R); + return Restrictions.Set (R) and then not Restriction_Warnings (R); end Restriction_Active; --------------------- @@ -570,13 +570,27 @@ package body Restrict is begin for J in R'Range loop if R (J) then - if J in All_Boolean_Restrictions then - Set_Restriction (J, N); - else - Set_Restriction (J, N, V (J)); - end if; + declare + Already_Restricted : constant Boolean := Restriction_Active (J); + + begin + -- Set the restriction + + if J in All_Boolean_Restrictions then + Set_Restriction (J, N); + else + Set_Restriction (J, N, V (J)); + end if; + + -- Set warning flag, except that we do not set the warning + -- flag if the restriction was already active and this is + -- the warning case. That avoids a warning overriding a real + -- restriction, which should never happen. - Restriction_Warnings (J) := Warn; + if not (Warn and Already_Restricted) then + Restriction_Warnings (J) := Warn; + end if; + end; end if; end loop; end Set_Profile_Restrictions; @@ -607,12 +621,11 @@ package body Restrict is Restrictions_Loc (R) := Sloc (N); end if; - -- Record the restriction if we are in the main unit, - -- or in the extended main unit. The reason that we - -- test separately for Main_Unit is that gnat.adc is - -- processed with Current_Sem_Unit = Main_Unit, but - -- nodes in gnat.adc do not appear to be the extended - -- main source unit (they probably should do ???) + -- Record the restriction if we are in the main unit, or in the extended + -- main unit. The reason that we test separately for Main_Unit is that + -- gnat.adc is processed with Current_Sem_Unit = Main_Unit, but nodes in + -- gnat.adc do not appear to be in the extended main source unit (they + -- probably should do ???) if Current_Sem_Unit = Main_Unit or else In_Extended_Main_Source_Unit (N) @@ -698,7 +711,7 @@ package body Restrict is end if; end loop; - -- Entry is in table + -- Entry is not currently in table No_Dependence.Append ((Unit, Warn)); end Set_Restriction_No_Dependence; |