[Ada] Warning on use of predefined operations on an actual fixed-point type
authorEd Schonberg <schonberg@adacore.com>
Thu, 11 Jan 2018 08:52:51 +0000 (08:52 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Thu, 11 Jan 2018 08:52:51 +0000 (08:52 +0000)
commit07733aa11e136aa6e1fa24e12e662489a9225bf2
treebef2bd4163e1a57b20b9fa51114a96eb89d0ac2a
parent78cac7386e2dc48ec5adb4ff0c9a94eed958c9fc
[Ada] Warning on use of predefined operations on an actual fixed-point type

The compiler warns when a generic actual is a fixed-point type, because
arithmetic operations in the instance will use the predefined operations on
it, even if the type has user-defined primitive operations (unless formsl
surprograms for these operations appear in the generic). This patch refines
this warning to exclude the case where the formsal type is private, because
in this case there can be no suspicious arithmetic operastions in the generic
unit.

2018-01-11  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

* sem_ch12.adb (Check_Fixed_Point_Type): Do not apply check if the
formsl type corresponding to the actual fixed point type is private,
because in this case there can be no suspicious arithmetic operations
in the generic unless they reference a formal subprogram.  Clarify
warning.

gcc/testsuite/

* gnat.dg/fixedpnt2.adb, gnat.dg/fixedpnt2.ads: New testcase.

From-SVN: r256504
gcc/ada/ChangeLog
gcc/ada/sem_ch12.adb
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/fixedpnt2.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/fixedpnt2.ads [new file with mode: 0644]