diff options
Diffstat (limited to 'gcc/ada/sem_warn.adb')
-rw-r--r-- | gcc/ada/sem_warn.adb | 42 |
1 files changed, 28 insertions, 14 deletions
diff --git a/gcc/ada/sem_warn.adb b/gcc/ada/sem_warn.adb index 35ef616..156afc9 100644 --- a/gcc/ada/sem_warn.adb +++ b/gcc/ada/sem_warn.adb @@ -1712,17 +1712,11 @@ package body Sem_Warn is and then Ekind (E1) /= E_Class_Wide_Type - -- Objects other than parameters of task types are allowed to - -- be non-referenced, since they start up tasks. + -- Objects that are not parameters and whose types have tasks + -- are allowed to be non-referenced since they start up tasks. - and then ((Ekind (E1) /= E_Variable - and then Ekind (E1) /= E_Constant - and then Ekind (E1) /= E_Component) - - -- Check that E1T is not a task or a composite type - -- with a task component. - - or else not Has_Task (E1T)) + and then not (Ekind (E1) in E_Variable | E_Constant | E_Component + and then Has_Task (E1T)) -- For subunits, only place warnings on the main unit itself, -- since parent units are not completely compiled. @@ -3470,6 +3464,24 @@ package body Sem_Warn is end if; end Warn_On_Constant_Valid_Condition; + --------------------------------------- + -- Warn_On_Ignored_Equality_Operator -- + --------------------------------------- + + procedure Warn_On_Ignored_Equality_Operator + (Typ : Entity_Id; + Comp_Typ : Entity_Id; + Loc : Source_Ptr) is + begin + if Warn_On_Ignored_Equality then + Error_Msg_Node_2 := Comp_Typ; + Error_Msg_N ("?_q?""="" for type & uses predefined ""="" for }", Typ); + + Error_Msg_Sloc := Loc; + Error_Msg_N ("\?_q?""="" # is ignored here", Typ); + end if; + end Warn_On_Ignored_Equality_Operator; + ----------------------------- -- Warn_On_Known_Condition -- ----------------------------- @@ -4670,9 +4682,11 @@ package body Sem_Warn is if Nkind (Parent (LA)) in N_Procedure_Call_Statement | N_Parameter_Association then - Error_Msg_NE - ("?m?& modified by call, but value overwritten #!", - LA, Ent); + if Warn_On_All_Unread_Out_Parameters then + Error_Msg_NE + ("?m?& modified by call, but value overwritten #!", + LA, Ent); + end if; else Error_Msg_NE -- CODEFIX ("?m?useless assignment to&, value overwritten #!", @@ -4747,7 +4761,7 @@ package body Sem_Warn is Ent : Entity_Id; begin - if Warn_On_Modified_Unread + if (Warn_On_Modified_Unread or Warn_On_All_Unread_Out_Parameters) and then In_Extended_Main_Source_Unit (E) then Ent := First_Entity (E); |