* *
* C Header File *
* *
- * 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- *
extern void *__gnat_realloc (void *, __SIZE_TYPE__);
extern void __gnat_finalize (void);
extern void set_gnat_exit_status (int);
-extern void __gnat_set_globals (int, int,
- char, char, char, char,
- char *, char *,
- int, int, int, int, int, int);
+extern void __gnat_set_globals (void);
extern void __gnat_initialize (void *);
extern void __gnat_init_float (void);
extern void __gnat_install_handler (void);
-- --
-- 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- --
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;
---------------------
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;
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)
end if;
end loop;
- -- Entry is in table
+ -- Entry is not currently in table
No_Dependence.Append ((Unit, Warn));
end Set_Restriction_No_Dependence;
-- --
-- S p e c --
-- --
--- 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- --
package Restrict is
- Restrictions : Restrictions_Info;
+ Restrictions : Restrictions_Info := No_Restrictions;
-- This variable records restrictions found in any units in the main
-- extended unit, and in the case of restrictions checked for partition
-- consistency, restrictions found in any with'ed units, parent specs
-- pragma, and a value of System_Location is used for restrictions
-- set from package Standard by the processing in Targparm.
- Main_Restrictions : Restrictions_Info;
+ Main_Restrictions : Restrictions_Info := No_Restrictions;
-- This variable records only restrictions found in any units of the
-- main extended unit. These are the variables used for ali file output,
-- since we want the binder to be able to accurately diagnose inter-unit
pragma Inline (Restriction_Active);
-- Determines if a given restriction is active. This call should only be
-- used where the compiled code depends on whether the restriction is
- -- active. Always use Check_Restriction to record a violation.
+ -- active. Always use Check_Restriction to record a violation. Note that
+ -- this returns False if we only have a Restriction_Warnings set, since
+ -- restriction warnings should never affect generated code.
function Restricted_Profile return Boolean;
-- Tests if set of restrictions corresponding to Profile (Restricted) is