===================================================================
@@ -2960,13 +2960,7 @@ package body Sem_Ch3 is
-- Check No_Wide_Characters restriction
- if T = Standard_Wide_Character
- or else T = Standard_Wide_Wide_Character
- or else Root_Type (T) = Standard_Wide_String
- or else Root_Type (T) = Standard_Wide_Wide_String
- then
- Check_Restriction (No_Wide_Characters, Object_Definition (N));
- end if;
+ Check_Wide_Character_Restriction (T, Object_Definition (N));
-- Indicate this is not set in source. Certainly true for constants,
-- and true for variables so far (will be reset for a variable if and
@@ -13677,8 +13671,20 @@ package body Sem_Ch3 is
Generate_Definition (L);
Set_Convention (L, Convention_Intrinsic);
+ -- Case of character literal
+
if Nkind (L) = N_Defining_Character_Literal then
Set_Is_Character_Type (T, True);
+
+ -- Check violation of No_Wide_Characters
+
+ if Restriction_Active (No_Wide_Characters) then
+ Get_Name_String (Chars (L));
+
+ if Name_Len >= 3 and then Name_Buffer (1 .. 2) = "QW" then
+ Check_Restriction (No_Wide_Characters, L);
+ end if;
+ end if;
end if;
Ev := Ev + 1;
@@ -14211,13 +14217,7 @@ package body Sem_Ch3 is
-- Check No_Wide_Characters restriction
- if Typ = Standard_Wide_Character
- or else Typ = Standard_Wide_Wide_Character
- or else Typ = Standard_Wide_String
- or else Typ = Standard_Wide_Wide_String
- then
- Check_Restriction (No_Wide_Characters, S);
- end if;
+ Check_Wide_Character_Restriction (Typ, S);
return Typ;
end Find_Type_Of_Subtype_Indic;
===================================================================
@@ -25,6 +25,7 @@
with Atree; use Atree;
with Casing; use Casing;
+with Einfo; use Einfo;
with Errout; use Errout;
with Debug; use Debug;
with Fname; use Fname;
@@ -396,6 +397,29 @@ package body Restrict is
end loop;
end Check_Restriction_No_Dependence;
+ --------------------------------------
+ -- Check_Wide_Character_Restriction --
+ --------------------------------------
+
+ procedure Check_Wide_Character_Restriction (E : Entity_Id; N : Node_Id) is
+ begin
+ if Restriction_Active (No_Wide_Characters)
+ and then Comes_From_Source (N)
+ then
+ declare
+ T : constant Entity_Id := Root_Type (E);
+ begin
+ if T = Standard_Wide_Character or else
+ T = Standard_Wide_String or else
+ T = Standard_Wide_Wide_Character or else
+ T = Standard_Wide_Wide_String
+ then
+ Check_Restriction (No_Wide_Characters, N);
+ end if;
+ end;
+ end if;
+ end Check_Wide_Character_Restriction;
+
----------------------------------------
-- Cunit_Boolean_Restrictions_Restore --
----------------------------------------
===================================================================
@@ -239,6 +239,12 @@ package Restrict is
-- mechanism (e.g. a special pragma) to handle this case, but there are
-- only six cases, and it is not worth the effort to do something general.
+ procedure Check_Wide_Character_Restriction (E : Entity_Id; N : Node_Id);
+ -- This procedure checks if the No_Wide_Character restriction is active,
+ -- and if so, if N Comes_From_Source, and the root type of E is one of
+ -- [Wide_]Wide_Character or [Wide_]Wide_String, then the restriction
+ -- violation is recorded, and an appropriate message given.
+
function Cunit_Boolean_Restrictions_Save
return Save_Cunit_Boolean_Restrictions;
-- This function saves the compilation unit restriction settings, and
===================================================================
@@ -454,8 +454,9 @@ package body Sem_Ch8 is
-- private with on E.
procedure Find_Expanded_Name (N : Node_Id);
- -- Selected component is known to be expanded name. Verify legality of
- -- selector given the scope denoted by prefix.
+ -- The input is a selected component is known to be expanded name. Verify
+ -- legality of selector given the scope denoted by prefix, and change node
+ -- N into a expanded name with a properly set Entity field.
function Find_Renamed_Entity
(N : Node_Id;
@@ -4411,6 +4412,10 @@ package body Sem_Ch8 is
<<Found>> begin
+ -- Check violation of No_Wide_Characters restriction
+
+ Check_Wide_Character_Restriction (E, N);
+
-- When distribution features are available (Get_PCS_Name /=
-- Name_No_DSA), a remote access-to-subprogram type is converted
-- into a record type holding whatever information is needed to
@@ -4960,6 +4965,10 @@ package body Sem_Ch8 is
Set_Etype (N, Get_Full_View (Etype (Id)));
end if;
+ -- Check for violation of No_Wide_Characters
+
+ Check_Wide_Character_Restriction (Id, N);
+
-- If the Ekind of the entity is Void, it means that all homonyms are
-- hidden from all visibility (RM 8.3(5,14-20)).
@@ -7330,8 +7339,8 @@ package body Sem_Ch8 is
and then Scope (Id) /= Scope (Prev)
and then Used_As_Generic_Actual (Scope (Prev))
and then Used_As_Generic_Actual (Scope (Id))
- and then List_Containing (Current_Use_Clause (Scope (Prev))) /=
- List_Containing (Current_Use_Clause (Scope (Id)))
+ and then not In_Same_List (Current_Use_Clause (Scope (Prev)),
+ Current_Use_Clause (Scope (Id)))
then
Set_Is_Potentially_Use_Visible (Prev, False);
Append_Elmt (Prev, Hidden_By_Use_Clause (N));