[Ada] Improve warnings about infinite loops
authorBob Duff <duff@adacore.com>
Wed, 3 Jul 2019 08:15:28 +0000 (08:15 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Wed, 3 Jul 2019 08:15:28 +0000 (08:15 +0000)
commite08a896b96792d73293db82d0dc3541c17e545ad
tree873033257e40845a247e50b2c395a10f182c897b
parent07fb741a3672a677a48a2672345d2dd67f944fad
[Ada] Improve warnings about infinite loops

The compiler now has fewer false alarms when warning about infinite
loops. For example, a loop of the form "for X of A ...", where A is an
array, cannot be infinite.  The compiler no longer warns in this case.

2019-07-03  Bob Duff  <duff@adacore.com>

gcc/ada/

* sem_warn.adb (Check_Infinite_Loop_Warning): Avoid the warning
if an Iterator_Specification is present.

gcc/testsuite/

* gnat.dg/warn20.adb, gnat.dg/warn20_pkg.adb,
gnat.dg/warn20_pkg.ads: New testcase.

From-SVN: r272978
gcc/ada/ChangeLog
gcc/ada/sem_warn.adb
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/warn20.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/warn20_pkg.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/warn20_pkg.ads [new file with mode: 0644]