From: Yannick Moy Date: Wed, 25 Nov 2020 13:59:54 +0000 (+0100) Subject: [Ada] Fixes for GNAT error/warning messages X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9ed2b86d1b367382be14dfbb7a083e10b1373f8f;p=gcc.git [Ada] Fixes for GNAT error/warning messages gcc/ada/ * checks.adb: Rework error messages. * exp_ch3.adb: Likewise. * freeze.adb: Likewise. * lib-load.adb: Likewise. * par-ch12.adb: Likewise. * par-ch3.adb: Likewise. * par-ch4.adb: Likewise. * par-ch9.adb: Likewise. * sem_aggr.adb: Likewise. * sem_attr.adb: Likewise. * sem_cat.adb: Likewise. * sem_ch10.adb: Likewise. * sem_ch12.adb: Likewise. (Instantiate_Type): Fix CODEFIX comment, applicable only on continuation message, and identify the second message as a continuation. * sem_ch13.adb: Rework error messages. * sem_ch3.adb: Likewise. * sem_ch4.adb: Likewise. * sem_ch5.adb: Likewise. * sem_ch6.adb: Likewise. * sem_ch8.adb: Likewise. * sem_ch9.adb: Likewise. * sem_prag.adb: Likewise. * sem_res.adb: Likewise. * sem_util.adb: Likewise. (Wrong_Type): Fix CODEFIX comment, applicable only on continuation message, and identify the second message as a continuation. * symbols.adb: Rework error messages. gcc/testsuite/ * gnat.dg/interface6.adb, gnat.dg/not_null.adb, gnat.dg/protected_func.adb: Adjust error messages. --- diff --git a/gcc/ada/checks.adb b/gcc/ada/checks.adb index 803bd21a586..f4757108478 100644 --- a/gcc/ada/checks.adb +++ b/gcc/ada/checks.adb @@ -4386,7 +4386,7 @@ package body Checks is Apply_Compile_Time_Constraint_Error (N => Expr, Msg => - "(Ada 2005) null not allowed in null-excluding " + "(Ada 2005) NULL not allowed in null-excluding " & "components??", Reason => CE_Null_Not_Allowed); @@ -4394,7 +4394,7 @@ package body Checks is Apply_Compile_Time_Constraint_Error (N => Expr, Msg => - "(Ada 2005) null not allowed in null-excluding " + "(Ada 2005) NULL not allowed in null-excluding " & "objects??", Reason => CE_Null_Not_Allowed); @@ -4402,7 +4402,7 @@ package body Checks is Apply_Compile_Time_Constraint_Error (N => Expr, Msg => - "(Ada 2005) null not allowed in null-excluding " + "(Ada 2005) NULL not allowed in null-excluding " & "formals??", Reason => CE_Null_Not_Allowed); diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb index e46ede8506b..e0040ede093 100644 --- a/gcc/ada/exp_ch3.adb +++ b/gcc/ada/exp_ch3.adb @@ -9024,13 +9024,13 @@ package body Exp_Ch3 is if Warning_Needed then Error_Msg_N - ("Objects of the type cannot be initialized statically " + ("objects of the type cannot be initialized statically " & "by default??", Parent (E)); end if; end if; else - Error_Msg_N ("Object cannot be initialized statically??", E); + Error_Msg_N ("object cannot be initialized statically??", E); end if; end if; end Initialization_Warning; diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb index b877b441de8..8dc8a222396 100644 --- a/gcc/ada/freeze.adb +++ b/gcc/ada/freeze.adb @@ -5642,7 +5642,7 @@ package body Freeze is Has_Rep_Pragma (E, Name_Atomic_Components) then Error_Msg_N - ("stand alone atomic constant must be " & + ("standalone atomic constant must be " & "imported (RM C.6(13))", E); elsif Has_Rep_Pragma (E, Name_Volatile) @@ -5650,7 +5650,7 @@ package body Freeze is Has_Rep_Pragma (E, Name_Volatile_Components) then Error_Msg_N - ("stand alone volatile constant must be " & + ("standalone volatile constant must be " & "imported (RM C.6(13))", E); end if; end if; diff --git a/gcc/ada/lib-load.adb b/gcc/ada/lib-load.adb index 75226d35ffb..f8d632af78f 100644 --- a/gcc/ada/lib-load.adb +++ b/gcc/ada/lib-load.adb @@ -646,7 +646,7 @@ package body Lib.Load is else Error_Msg_File_1 := Fname; Error_Msg_Unit_1 := Uname_Actual; - Error_Msg ("File{ does not contain unit$", Load_Msg_Sloc); + Error_Msg ("file{ does not contain unit$", Load_Msg_Sloc); end if; Write_Dependency_Chain; diff --git a/gcc/ada/par-ch12.adb b/gcc/ada/par-ch12.adb index 99abf88cc3f..5a6a1f4ae5d 100644 --- a/gcc/ada/par-ch12.adb +++ b/gcc/ada/par-ch12.adb @@ -355,13 +355,13 @@ package body Ch12 is Scan; -- past OTHERS if Token /= Tok_Arrow then - Error_Msg_BC ("expect arrow after others"); + Error_Msg_BC ("expect `='>` after OTHERS"); else Scan; -- past arrow end if; if Token /= Tok_Box then - Error_Msg_BC ("expect Box after arrow"); + Error_Msg_BC ("expect `'<'>` after `='>`"); else Scan; -- past box end if; diff --git a/gcc/ada/par-ch3.adb b/gcc/ada/par-ch3.adb index b7460361d9d..b8bf3aa1328 100644 --- a/gcc/ada/par-ch3.adb +++ b/gcc/ada/par-ch3.adb @@ -914,7 +914,7 @@ package body Ch3 is if Unknown_Dis then Error_Msg - ("Full type declaration cannot have unknown discriminants", + ("full type declaration cannot have unknown discriminants", Discr_Sloc); end if; end if; @@ -1051,7 +1051,7 @@ package body Ch3 is -- otherwise things are really messed up, so resynchronize. if Token = Tok_Record then - Error_Msg_SC ("anonymous record definitions are not permitted"); + Error_Msg_SC ("anonymous record definition not permitted"); Discard_Junk_Node (P_Record_Definition); return Error; @@ -3557,7 +3557,7 @@ package body Ch3 is Set_Defining_Identifier (Decl_Node, Idents (Ident)); if Token = Tok_Constant then - Error_Msg_SC ("constant components are not permitted"); + Error_Msg_SC ("constant component not permitted"); Scan; end if; @@ -3598,7 +3598,7 @@ package body Ch3 is Set_Null_Exclusion_Present (CompDef_Node, Not_Null_Present); if Token = Tok_Array then - Error_Msg_SC ("anonymous arrays not allowed as components"); + Error_Msg_SC ("anonymous array not allowed as component"); raise Error_Resync; end if; @@ -4218,7 +4218,7 @@ package body Ch3 is if Token = Tok_All then if Ada_Version < Ada_2005 then Error_Msg_SP - ("ALL is not permitted for anonymous access types"); + ("ALL not permitted for anonymous access type"); end if; Scan; -- past ALL @@ -4750,7 +4750,7 @@ package body Ch3 is elsif Kind = N_Assignment_Statement then Error_Msg ("assignment statement not allowed in package spec", - Sloc (Decl)); + Sloc (Decl)); end if; Next (Decl); diff --git a/gcc/ada/par-ch4.adb b/gcc/ada/par-ch4.adb index c1e781cce71..cf00364436d 100644 --- a/gcc/ada/par-ch4.adb +++ b/gcc/ada/par-ch4.adb @@ -1233,7 +1233,7 @@ package body Ch4 is Attr_Node := New_Node (N_Attribute_Reference, Token_Ptr); Set_Attribute_Name (Attr_Node, Attr_Name); if Attr_Name /= Name_Reduce then - Error_Msg ("reduce attribute expected", Prev_Token_Ptr); + Error_Msg ("Reduce attribute expected", Prev_Token_Ptr); end if; Set_Prefix (Attr_Node, S); @@ -1584,7 +1584,7 @@ package body Ch4 is elsif Token = Tok_With then Error_Msg_SC ("WITH must be preceded by single expression in " & - "extension aggregate"); + "extension aggregate"); raise Error_Resync; -- Range attribute can only appear as part of a discrete choice list diff --git a/gcc/ada/par-ch9.adb b/gcc/ada/par-ch9.adb index f542d727a5a..10b4e7b6825 100644 --- a/gcc/ada/par-ch9.adb +++ b/gcc/ada/par-ch9.adb @@ -904,7 +904,7 @@ package body Ch9 is Resync_Past_Semicolon; elsif Token in Token_Class_Declk then - Error_Msg_SC ("this declaration not allowed in protected body"); + Error_Msg_SC ("declaration not allowed in protected body"); Resync_Past_Semicolon; else diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb index 0f546462b20..e2af74739ee 100644 --- a/gcc/ada/sem_aggr.adb +++ b/gcc/ada/sem_aggr.adb @@ -2949,7 +2949,7 @@ package body Sem_Aggr is while Present (Choice) loop Analyze_And_Resolve (Choice, Key_Type); if not Is_Static_Expression (Choice) then - Error_Msg_N ("Choice must be static", Choice); + Error_Msg_N ("choice must be static", Choice); end if; Next (Choice); @@ -2994,7 +2994,7 @@ package body Sem_Aggr is if Present (Component_Associations (N)) then if Present (Expressions (N)) then - Error_Msg_N ("Container aggregate cannot be " + Error_Msg_N ("container aggregate cannot be " & "both positional and named", N); return; end if; @@ -3075,7 +3075,7 @@ package body Sem_Aggr is while Present (Choice) loop if Nkind (Choice) = N_Others_Choice then Error_Msg_N - ("others not allowed in delta aggregate", Choice); + ("OTHERS not allowed in delta aggregate", Choice); elsif Nkind (Choice) = N_Subtype_Indication then Resolve_Discrete_Subtype_Indication @@ -3122,7 +3122,7 @@ package body Sem_Aggr is if Nkind (Choice) = N_Others_Choice then Error_Msg_N - ("others not allowed in delta aggregate", Choice); + ("OTHERS not allowed in delta aggregate", Choice); elsif Is_Entity_Name (Choice) and then Is_Type (Entity (Choice)) @@ -5387,7 +5387,7 @@ package body Sem_Aggr is ("OTHERS must represent at least one component", Selectr); elsif Others_Box = 1 and then Warn_On_Redundant_Constructs then - Error_Msg_N ("others choice is redundant?", Box_Node); + Error_Msg_N ("OTHERS choice is redundant?", Box_Node); Error_Msg_N ("\previous choices cover all components?", Box_Node); end if; @@ -5554,7 +5554,7 @@ package body Sem_Aggr is -- because the association may be a null array range. Error_Msg_N - ("(Ada 2005) null not allowed in null-excluding component??", Expr); + ("(Ada 2005) NULL not allowed in null-excluding component??", Expr); Error_Msg_N ("\Constraint_Error will be raised at run time??", Expr); diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb index 1f769a53be7..0bef709e9e6 100644 --- a/gcc/ada/sem_attr.adb +++ b/gcc/ada/sem_attr.adb @@ -3287,7 +3287,7 @@ package body Sem_Attr is Check_E0; if not Is_Object_Reference (P) then - Error_Attr_P ("prefix for % attribute must be object"); + Error_Attr_P ("prefix of % attribute must be object"); -- What about the access object cases ??? @@ -3698,7 +3698,7 @@ package body Sem_Attr is null; else Error_Attr - ("Attribute % must apply to entry of current task", N); + ("attribute % must apply to entry of current task", N); end if; end if; @@ -3710,7 +3710,7 @@ package body Sem_Attr is | E_Entry_Family | E_Loop then - Error_Attr ("Attribute % cannot appear in inner unit", N); + Error_Attr ("attribute % cannot appear in inner unit", N); elsif Ekind (Scope (Ent)) = E_Protected_Type and then not Has_Completion (Scope (Ent)) @@ -5667,7 +5667,7 @@ package body Sem_Attr is null; else Error_Msg_NE - ("cannot apply reduce to object of type$", N, Typ); + ("cannot apply Reduce to object of type$", N, Typ); end if; elsif Present (Expressions (Stream)) @@ -5676,7 +5676,7 @@ package body Sem_Attr is N_Iterated_Component_Association then Error_Msg_N - ("Prefix of reduce must be an iterated component", N); + ("prefix of Reduce must be an iterated component", N); end if; Analyze (E1); @@ -6249,7 +6249,7 @@ package body Sem_Attr is then Error_Attr_P ("% attribute can only be applied to objects " & - "of class - wide type"); + "of class-wide type"); end if; -- The prefix cannot be an incomplete type. However, references to @@ -6734,7 +6734,7 @@ package body Sem_Attr is if Nkind (Expr) = N_Others_Choice then Error_Attr - ("others choice not allowed in attribute %", Expr); + ("OTHERS choice not allowed in attribute %", Expr); -- Otherwise analyze and resolve all indexes @@ -6781,7 +6781,7 @@ package body Sem_Attr is if Nkind (Index) = N_Others_Choice then Error_Attr - ("others choice not allowed in attribute %", Index); + ("OTHERS choice not allowed in attribute %", Index); -- The index denotes a range of elements @@ -6956,7 +6956,7 @@ package body Sem_Attr is elsif Nkind (Comp) = N_Others_Choice then Error_Attr - ("others choice not allowed in attribute %", Comp); + ("OTHERS choice not allowed in attribute %", Comp); -- The name of a record component cannot appear in any -- other form. diff --git a/gcc/ada/sem_cat.adb b/gcc/ada/sem_cat.adb index 7872c6821fc..ee22113a3c4 100644 --- a/gcc/ada/sem_cat.adb +++ b/gcc/ada/sem_cat.adb @@ -1068,7 +1068,8 @@ package body Sem_Cat is and then not Private_Present (P) and then not Is_Remote_Call_Interface (E) then - Error_Msg_N ("public child of rci unit must also be rci unit", N); + Error_Msg_N + ("public child of 'R'C'I unit must also be 'R'C'I unit", N); end if; end if; end Validate_Categorization_Dependency; @@ -1580,21 +1581,21 @@ package body Sem_Cat is if Comes_From_Source (E) then if Is_Limited_Type (E) then Error_Msg_N - ("limited type not allowed in rci unit", Parent (E)); + ("limited type not allowed in 'R'C'I unit", Parent (E)); Explain_Limited_Type (E, Parent (E)); elsif Ekind (E) in E_Generic_Function | E_Generic_Package | E_Generic_Procedure then - Error_Msg_N ("generic declaration not allowed in rci unit", + Error_Msg_N ("generic declaration not allowed in 'R'C'I unit", Parent (E)); elsif (Ekind (E) = E_Function or else Ekind (E) = E_Procedure) and then Has_Pragma_Inline (E) then Error_Msg_N - ("inlined subprogram not allowed in rci unit", Parent (E)); + ("inlined subprogram not allowed in 'R'C'I unit", Parent (E)); -- Inner packages that are renamings need not be checked. Generic -- RCI packages are subject to the checks, but entities that come diff --git a/gcc/ada/sem_ch10.adb b/gcc/ada/sem_ch10.adb index 2d1232e31f1..e5519bfc6fa 100644 --- a/gcc/ada/sem_ch10.adb +++ b/gcc/ada/sem_ch10.adb @@ -6184,34 +6184,35 @@ package body Sem_Ch10 is null; when N_Subprogram_Declaration => - Error_Msg_N ("subprograms not allowed in limited with_clauses", N); + Error_Msg_N + ("subprogram not allowed in `LIMITED WITH` clause", N); return; when N_Generic_Package_Declaration | N_Generic_Subprogram_Declaration => - Error_Msg_N ("generics not allowed in limited with_clauses", N); + Error_Msg_N ("generic not allowed in `LIMITED WITH` clause", N); return; when N_Generic_Instantiation => Error_Msg_N - ("generic instantiations not allowed in limited with_clauses", + ("generic instantiation not allowed in `LIMITED WITH` clause", N); return; when N_Generic_Renaming_Declaration => Error_Msg_N - ("generic renamings not allowed in limited with_clauses", N); + ("generic renaming not allowed in `LIMITED WITH` clause", N); return; when N_Subprogram_Renaming_Declaration => Error_Msg_N - ("renamed subprograms not allowed in limited with_clauses", N); + ("renamed subprogram not allowed in `LIMITED WITH` clause", N); return; when N_Package_Renaming_Declaration => Error_Msg_N - ("renamed packages not allowed in limited with_clauses", N); + ("renamed package not allowed in `LIMITED WITH` clause", N); return; when others => diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb index 6a32bdca1ca..7e6aa8f6180 100644 --- a/gcc/ada/sem_ch12.adb +++ b/gcc/ada/sem_ch12.adb @@ -1619,7 +1619,7 @@ package body Sem_Ch12 is Others_Choice := Actual; if Present (Next (Actual)) then - Error_Msg_N ("others must be last association", Actual); + Error_Msg_N ("OTHERS must be last association", Actual); end if; -- This subprogram is used both for formal packages and for @@ -1630,7 +1630,7 @@ package body Sem_Ch12 is and then Comes_From_Source (I_Node) then Error_Msg_N - ("others association not allowed in an instance", + ("OTHERS association not allowed in an instance", Actual); end if; @@ -12936,10 +12936,10 @@ package body Sem_Ch12 is elsif Ekind (A_Gen_T) = E_General_Access_Type and then Ekind (Base_Type (Act_T)) /= E_General_Access_Type then - Error_Msg_N -- CODEFIX + Error_Msg_N ("actual must be general access type!", Actual); Error_Msg_NE -- CODEFIX - ("add ALL to }!", Actual, Act_T); + ("\add ALL to }!", Actual, Act_T); Abandon_Instantiation (Actual); end if; end if; @@ -13230,7 +13230,7 @@ package body Sem_Ch12 is else Error_Msg_Name_1 := Chars (Act_T); Error_Msg_NE - ("Actual% must implement interface&", + ("actual% must implement interface&", Actual, Etype (Iface)); end if; diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index f1a2304bd15..8641c815081 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -2012,9 +2012,9 @@ package body Sem_Ch13 is Error_Msg_N ("incompatible interfacing aspects given for &", E); Error_Msg_Sloc := Sloc (Expo); - Error_Msg_N ("\aspect `Export` #", E); + Error_Msg_N ("\aspect Export #", E); Error_Msg_Sloc := Sloc (Imp); - Error_Msg_N ("\aspect `Import` #", E); + Error_Msg_N ("\aspect Import #", E); end if; -- A variable is most likely modified from the outside. Take @@ -2096,8 +2096,8 @@ package body Sem_Ch13 is if A_Id = Aspect_External_Name then if No (Expo) and then No (Imp) then Error_Msg_N - ("aspect `External_Name` requires aspect `Import` or " - & "`Export`", Aspect); + ("aspect External_Name requires aspect Import or " + & "Export", Aspect); end if; -- Otherwise ensure that aspect Link_Name applies to aspect @@ -2107,8 +2107,8 @@ package body Sem_Ch13 is pragma Assert (A_Id = Aspect_Link_Name); if No (Expo) and then No (Imp) then Error_Msg_N - ("aspect `Link_Name` requires aspect `Import` or " - & "`Export`", Aspect); + ("aspect Link_Name requires aspect Import or Export", + Aspect); end if; end if; end Analyze_Aspect_External_Link_Name; @@ -2594,8 +2594,9 @@ package body Sem_Ch13 is for Asp in Pre_Post_Aspects loop if Has_Aspect (E, Asp) then Error_Msg_N - ("this aspect not allowed for static expression " - & "functions", Find_Aspect (E, Asp)); + ("this aspect is not allowed for a static " + & "expression function", + Find_Aspect (E, Asp)); return; end if; @@ -2659,7 +2660,7 @@ package body Sem_Ch13 is elsif Within_Protected_Type (E) then Error_Msg_N - ("aspect% not applicable to protected operations", Id); + ("aspect% not applicable to protected operation", Id); return; else @@ -3375,7 +3376,7 @@ package body Sem_Ch13 is else Error_Msg_N - ("main subprogram CPU is out of range", Expr); + ("main subprogram 'C'P'U is out of range", Expr); end if; -- For the Priority aspect @@ -4201,14 +4202,14 @@ package body Sem_Ch13 is elsif A_Id = Aspect_Default_Value and then not Is_Scalar_Type (E) then - Error_Msg_N ("aspect% can only be applied to scalar type", - Id); + Error_Msg_N + ("aspect% can only be applied to scalar type", Id); goto Continue; elsif A_Id = Aspect_Default_Component_Value then if not Is_Array_Type (E) then - Error_Msg_N ("aspect% can only be applied to array " & - "type", Id); + Error_Msg_N + ("aspect% can only be applied to array type", Id); goto Continue; elsif not Is_Scalar_Type (Component_Type (E)) then @@ -4423,7 +4424,7 @@ package body Sem_Ch13 is if Nkind (Parent (N)) = N_Compilation_Unit then Error_Msg_Name_1 := Nam; - Error_Msg_N ("incorrect placement of aspect `%`", E); + Error_Msg_N ("incorrect placement of aspect %", E); goto Continue; end if; @@ -4432,7 +4433,7 @@ package body Sem_Ch13 is then Error_Msg_Name_1 := Nam; Error_Msg_NE - ("wrong syntax for aspect `%` for &", Id, E); + ("wrong syntax for aspect % for &", Id, E); goto Continue; end if; @@ -4464,7 +4465,7 @@ package body Sem_Ch13 is then Error_Msg_Name_1 := Nam; Error_Msg_NE - ("wrong syntax for aspect `%` for &", Id, E); + ("wrong syntax for aspect % for &", Id, E); goto Continue; end if; @@ -6627,7 +6628,7 @@ package body Sem_Ch13 is -- come from an aspect specification. if not Is_Task_Type (U_Ent) then - Error_Msg_N ("CPU can only be defined for task", Nam); + Error_Msg_N ("'C'P'U can only be defined for task", Nam); elsif Duplicate_Clause then null; @@ -6718,7 +6719,7 @@ package body Sem_Ch13 is else Error_Msg_NE - ("Default Iterator must be a primitive of&", Func, U_Ent); + ("Default_Iterator must be a primitive of&", Func, U_Ent); end if; end Default_Iterator; @@ -7772,7 +7773,7 @@ package body Sem_Ch13 is | N_Implicit_Label_Declaration then Error_Msg_N - ("this declaration not allowed in machine code subprogram", + ("this declaration is not allowed in machine code subprogram", DeclO); end if; @@ -7971,7 +7972,7 @@ package body Sem_Ch13 is end if; if Nkind (Choice) = N_Others_Choice then - Error_Msg_N ("others choice not allowed here", Choice); + Error_Msg_N ("OTHERS choice not allowed here", Choice); Err := True; elsif Nkind (Choice) = N_Range then @@ -9149,7 +9150,7 @@ package body Sem_Ch13 is or else Etype (Expression (Expr)) /= Typ then Error_Msg_N - ("expression must denaote subtype", Expression (Expr)); + ("expression must denote subtype", Expression (Expr)); return False_Range; end if; @@ -15244,7 +15245,7 @@ package body Sem_Ch13 is ("NOT modifier not allowed for Stable_Properties aspect" & " of a type", PF_Arg); else - Error_Msg_N ("Mixed use of NOT modifiers", PF_Arg); + Error_Msg_N ("mixed use of NOT modifiers", PF_Arg); end if; end Modifier_Error; @@ -15277,7 +15278,7 @@ package body Sem_Ch13 is if Nkind (PF_Name) not in N_Identifier | N_Operator_Symbol | N_Selected_Component then - Error_Msg_N ("Bad property function name", PF_Name); + Error_Msg_N ("bad property function name", PF_Name); end if; end Check_Property_Function_Arg; @@ -15293,13 +15294,13 @@ package body Sem_Ch13 is if Is_Aspect_Of_Type then if not Is_Tagged_Type (E) then Error_Msg_N - ("Stable_Properties'Class aspect cannot be specified for " + ("Stable_Properties''Class aspect cannot be specified for " & "an untagged type", N); end if; else if not Is_Dispatching_Operation (E) then Error_Msg_N - ("Stable_Properties'Class aspect cannot be specified for " + ("Stable_Properties''Class aspect cannot be specified for " & "a subprogram that is not a primitive subprogram " & "of a tagged type", N); end if; @@ -15311,7 +15312,7 @@ package body Sem_Ch13 is or else Null_Record_Present (N) or else not Present (Expressions (N)) then - Error_Msg_N ("Bad Stable_Properties aspect specification", N); + Error_Msg_N ("bad Stable_Properties aspect specification", N); return; end if; @@ -15364,7 +15365,7 @@ package body Sem_Ch13 is -- First or Last (Container) => Cursor if Etype (Ent) /= Cursor then - Error_Msg_N ("primitive for First must yield a curosr", N); + Error_Msg_N ("primitive for First must yield a cursor", N); end if; elsif Nam = Name_Next then diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index 9b4d2cc5e87..a51dd54aff5 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -833,7 +833,7 @@ package body Sem_Ch3 is if All_Present (N) and then Ada_Version >= Ada_2005 then - Error_Msg_N ("ALL is not permitted for anonymous access types", N); + Error_Msg_N ("ALL not permitted for anonymous access types", N); end if; -- Ada 2005 (AI-254): In case of anonymous access to subprograms call @@ -1026,7 +1026,8 @@ package body Sem_Ch3 is if Nkind (Def) in N_Has_Etype then if Etype (Def) = T_Name then Error_Msg_N - ("type& cannot be used before end of its declaration", Def); + ("type& cannot be used before the end of its declaration", + Def); end if; -- If this is not a subtype, then this is an access_definition @@ -12992,7 +12993,7 @@ package body Sem_Ch3 is then Error_Msg_N ("deferred constant must be declared in visible part", - Parent (Prev)); + Parent (Prev)); end if; if Is_Access_Type (T) diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb index 9f7652b8630..01d70b00684 100644 --- a/gcc/ada/sem_ch4.adb +++ b/gcc/ada/sem_ch4.adb @@ -2297,7 +2297,7 @@ package body Sem_Ch4 is end if; if Aliased_Present (A) then - Error_Msg_N ("aliased not allowed in declare_expression", A); + Error_Msg_N ("ALIASED not allowed in declare_expression", A); end if; if Constant_Present (A) @@ -2449,7 +2449,7 @@ package body Sem_Ch4 is if Etype (N) = Any_Type then Error_Msg_N - ("type incompatible with that of `THEN` expression", + ("type incompatible with that of THEN expression", Else_Expr); return; end if; @@ -5700,7 +5700,7 @@ package body Sem_Ch4 is Error_Msg_N ("\use qualified expression instead", N); elsif Nkind (Expr) = N_Allocator then - Error_Msg_N ("argument of conversion cannot be an allocator", N); + Error_Msg_N ("argument of conversion cannot be allocator", N); Error_Msg_N ("\use qualified expression instead", N); elsif Nkind (Expr) = N_String_Literal then @@ -5711,8 +5711,8 @@ package body Sem_Ch4 is if Ada_Version = Ada_83 then Resolve (Expr, Typ); else - Error_Msg_N ("argument of conversion cannot be character literal", - N); + Error_Msg_N + ("argument of conversion cannot be character literal", N); Error_Msg_N ("\use qualified expression instead", N); end if; @@ -5721,7 +5721,8 @@ package body Sem_Ch4 is | Name_Unchecked_Access | Name_Unrestricted_Access then - Error_Msg_N ("argument of conversion cannot be access", N); + Error_Msg_N + ("argument of conversion cannot be access attribute", N); Error_Msg_N ("\use qualified expression instead", N); end if; diff --git a/gcc/ada/sem_ch5.adb b/gcc/ada/sem_ch5.adb index 653e3159902..d344ad16e3e 100644 --- a/gcc/ada/sem_ch5.adb +++ b/gcc/ada/sem_ch5.adb @@ -195,7 +195,8 @@ package body Sem_Ch5 is or else Is_Protected_Component (Ent) then Error_Msg_N - ("protected function cannot modify protected object", N); + ("protected function cannot modify its protected object", + N); return; end if; end; @@ -705,7 +706,8 @@ package body Sem_Ch5 is and then Convention (S) = Convention_Protected then Error_Msg_N - ("protected function cannot modify protected object", + ("protected function cannot modify its protected " & + "object", Lhs); end if; @@ -771,7 +773,7 @@ package body Sem_Ch5 is if Is_Protected_Part_Of_Constituent (Lhs) and then Within_Function then Error_Msg_N - ("protected function cannot modify protected object", Lhs); + ("protected function cannot modify its protected object", Lhs); end if; -- Resolution may have updated the subtype, in case the left-hand side @@ -954,7 +956,7 @@ package body Sem_Ch5 is Apply_Compile_Time_Constraint_Error (N => Rhs, Msg => - "(Ada 2005) null not allowed in null-excluding objects??", + "(Ada 2005) NULL not allowed in null-excluding objects??", Reason => CE_Null_Not_Allowed); -- We still mark this as a possible modification, that's necessary diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index 29c11cd397c..7bab772c0a3 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -1537,12 +1537,12 @@ package body Sem_Ch6 is -- Can it really happen (extended return???) Error_Msg_N - ("aliased only allowed for limited return objects " + ("ALIASED only allowed for limited return objects " & "in Ada 2012??", N); elsif not Is_Limited_View (R_Type) then Error_Msg_N - ("aliased only allowed for limited return objects", N); + ("ALIASED only allowed for limited return objects", N); end if; end if; @@ -9968,7 +9968,7 @@ package body Sem_Ch6 is Error_Msg_Sloc := Text_Ptr'Max (Sloc (Entity (E1)), Sloc (Entity (E2))); Error_Msg_NE - ("Meaning of& differs because of declaration#", E1, E2); + ("meaning of& differs because of declaration#", E1, E2); end if; return Result; diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb index 07484d54299..8ec86fc9b1c 100644 --- a/gcc/ada/sem_ch8.adb +++ b/gcc/ada/sem_ch8.adb @@ -7867,7 +7867,7 @@ package body Sem_Ch8 is elsif Warn_On_Obsolescent_Feature and then False then Error_Msg_N - ("applying 'Class to an untagged incomplete type" + ("applying ''Class to an untagged incomplete type" & " is an obsolescent feature (RM J.11)?r?", N); end if; end if; diff --git a/gcc/ada/sem_ch9.adb b/gcc/ada/sem_ch9.adb index a9d720b18a4..b7b7d7d2115 100644 --- a/gcc/ada/sem_ch9.adb +++ b/gcc/ada/sem_ch9.adb @@ -790,13 +790,13 @@ package body Sem_Ch9 is if Kind /= E_Block and then Kind /= E_Loop and then not Is_Entry (Task_Nam) then - Error_Msg_N ("enclosing body of accept must be a task", N); + Error_Msg_N ("enclosing body of ACCEPT must be a task", N); return; end if; end loop; if Ekind (Etype (Task_Nam)) /= E_Task_Type then - Error_Msg_N ("invalid context for accept statement", N); + Error_Msg_N ("invalid context for ACCEPT statement", N); return; end if; @@ -844,7 +844,7 @@ package body Sem_Ch9 is end loop; if Entry_Nam = Any_Id then - Error_Msg_N ("no entry declaration matches accept statement", N); + Error_Msg_N ("no entry declaration matches ACCEPT statement", N); return; else Set_Entity (Nam, Entry_Nam); @@ -882,7 +882,7 @@ package body Sem_Ch9 is if Entry_Nam = Scope_Stack.Table (J).Entity then Error_Msg_N - ("duplicate accept statement for same entry (RM 9.5.2 (15))", N); + ("duplicate ACCEPT statement for same entry (RM 9.5.2 (15))", N); -- Do not continue analysis of accept statement, to prevent -- cascaded errors. @@ -904,8 +904,8 @@ package body Sem_Ch9 is when N_Asynchronous_Select => Error_Msg_N - ("accept statements are not allowed within an " - & "asynchronous select inner to the enclosing task body", + ("ACCEPT statement not allowed within an " + & "asynchronous SELECT inner to the enclosing task body", N); exit; @@ -2671,7 +2671,7 @@ package body Sem_Ch9 is if Entity (EDN1) = Ent then Error_Msg_Sloc := Sloc (Stm1); Error_Msg_N - ("accept duplicates one on line#??", Stm); + ("ACCEPT duplicates one on line#??", Stm); exit; end if; end if; @@ -2691,16 +2691,16 @@ package body Sem_Ch9 is Check_Potentially_Blocking_Operation (N); if Terminate_Present and Delay_Present then - Error_Msg_N ("at most one of terminate or delay alternative", N); + Error_Msg_N ("at most one of TERMINATE or DELAY alternative", N); elsif not Accept_Present then Error_Msg_N - ("select must contain at least one accept alternative", N); + ("SELECT must contain at least one ACCEPT alternative", N); end if; if Present (Else_Statements (N)) then if Terminate_Present or Delay_Present then - Error_Msg_N ("else part not allowed with other alternatives", N); + Error_Msg_N ("ELSE part not allowed with other alternatives", N); end if; Analyze_Statements (Else_Statements (N)); diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index 1a25f037b2b..3ef5e82c76f 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -466,7 +466,7 @@ package body Sem_Prag is if Nkind (Case_Guard) = N_Others_Choice then if Others_Seen then Error_Msg_N - ("only one others choice allowed in contract cases", + ("only one OTHERS choice allowed in contract cases", Case_Guard); else Others_Seen := True; @@ -474,7 +474,7 @@ package body Sem_Prag is elsif Others_Seen then Error_Msg_N - ("others must be the last choice in contract cases", N); + ("OTHERS must be the last choice in contract cases", N); end if; -- Preanalyze the case guard and consequence @@ -8876,7 +8876,7 @@ package body Sem_Prag is Error_Pragma ("at least one parameter required for pragma%"); elsif Ekind (Formal) /= E_Out_Parameter then - Error_Pragma ("first parameter must have mode out for pragma%"); + Error_Pragma ("first parameter must have mode OUT for pragma%"); else Set_Is_Valued_Procedure (Ent); @@ -11762,7 +11762,7 @@ package body Sem_Prag is if Nkind (Prop) = N_Others_Choice then if Others_Seen then SPARK_Msg_N - ("only one others choice allowed in option External", + ("only one OTHERS choice allowed in option External", Prop); else Others_Seen := True; @@ -11770,7 +11770,7 @@ package body Sem_Prag is elsif Others_Seen then SPARK_Msg_N - ("others must be the last property in option External", + ("OTHERS must be the last property in option External", Prop); -- The only remaining legal options are the four predefined @@ -30543,11 +30543,11 @@ package body Sem_Prag is if From_Aspect_Specification (Prag) then Error_Msg_N - ("aspect % cannot apply to a stand alone expression function", + ("aspect % cannot apply to a standalone expression function", Prag); else Error_Msg_N - ("pragma % cannot apply to a stand alone expression function", + ("pragma % cannot apply to a standalone expression function", Prag); end if; end Expression_Function_Error; diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index 05ebf20ca26..bb4ddab6d85 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -4683,7 +4683,7 @@ package body Sem_Res is elsif Ada_Version >= Ada_2005 then Apply_Compile_Time_Constraint_Error (N => A, - Msg => "(Ada 2005) null not allowed in " + Msg => "(Ada 2005) NULL not allowed in " & "null-excluding formal??", Reason => CE_Null_Not_Allowed); end if; @@ -9824,13 +9824,13 @@ package body Sem_Res is if Nkind (Parent (N)) in N_Subprogram_Call then Error_Msg_N - ("null is not allowed as argument for an access parameter", N); + ("NULL is not allowed as argument for an access parameter", N); -- Standard message for all other cases (are there any?) else Error_Msg_N - ("null cannot be of an anonymous access type", N); + ("NULL cannot be of an anonymous access type", N); end if; end if; @@ -9877,7 +9877,7 @@ package body Sem_Res is else Insert_Action (Compile_Time_Constraint_Error (N, - "(Ada 2005) null not allowed in null-excluding objects??"), + "(Ada 2005) NULL not allowed in null-excluding objects??"), Make_Raise_Constraint_Error (Loc, Reason => CE_Access_Check_Failed)); end if; @@ -10278,7 +10278,7 @@ package body Sem_Res is elsif Typ = Universal_Integer or else Typ = Any_Modular then if Parent_Is_Boolean then Error_Msg_N - ("operand of not must be enclosed in parentheses", + ("operand of NOT must be enclosed in parentheses", Right_Opnd (N)); else Error_Msg_N diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index bb078d28573..b849ef2e109 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -10463,7 +10463,7 @@ package body Sem_Util is then if Cursor /= Any_Type then Error_Msg_N - ("Operation First for iterable type must be unique", Aspect); + ("operation First for iterable type must be unique", Aspect); return Any_Type; else Cursor := Etype (Func); @@ -29703,10 +29703,10 @@ package body Sem_Util is and then Covers (Designated_Type (Expec_Type), Designated_Type (Found_Type)) then - Error_Msg_N -- CODEFIX + Error_Msg_N ("result must be general access type!", Expr); Error_Msg_NE -- CODEFIX - ("add ALL to }!", Expr, Expec_Type); + ("\add ALL to }!", Expr, Expec_Type); -- Another special check, if the expected type is an integer type, -- but the expression is of type System.Address, and the parent is diff --git a/gcc/ada/symbols.adb b/gcc/ada/symbols.adb index d8d4992b9f3..133d8006336 100644 --- a/gcc/ada/symbols.adb +++ b/gcc/ada/symbols.adb @@ -49,7 +49,7 @@ package body Symbols is pragma Unreferenced (Version); begin Put_Line - ("creation of symbol files are not supported on this platform"); + ("creation of symbol files is not supported on this platform"); Success := False; end Initialize; diff --git a/gcc/testsuite/gnat.dg/interface6.adb b/gcc/testsuite/gnat.dg/interface6.adb index 04eb1e17999..556a0b73c92 100644 --- a/gcc/testsuite/gnat.dg/interface6.adb +++ b/gcc/testsuite/gnat.dg/interface6.adb @@ -35,7 +35,7 @@ procedure Interface6 is end Test; procedure Test_Instance1 is new Test (T => Rec_Type); -- { dg-error "actual must implement all interfaces of formal \"T\"" } - procedure Test_Instance1 is new Test (T => Rec_Type1); -- { dg-error "Actual \"Rec_Type1\" must implement interface \"TI2\"" } + procedure Test_Instance1 is new Test (T => Rec_Type1); -- { dg-error "actual \"Rec_Type1\" must implement interface \"TI2\"" } procedure Test_Instance2 is new Test (T => Rec_Type2); procedure Test_Instance12 is new Test (T => Rec_Type12); diff --git a/gcc/testsuite/gnat.dg/not_null.adb b/gcc/testsuite/gnat.dg/not_null.adb index 3cbd86c1633..8f863d87437 100644 --- a/gcc/testsuite/gnat.dg/not_null.adb +++ b/gcc/testsuite/gnat.dg/not_null.adb @@ -10,9 +10,9 @@ procedure not_null is begin declare - pragma Warnings (Off, "*null not allowed in null-excluding objects"); + pragma Warnings (Off, "*""null"" not allowed in null-excluding objects"); package Inst_2 is new GPack (null); - pragma Warnings (On, "*null not allowed in null-excluding objects"); + pragma Warnings (On, "*""null"" not allowed in null-excluding objects"); begin null; end; diff --git a/gcc/testsuite/gnat.dg/protected_func.adb b/gcc/testsuite/gnat.dg/protected_func.adb index f3eead4dc26..055bf5dd12d 100644 --- a/gcc/testsuite/gnat.dg/protected_func.adb +++ b/gcc/testsuite/gnat.dg/protected_func.adb @@ -4,8 +4,8 @@ package body Protected_Func with SPARK_Mode is protected body Prot_Obj is function Prot_Func return Integer is begin - Comp := Comp + 1; -- { dg-error "protected function cannot modify protected object" } - Part_Of_Constit := Part_Of_Constit + 1; -- { dg-error "protected function cannot modify protected object" } + Comp := Comp + 1; -- { dg-error "protected function cannot modify its protected object" } + Part_Of_Constit := Part_Of_Constit + 1; -- { dg-error "protected function cannot modify its protected object" } return Comp + Part_Of_Constit; end Prot_Func;