[Ada] Improve placement of warning on formals of generic subprograms
This patch modifies the handling of warnings on unused formal parameters
of generic subprograms. Previously such warnings were placed on the
formal appearing in the subprogram declaration, in contrast with
warnings on non-generic subprograms, where the warning is placed on the
corresponding entity in the body of the subprogram. This patch makes the
handling of both cases uniform. It is preferable to place the warning in
the body because this also provides a better suggestion for the
placement of an Unreferenced pragma to suppress the warning when desired.
2019-08-19 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* sem_warn.adb (Check_References, Generic_Body_Formal): When a
formal parameter of a generic subprogram is not referenced in
the body, place the corresponding warning on the corresponding
entity in the specification of the generic body, as is done for
non-generic subprograms.
gcc/testsuite/
* gnat.dg/warn28.adb, gnat.dg/warn28.ads: New testcase.
From-SVN: r274649