The patch fixes an issue in the compiler whereby not referencing a local
variable used in multiple procedure calls as an "out" actual in between
calls would lead to a warning despite "-gnatw.o" not being present.
Additionally, this meant that using pragma Unreferenced on such variables
would not be able to silence such warnings.
gcc/ada/ChangeLog:
* sem_warn.adb
(Warn_On_Useless_Assignment): Disable out value "overwritten" warning
when we are not warning on unread out parameters (e.g. "-gnatw.o").
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 #!",