+2011-08-04 Javier Miranda <miranda@adacore.com>
+
+ * exp_strm.adb (Build_Array_Input_Function): if the array type is
+ constrained, do not attempt to build a subtype of it.
+
+2011-08-04 Yannick Moy <moy@adacore.com>
+
+ * errout.ads Change comments: remove 'R'M as an example where quotes
+ are needed; add ALFA as another case where quotes are not needed
+ * erroutc.adb (Set_Msg_Insertion_Reserved_Word): add ALFA as another
+ case where quotes are not needed.
+ * sem_ch11.adb, sem_ch13.adb, sem_ch2.adb, sem_ch3.adb, sem_ch4.adb,
+ sem_ch5.adb, sem_ch6.adb, sem_ch9.adb, sem_prag.adb, sem_res.adb:
+ Remove all occurrences of 'A'L'F'A
+
+2011-08-04 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch13.adb: check legality of invariant pragma.
+
2011-08-04 Eric Botcazou <ebotcazou@adacore.com>
* bindgen.adb: Add comments.
-- Precedes a character which is placed literally into the message.
-- Used to insert characters into messages that are one of the
-- insertion characters defined here. Also useful in inserting
- -- sequences of upper case letters (e.g. RM) which are not to be
- -- treated as keywords.
+ -- sequences of upper case letters which are not to be treated as
+ -- keywords.
-- Insertion character \ (Backslash: continuation message)
-- Indicates that the message is a continuation of a message
-- Note: a special exception is that RM is never treated as a keyword
-- but instead is copied literally into the message, this avoids the
- -- need for writing 'R'M for all reference manual quotes.
+ -- need for writing 'R'M for all reference manual quotes. A similar
+ -- exception is applied to the occurrence of the string ALFA used in
+ -- error messages about the ALFA subset of Ada.
-- In the case of names, the default mode for the error text processor
-- is to surround the name by quotation marks automatically. The case
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2010, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2011, 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- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
-------------------------------------------------------------------------------
+-------------------------------------------R-----------------------------------
-- Warning! Error messages can be generated during Gigi processing by direct
-- calls to error message routines, so it is essential that the processing
if Name_Len = 2 and then Name_Buffer (1 .. 2) = "RM" then
Set_Msg_Name_Buffer;
- -- Not RM: case appropriately and add surrounding quotes
+ -- We make a similar exception for ALFA
+
+ elsif Name_Len = 4 and then Name_Buffer (1 .. 4) = "ALFA" then
+ Set_Msg_Name_Buffer;
+
+ -- Neither RM nor ALFA: case appropriately and add surrounding quotes
else
Set_Casing (Keyword_Casing (Flag_Source), All_Lower_Case);
Next_Index (Indx);
end loop;
- -- If the first subtype is constrained, use it directly. Otherwise
- -- build a subtype indication with the proper bounds.
+ -- If the type is constrained, use it directly. Otherwise build a
+ -- subtype indication with the proper bounds.
- if Is_Constrained (Stream_Base_Type (Typ)) then
+ if Is_Constrained (Typ) then
Odecl :=
Make_Object_Declaration (Loc,
Defining_Identifier => Make_Defining_Identifier (Loc, Name_V),
- Object_Definition =>
- New_Occurrence_Of (Stream_Base_Type (Typ), Loc));
+ Object_Definition => New_Occurrence_Of (Typ, Loc));
else
Odecl :=
Make_Object_Declaration (Loc,
P : Node_Id;
begin
- Mark_Non_ALFA_Subprogram ("raise statement is not in 'A'L'F'A", N);
+ Mark_Non_ALFA_Subprogram ("raise statement is not in ALFA", N);
Check_SPARK_Restriction ("raise statement is not allowed", N);
Check_Unreachable_Code (N);
when Aspect_Invariant |
Aspect_Type_Invariant =>
+ -- Check placement legality
+
+ if not Nkind_In (N, N_Private_Type_Declaration,
+ N_Private_Extension_Declaration)
+ then
+ Error_Msg_N
+ ("invariant aspect must apply to a private type", N);
+ end if;
+
-- Construct the pragma
Aitem :=
and then Is_Object (Entity (N))
and then not Is_In_ALFA (Entity (N))
then
- Mark_Non_ALFA_Subprogram ("object is not in 'A'L'F'A", N);
+ Mark_Non_ALFA_Subprogram ("object is not in ALFA", N);
end if;
end if;
end Analyze_Identifier;
-- not aliased.
if not Is_In_ALFA (T) then
- Mark_Non_ALFA_Subprogram ("object type is not in 'A'L'F'A", N);
+ Mark_Non_ALFA_Subprogram ("object type is not in ALFA", N);
elsif Aliased_Present (N) then
- Mark_Non_ALFA_Subprogram ("ALIASED is not in 'A'L'F'A", N);
+ Mark_Non_ALFA_Subprogram ("ALIASED is not in ALFA", N);
else
Set_Is_In_ALFA (Id);
end if;
procedure Analyze_Aggregate (N : Node_Id) is
begin
- Mark_Non_ALFA_Subprogram ("aggregate is not in 'A'L'F'A", N);
+ Mark_Non_ALFA_Subprogram ("aggregate is not in ALFA", N);
if No (Etype (N)) then
Set_Etype (N, Any_Composite);
C : Node_Id;
begin
- Mark_Non_ALFA_Subprogram ("allocator is not in 'A'L'F'A", N);
+ Mark_Non_ALFA_Subprogram ("allocator is not in ALFA", N);
Check_SPARK_Restriction ("allocator is not allowed", N);
-- Deal with allocator restrictions
-- ALFA, then the call is not in ALFA.
if not Is_Subprogram (Nam_Ent) then
- Mark_Non_ALFA_Subprogram ("indirect call is not in 'A'L'F'A", N);
+ Mark_Non_ALFA_Subprogram ("indirect call is not in ALFA", N);
elsif not Is_In_ALFA (Nam_Ent) then
- Mark_Non_ALFA_Subprogram ("call to subprogram not in 'A'L'F'A", N);
+ Mark_Non_ALFA_Subprogram ("call to subprogram not in ALFA", N);
end if;
Analyze_One_Call (N, Nam_Ent, True, Success);
L : Node_Id;
begin
- Mark_Non_ALFA_Subprogram ("concatenation is not in 'A'L'F'A", N);
+ Mark_Non_ALFA_Subprogram ("concatenation is not in ALFA", N);
Candidate_Type := Empty;
if Present (Else_Expr) and then not In_Pre_Post_Expression then
Mark_Non_ALFA_Subprogram
- ("this form of conditional expression is not in 'A'L'F'A", N);
+ ("this form of conditional expression is not in ALFA", N);
end if;
if Comes_From_Source (N) then
-- Start of processing for Analyze_Explicit_Dereference
begin
- Mark_Non_ALFA_Subprogram ("explicit dereference is not in 'A'L'F'A", N);
+ Mark_Non_ALFA_Subprogram ("explicit dereference is not in ALFA", N);
Check_SPARK_Restriction ("explicit dereference is not allowed", N);
Analyze (P);
procedure Analyze_Null (N : Node_Id) is
begin
- Mark_Non_ALFA_Subprogram ("null is not in 'A'L'F'A", N);
+ Mark_Non_ALFA_Subprogram ("null is not in ALFA", N);
Check_SPARK_Restriction ("null is not allowed", N);
Set_Etype (N, Any_Access);
T : Entity_Id;
begin
- Mark_Non_ALFA_Subprogram ("qualified expression is not in 'A'L'F'A", N);
+ Mark_Non_ALFA_Subprogram ("qualified expression is not in ALFA", N);
Analyze_Expression (Expr);
Iterator : Node_Id;
begin
- Mark_Non_ALFA_Subprogram ("quantified expression is not in 'A'L'F'A", N);
+ Mark_Non_ALFA_Subprogram ("quantified expression is not in ALFA", N);
Check_SPARK_Restriction ("quantified expression is not allowed", N);
Set_Etype (Ent, Standard_Void_Type);
Acc_Type : Entity_Id;
begin
- Mark_Non_ALFA_Subprogram ("reference is not in 'A'L'F'A", N);
+ Mark_Non_ALFA_Subprogram ("reference is not in ALFA", N);
Analyze (P);
-- Start of processing for Analyze_Slice
begin
- Mark_Non_ALFA_Subprogram ("slice is not in 'A'L'F'A", N);
+ Mark_Non_ALFA_Subprogram ("slice is not in ALFA", N);
Check_SPARK_Restriction ("slice is not allowed", N);
Analyze (P);
if not (Is_Scalar_Type (Etype (Expr)) and then Is_Scalar_Type (T)) then
Mark_Non_ALFA_Subprogram
- ("only type conversion between scalar types is in 'A'L'F'A", N);
+ ("only type conversion between scalar types is in ALFA", N);
end if;
-- Only remaining step is validity checks on the argument. These
procedure Analyze_Unchecked_Type_Conversion (N : Node_Id) is
begin
Mark_Non_ALFA_Subprogram
- ("unchecked type conversion is not in 'A'L'F'A", N);
+ ("unchecked type conversion is not in ALFA", N);
Find_Type (Subtype_Mark (N));
Analyze_Expression (Expression (N));
Set_Etype (N, Entity (Subtype_Mark (N)));
and then List_Length (Alternatives (N)) = 1
then
Mark_Non_ALFA_Subprogram
- ("OTHERS as unique case alternative is not in 'A'L'F'A", N);
+ ("OTHERS as unique case alternative is not in ALFA", N);
Check_SPARK_Restriction
("OTHERS as unique case alternative is not allowed", N);
end if;
if Has_Loop_In_Inner_Open_Scopes (U_Name) then
Mark_Non_ALFA_Subprogram
("exit label must name the closest enclosing loop"
- & " in 'A'L'F'A", N);
+ & " in ALFA", N);
Check_SPARK_Restriction
("exit label must name the closest enclosing loop", N);
end if;
if Nkind (Parent (N)) /= N_Loop_Statement then
Mark_Non_ALFA_Subprogram
("exit with when clause must be directly in loop"
- & " in 'A'L'F'A", N);
+ & " in ALFA", N);
Check_SPARK_Restriction
("exit with when clause must be directly in loop", N);
end if;
if Nkind (Parent (N)) /= N_If_Statement then
if Nkind (Parent (N)) = N_Elsif_Part then
Mark_Non_ALFA_Subprogram
- ("exit must be in IF without ELSIF in 'A'L'F'A", N);
+ ("exit must be in IF without ELSIF in ALFA", N);
Check_SPARK_Restriction
("exit must be in IF without ELSIF", N);
else
Mark_Non_ALFA_Subprogram
- ("exit must be directly in IF in 'A'L'F'A", N);
+ ("exit must be directly in IF in ALFA", N);
Check_SPARK_Restriction ("exit must be directly in IF", N);
end if;
elsif Nkind (Parent (Parent (N))) /= N_Loop_Statement then
Mark_Non_ALFA_Subprogram
- ("exit must be in IF directly in loop in 'A'L'F'A", N);
+ ("exit must be in IF directly in loop in ALFA", N);
Check_SPARK_Restriction
("exit must be in IF directly in loop", N);
elsif Present (Else_Statements (Parent (N))) then
Mark_Non_ALFA_Subprogram
- ("exit must be in IF without ELSE in 'A'L'F'A", N);
+ ("exit must be in IF without ELSE in ALFA", N);
Check_SPARK_Restriction ("exit must be in IF without ELSE", N);
-- An exit in an ELSIF does not reach here, as it would have been
elsif Present (Elsif_Parts (Parent (N))) then
Mark_Non_ALFA_Subprogram
- ("exit must be in IF without ELSIF in 'A'L'F'A", N);
+ ("exit must be in IF without ELSIF in ALFA", N);
Check_SPARK_Restriction ("exit must be in IF without ELSIF", N);
end if;
end if;
Label_Ent : Entity_Id;
begin
- Mark_Non_ALFA_Subprogram ("goto statement is not in 'A'L'F'A", N);
+ Mark_Non_ALFA_Subprogram ("goto statement is not in ALFA", N);
Check_SPARK_Restriction ("goto statement is not allowed", N);
-- Actual semantic checks
or else Present (Next (N)))
then
Mark_Non_ALFA_Subprogram
- ("RETURN should be the last statement in 'A'L'F'A", N);
+ ("RETURN should be the last statement in ALFA", N);
Check_SPARK_Restriction
("RETURN should be the last statement in function", N);
end if;
else
- Mark_Non_ALFA_Subprogram ("extended RETURN is not in 'A'L'F'A", N);
+ Mark_Non_ALFA_Subprogram ("extended RETURN is not in ALFA", N);
Check_SPARK_Restriction ("extended RETURN is not allowed", N);
-- Analyze parts specific to extended_return_statement:
if Is_In_ALFA (Formal_Type) then
Set_Is_In_ALFA (Formal);
else
- Mark_Non_ALFA_Subprogram ("formal is not in 'A'L'F'A", Formal);
+ Mark_Non_ALFA_Subprogram ("formal is not in ALFA", Formal);
end if;
Default := Expression (Param_Spec);
begin
Tasking_Used := True;
- Mark_Non_ALFA_Subprogram ("abort statement is not in 'A'L'F'A", N);
+ Mark_Non_ALFA_Subprogram ("abort statement is not in ALFA", N);
Check_SPARK_Restriction ("abort statement is not allowed", N);
T_Name := First (Names (N));
procedure Analyze_Accept_Alternative (N : Node_Id) is
begin
Tasking_Used := True;
- Mark_Non_ALFA_Subprogram ("accept is not in 'A'L'F'A", N);
+ Mark_Non_ALFA_Subprogram ("accept is not in ALFA", N);
if Present (Pragmas_Before (N)) then
Analyze_List (Pragmas_Before (N));
begin
Tasking_Used := True;
- Mark_Non_ALFA_Subprogram ("accept statement is not in 'A'L'F'A", N);
+ Mark_Non_ALFA_Subprogram ("accept statement is not in ALFA", N);
Check_SPARK_Restriction ("accept statement is not allowed", N);
-- Entry name is initialized to Any_Id. It should get reset to the
begin
Tasking_Used := True;
- Mark_Non_ALFA_Subprogram ("select statement is not in 'A'L'F'A", N);
+ Mark_Non_ALFA_Subprogram ("select statement is not in ALFA", N);
Check_SPARK_Restriction ("select statement is not allowed", N);
Check_Restriction (Max_Asynchronous_Select_Nesting, N);
Check_Restriction (No_Select_Statements, N);
begin
Tasking_Used := True;
- Mark_Non_ALFA_Subprogram ("select statement is not in 'A'L'F'A", N);
+ Mark_Non_ALFA_Subprogram ("select statement is not in ALFA", N);
Check_SPARK_Restriction ("select statement is not allowed", N);
Check_Restriction (No_Select_Statements, N);
begin
Tasking_Used := True;
- Mark_Non_ALFA_Subprogram ("delay is not in 'A'L'F'A", N);
+ Mark_Non_ALFA_Subprogram ("delay is not in ALFA", N);
Check_Restriction (No_Delay, N);
if Present (Pragmas_Before (N)) then
E : constant Node_Id := Expression (N);
begin
Tasking_Used := True;
- Mark_Non_ALFA_Subprogram ("delay statement is not in 'A'L'F'A", N);
+ Mark_Non_ALFA_Subprogram ("delay statement is not in ALFA", N);
Check_SPARK_Restriction ("delay statement is not allowed", N);
Check_Restriction (No_Relative_Delay, N);
Check_Restriction (No_Delay, N);
begin
Tasking_Used := True;
- Mark_Non_ALFA_Subprogram ("delay statement is not in 'A'L'F'A", N);
+ Mark_Non_ALFA_Subprogram ("delay statement is not in ALFA", N);
Check_SPARK_Restriction ("delay statement is not allowed", N);
Check_Restriction (No_Delay, N);
Check_Potentially_Blocking_Operation (N);
begin
Tasking_Used := True;
- Mark_Non_ALFA_Subprogram ("entry is not in 'A'L'F'A", N);
+ Mark_Non_ALFA_Subprogram ("entry is not in ALFA", N);
-- Entry_Name is initialized to Any_Id. It should get reset to the
-- matching entry entity. An error is signalled if it is not reset
begin
Tasking_Used := True;
- Mark_Non_ALFA_Subprogram ("entry is not in 'A'L'F'A", N);
+ Mark_Non_ALFA_Subprogram ("entry is not in ALFA", N);
if Present (Index) then
Analyze (Index);
begin
Tasking_Used := True;
- Mark_Non_ALFA_Subprogram ("entry call is not in 'A'L'F'A", N);
+ Mark_Non_ALFA_Subprogram ("entry call is not in ALFA", N);
Check_SPARK_Restriction ("entry call is not allowed", N);
if Present (Pragmas_Before (N)) then
begin
Generate_Definition (Def_Id);
Tasking_Used := True;
- Mark_Non_ALFA_Subprogram ("entry is not in 'A'L'F'A", N);
+ Mark_Non_ALFA_Subprogram ("entry is not in ALFA", N);
-- Case of no discrete subtype definition
begin
Tasking_Used := True;
- Mark_Non_ALFA_Subprogram ("entry is not in 'A'L'F'A", N);
+ Mark_Non_ALFA_Subprogram ("entry is not in ALFA", N);
Analyze (Def);
-- There is no elaboration of the entry index specification. Therefore,
begin
Tasking_Used := True;
- Mark_Non_ALFA_Subprogram ("protected body is not in 'A'L'F'A", N);
+ Mark_Non_ALFA_Subprogram ("protected body is not in ALFA", N);
Set_Ekind (Body_Id, E_Protected_Body);
Spec_Id := Find_Concurrent_Spec (Body_Id);
begin
Tasking_Used := True;
- Mark_Non_ALFA_Subprogram ("protected definition is not in 'A'L'F'A", N);
+ Mark_Non_ALFA_Subprogram ("protected definition is not in ALFA", N);
Check_SPARK_Restriction ("protected definition is not allowed", N);
Analyze_Declarations (Visible_Declarations (N));
end if;
Tasking_Used := True;
- Mark_Non_ALFA_Subprogram ("protected type is not in 'A'L'F'A", N);
+ Mark_Non_ALFA_Subprogram ("protected type is not in ALFA", N);
Check_Restriction (No_Protected_Types, N);
T := Find_Type_Name (N);
begin
Tasking_Used := True;
- Mark_Non_ALFA_Subprogram ("requeue statement is not in 'A'L'F'A", N);
+ Mark_Non_ALFA_Subprogram ("requeue statement is not in ALFA", N);
Check_SPARK_Restriction ("requeue statement is not allowed", N);
Check_Restriction (No_Requeue_Statements, N);
Check_Unreachable_Code (N);
begin
Tasking_Used := True;
- Mark_Non_ALFA_Subprogram ("select statement is not in 'A'L'F'A", N);
+ Mark_Non_ALFA_Subprogram ("select statement is not in ALFA", N);
Check_SPARK_Restriction ("select statement is not allowed", N);
Check_Restriction (No_Select_Statements, N);
begin
Generate_Definition (Id);
Tasking_Used := True;
- Mark_Non_ALFA_Subprogram ("protected object is not in 'A'L'F'A", N);
+ Mark_Non_ALFA_Subprogram ("protected object is not in ALFA", N);
-- The node is rewritten as a protected type declaration, in exact
-- analogy with what is done with single tasks.
begin
Generate_Definition (Id);
Tasking_Used := True;
- Mark_Non_ALFA_Subprogram ("task is not in 'A'L'F'A", N);
+ Mark_Non_ALFA_Subprogram ("task is not in ALFA", N);
-- The node is rewritten as a task type declaration, followed by an
-- object declaration of that anonymous task type.
begin
Tasking_Used := True;
- Mark_Non_ALFA_Subprogram ("task body is not in 'A'L'F'A", N);
+ Mark_Non_ALFA_Subprogram ("task body is not in ALFA", N);
Set_Ekind (Body_Id, E_Task_Body);
Set_Scope (Body_Id, Current_Scope);
Spec_Id := Find_Concurrent_Spec (Body_Id);
begin
Tasking_Used := True;
- Mark_Non_ALFA_Subprogram ("task definition is not in 'A'L'F'A", N);
+ Mark_Non_ALFA_Subprogram ("task definition is not in ALFA", N);
Check_SPARK_Restriction ("task definition is not allowed", N);
if Present (Visible_Declarations (N)) then
begin
Check_Restriction (No_Tasking, N);
Tasking_Used := True;
- Mark_Non_ALFA_Subprogram ("task type is not in 'A'L'F'A", N);
+ Mark_Non_ALFA_Subprogram ("task type is not in ALFA", N);
T := Find_Type_Name (N);
Generate_Definition (T);
procedure Analyze_Terminate_Alternative (N : Node_Id) is
begin
Tasking_Used := True;
- Mark_Non_ALFA_Subprogram ("terminate is not in 'A'L'F'A", N);
+ Mark_Non_ALFA_Subprogram ("terminate is not in ALFA", N);
if Present (Pragmas_Before (N)) then
Analyze_List (Pragmas_Before (N));
begin
Tasking_Used := True;
- Mark_Non_ALFA_Subprogram ("select statement is not in 'A'L'F'A", N);
+ Mark_Non_ALFA_Subprogram ("select statement is not in ALFA", N);
Check_SPARK_Restriction ("select statement is not allowed", N);
Check_Restriction (No_Select_Statements, N);
begin
Tasking_Used := True;
- Mark_Non_ALFA_Subprogram ("triggering statement is not in 'A'L'F'A", N);
+ Mark_Non_ALFA_Subprogram ("triggering statement is not in ALFA", N);
if Present (Pragmas_Before (N)) then
Analyze_List (Pragmas_Before (N));
then
Error_Pragma
("pragma% is placed after violation"
- & " of 'A'L'F'A");
+ & " of ALFA");
end if;
-- We treat this as a Rep_Item to record it on the rep
if Is_Boolean_Type (T) then
Mark_Non_ALFA_Subprogram
- ("ordering operator on boolean type is not in 'A'L'F'A", N);
+ ("ordering operator on boolean type is not in ALFA", N);
Check_SPARK_Restriction
("comparison is not defined on Boolean type", N);
elsif Is_Array_Type (T) then
Mark_Non_ALFA_Subprogram
- ("ordering operator on array type is not in 'A'L'F'A", N);
+ ("ordering operator on array type is not in ALFA", N);
if Base_Type (T) /= Standard_String then
Check_SPARK_Restriction
if Root_Type (Typ) /= Standard_Boolean then
Mark_Non_ALFA_Subprogram
- ("non-boolean conditional expression is not in 'A'L'F'A", N);
+ ("non-boolean conditional expression is not in ALFA", N);
end if;
Set_Etype (N, Typ);
if Is_Array_Type (T) then
Mark_Non_ALFA_Subprogram
- ("equality operator on array is not in 'A'L'F'A", N);
+ ("equality operator on array is not in ALFA", N);
-- Protect call to Matching_Static_Array_Bounds to avoid costly
-- operation if not needed.
and then Nkind (N) in N_Binary_Op
then
Mark_Non_ALFA_Subprogram
- ("binary operator on array is not in 'A'L'F'A", N);
+ ("binary operator on array is not in ALFA", N);
declare
Left_Typ : constant Node_Id := Etype (Left_Opnd (N));