[Ada] Missing warning for unreferenced formals in expression functions
commit3f89eb7f6dd818224dd0fe0ecb27503fdd0d3283
authorJustin Squirek <squirek@adacore.com>
Tue, 22 May 2018 13:27:14 +0000 (22 13:27 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Tue, 22 May 2018 13:27:14 +0000 (22 13:27 +0000)
tree5c8f65bbe8979fa3f43824dd2b1a7c4386a32d61
parent143a4acd3b7005718e2501f30ecc32018032d854
[Ada] Missing warning for unreferenced formals in expression functions

This patch fixes an issue whereby the compiler failed to properly warn against
unreferenced formal parameters when analyzing expression functions.

2018-05-22  Justin Squirek  <squirek@adacore.com>

gcc/ada/

* sem_ch6.adb (Analyze_Expression_Function): Propagate flags from the
original function spec into the generated function spec due to
expansion of expression functions during analysis.
(Analyze_Subprogram_Body_Helper): Modify check on formal parameter
references from the body to the subprogram spec in the case of
expression functions because of inconsistances related to having a
generated body.
* libgnarl/s-osinte__android.ads: Flag parameters as unused.
* libgnarl/s-osinte__lynxos178e.ads: Likewise.
* libgnarl/s-osinte__qnx.adb: Likewise.
* libgnarl/s-osinte__qnx.ads: Likewise.

gcc/testsuite/

* gnat.dg/warn14.adb: New testcase.

From-SVN: r260535
gcc/ada/ChangeLog
gcc/ada/libgnarl/s-osinte__android.ads
gcc/ada/libgnarl/s-osinte__lynxos178e.ads
gcc/ada/libgnarl/s-osinte__qnx.adb
gcc/ada/libgnarl/s-osinte__qnx.ads
gcc/ada/sem_ch6.adb
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/warn14.adb [new file with mode: 0644]