diff options
author | Piotr Trojanek <trojanek@adacore.com> | 2018-05-25 09:03:54 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> | 2018-05-25 09:03:54 +0000 |
commit | 9da8032d4b0b5ca8cf5397b617cbcef55f735e19 (patch) | |
tree | 240686d89a7e0b0e6e77806b4a13dec91db8f41a | |
parent | 5865218e3bf9b40d90c210446fa06e04265ffda0 (diff) | |
download | gcc-9da8032d4b0b5ca8cf5397b617cbcef55f735e19.zip gcc-9da8032d4b0b5ca8cf5397b617cbcef55f735e19.tar.gz gcc-9da8032d4b0b5ca8cf5397b617cbcef55f735e19.tar.bz2 |
[Ada] Rewrite Iterate_Call_Parameters in more assertive style
The formal and actual parameters in a subprogram call must match each other.
This is now checked with assertion (so that we can detect possible mistakes),
while the production builds have less work to do. Semantics unchanged.
2018-05-25 Piotr Trojanek <trojanek@adacore.com>
gcc/ada/
* sem_util.adb (Iterate_Call_Parameters): Rewrite with extra
assertions; replace function versions of Next_Formal/Next_Actual with
their procedural versions (which are more concise).
From-SVN: r260725
-rw-r--r-- | gcc/ada/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/ada/sem_util.adb | 9 |
2 files changed, 12 insertions, 3 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 6f261db..0095f85 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,9 @@ +2018-05-25 Piotr Trojanek <trojanek@adacore.com> + + * sem_util.adb (Iterate_Call_Parameters): Rewrite with extra + assertions; replace function versions of Next_Formal/Next_Actual with + their procedural versions (which are more concise). + 2018-05-25 Doug Rupp <rupp@adacore.com> * libgnarl/s-osinte__aix.ads, libgnarl/s-osinte__android.ads, diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index d205e58..08ed9bf 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -17882,11 +17882,14 @@ package body Sem_Util is Actual : Node_Id := First_Actual (Call); begin - while Present (Formal) and then Present (Actual) loop + while Present (Formal) loop + pragma Assert (Present (Formal)); Handle_Parameter (Formal, Actual); - Formal := Next_Formal (Formal); - Actual := Next_Actual (Actual); + Next_Formal (Formal); + Next_Actual (Actual); end loop; + + pragma Assert (No (Actual)); end Iterate_Call_Parameters; --------------------------- |