impunit.ads, [...] (Is_RM_Defined_Unit): New function.
2011-09-06 Robert Dewar <dewar@adacore.com> * impunit.ads, impunit.adb (Is_RM_Defined_Unit): New function. * s-rident.ads: New restriction No_Implementation_Units (this restriction is also part of the profile No_Implementation_Extensions) * sem_ch10.adb (Analyze_With_Clause): Add check for No_Implementation_Units restriction. From-SVN: r178594
This commit is contained in:
parent
ebb6faaafa
commit
0a03460680
@ -1,3 +1,12 @@
|
||||
2011-09-06 Robert Dewar <dewar@adacore.com>
|
||||
|
||||
* impunit.ads, impunit.adb (Is_RM_Defined_Unit): New function.
|
||||
* s-rident.ads: New restriction No_Implementation_Units
|
||||
(this restriction is also part of the profile
|
||||
No_Implementation_Extensions)
|
||||
* sem_ch10.adb (Analyze_With_Clause): Add check for
|
||||
No_Implementation_Units restriction.
|
||||
|
||||
2011-09-06 Jerome Guitton <guitton@adacore.com>
|
||||
|
||||
* sysdep.c (__gnat_get_task_options): Disable VX_SPE_TASK
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -72,4 +72,10 @@ package Impunit is
|
||||
-- the known library units, and if so, returns True. If the name does not
|
||||
-- match any known library unit, False is returned.
|
||||
|
||||
function Is_RM_Defined_Unit (U : Unit_Number_Type) return Boolean;
|
||||
-- This function returns True if U represents a unit that is defined in
|
||||
-- the RM, as defined by the No_Implementation_Units restriction rules.
|
||||
-- It is used to implement this restriction, so if False is returned, it
|
||||
-- means that with'ing the unit violates the restriction.
|
||||
|
||||
end Impunit;
|
||||
|
@ -129,6 +129,7 @@ package System.Rident is
|
||||
No_Implementation_Identifiers, -- Ada 2012 AI-246
|
||||
No_Implementation_Pragmas, -- Ada 2005 AI-257
|
||||
No_Implementation_Restrictions, -- GNAT
|
||||
No_Implementation_Units, -- Ada 2012 AI-242
|
||||
No_Implicit_Aliasing, -- GNAT
|
||||
No_Elaboration_Code, -- GNAT
|
||||
No_Obsolescent_Features, -- Ada 2005 AI-368
|
||||
@ -351,7 +352,7 @@ package System.Rident is
|
||||
(No_Implementation_Attributes => True,
|
||||
No_Implementation_Identifiers => True,
|
||||
No_Implementation_Pragmas => True,
|
||||
No_Implementation_Restrictions => True,
|
||||
No_Implementation_Units => True,
|
||||
others => False),
|
||||
|
||||
-- Value settings for Restricted profile (none
|
||||
|
@ -2346,6 +2346,10 @@ package body Sem_Ch10 is
|
||||
Intunit : Boolean;
|
||||
-- Set True if the unit currently being compiled is an internal unit
|
||||
|
||||
Restriction_Violation : Boolean := False;
|
||||
-- Set True if a with violates a restriction, no point in giving any
|
||||
-- warnings if we have this definite error.
|
||||
|
||||
Save_Style_Check : constant Boolean := Opt.Style_Check;
|
||||
Save_C_Restrict : Save_Cunit_Boolean_Restrictions;
|
||||
|
||||
@ -2368,13 +2372,23 @@ package body Sem_Ch10 is
|
||||
Is_Predefined_File_Name (F, Renamings_Included => False)
|
||||
then
|
||||
Check_Restriction (No_Obsolescent_Features, N);
|
||||
Restriction_Violation := True;
|
||||
end if;
|
||||
end;
|
||||
end if;
|
||||
|
||||
-- Check No_Implementation_Units violation
|
||||
|
||||
if Restriction_Check_Required (No_Implementation_Units) then
|
||||
if not Is_RM_Defined_Unit (Get_Source_Unit (U)) then
|
||||
Check_Restriction (No_Implementation_Units, Nam);
|
||||
Restriction_Violation := True;
|
||||
end if;
|
||||
end if;
|
||||
|
||||
-- Save current restriction set, does not apply to with'ed unit
|
||||
|
||||
Save_C_Restrict := Cunit_Boolean_Restrictions_Save;
|
||||
Save_C_Restrict := Cunit_Boolean_Restrictions_Save;
|
||||
|
||||
-- Several actions are skipped for dummy packages (those supplied for
|
||||
-- with's where no matching file could be found). Such packages are
|
||||
@ -2445,12 +2459,14 @@ package body Sem_Ch10 is
|
||||
end if;
|
||||
|
||||
-- Check for inappropriate with of internal implementation unit if we
|
||||
-- are not compiling an internal unit. We do not issue this message
|
||||
-- for implicit with's generated by the compiler itself.
|
||||
-- are not compiling an internal unit and also check for withing unit
|
||||
-- in wrong version of Ada. Do not issue these messages for implicit
|
||||
-- with's generated by the compiler itself.
|
||||
|
||||
if Implementation_Unit_Warnings
|
||||
and then not Intunit
|
||||
and then not Implicit_With (N)
|
||||
and then not Restriction_Violation
|
||||
then
|
||||
declare
|
||||
U_Kind : constant Kind_Of_Unit :=
|
||||
|
Loading…
Reference in New Issue
Block a user