[Ada] Improve placement of warning on formals of generic subprograms

Pierre-Marie de Rodat derodat@adacore.com
Mon Aug 19 08:39:00 GMT 2019


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.

Tested on x86_64-pc-linux-gnu, committed on trunk

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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: text/x-diff
Size: 3917 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20190819/f012b1a3/attachment.bin>


More information about the Gcc-patches mailing list