aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/libgnat/s-pack77.adb
diff options
context:
space:
mode:
authorVasiliy Fofanov <fofanov@adacore.com>2023-06-30 12:22:47 +0000
committerMarc Poulhiès <poulhies@adacore.com>2023-07-18 15:11:46 +0200
commit22b13ca246cbef5c7ad5b9cd5eef5cb238494c5a (patch)
tree4d7be7dac72e22694863f9db116a7e117f3d2e1d /gcc/ada/libgnat/s-pack77.adb
parent7e7c40617a6f210b5a4c7cf63970a92bd0b9ec6a (diff)
downloadgcc-22b13ca246cbef5c7ad5b9cd5eef5cb238494c5a.zip
gcc-22b13ca246cbef5c7ad5b9cd5eef5cb238494c5a.tar.gz
gcc-22b13ca246cbef5c7ad5b9cd5eef5cb238494c5a.tar.bz2
ada: Refactor s-pack* units to remove multiple returns
The aim of this refactoring is to replace multiple returns from branches of case and if statements by a single return statement with a conditional expression. This is more readable and maintainable, and also conformant with a Highly Recommended design principle of ISO 26262-6. gcc/ada/ * libgnat/s-pack03.adb: Update copyright year; refactor return statements. * libgnat/s-pack05.adb: Likewise. * libgnat/s-pack06.adb: Likewise. * libgnat/s-pack07.adb: Likewise. * libgnat/s-pack09.adb: Likewise. * libgnat/s-pack10.adb: Likewise. * libgnat/s-pack100.adb: Likewise. * libgnat/s-pack101.adb: Likewise. * libgnat/s-pack102.adb: Likewise. * libgnat/s-pack103.adb: Likewise. * libgnat/s-pack104.adb: Likewise. * libgnat/s-pack105.adb: Likewise. * libgnat/s-pack106.adb: Likewise. * libgnat/s-pack107.adb: Likewise. * libgnat/s-pack108.adb: Likewise. * libgnat/s-pack109.adb: Likewise. * libgnat/s-pack11.adb: Likewise. * libgnat/s-pack110.adb: Likewise. * libgnat/s-pack111.adb: Likewise. * libgnat/s-pack112.adb: Likewise. * libgnat/s-pack113.adb: Likewise. * libgnat/s-pack114.adb: Likewise. * libgnat/s-pack115.adb: Likewise. * libgnat/s-pack116.adb: Likewise. * libgnat/s-pack117.adb: Likewise. * libgnat/s-pack118.adb: Likewise. * libgnat/s-pack119.adb: Likewise. * libgnat/s-pack12.adb: Likewise. * libgnat/s-pack120.adb: Likewise. * libgnat/s-pack121.adb: Likewise. * libgnat/s-pack122.adb: Likewise. * libgnat/s-pack123.adb: Likewise. * libgnat/s-pack124.adb: Likewise. * libgnat/s-pack125.adb: Likewise. * libgnat/s-pack126.adb: Likewise. * libgnat/s-pack127.adb: Likewise. * libgnat/s-pack13.adb: Likewise. * libgnat/s-pack14.adb: Likewise. * libgnat/s-pack15.adb: Likewise. * libgnat/s-pack17.adb: Likewise. * libgnat/s-pack18.adb: Likewise. * libgnat/s-pack19.adb: Likewise. * libgnat/s-pack20.adb: Likewise. * libgnat/s-pack21.adb: Likewise. * libgnat/s-pack22.adb: Likewise. * libgnat/s-pack23.adb: Likewise. * libgnat/s-pack24.adb: Likewise. * libgnat/s-pack25.adb: Likewise. * libgnat/s-pack26.adb: Likewise. * libgnat/s-pack27.adb: Likewise. * libgnat/s-pack28.adb: Likewise. * libgnat/s-pack29.adb: Likewise. * libgnat/s-pack30.adb: Likewise. * libgnat/s-pack31.adb: Likewise. * libgnat/s-pack33.adb: Likewise. * libgnat/s-pack34.adb: Likewise. * libgnat/s-pack35.adb: Likewise. * libgnat/s-pack36.adb: Likewise. * libgnat/s-pack37.adb: Likewise. * libgnat/s-pack38.adb: Likewise. * libgnat/s-pack39.adb: Likewise. * libgnat/s-pack40.adb: Likewise. * libgnat/s-pack41.adb: Likewise. * libgnat/s-pack42.adb: Likewise. * libgnat/s-pack43.adb: Likewise. * libgnat/s-pack44.adb: Likewise. * libgnat/s-pack45.adb: Likewise. * libgnat/s-pack46.adb: Likewise. * libgnat/s-pack47.adb: Likewise. * libgnat/s-pack48.adb: Likewise. * libgnat/s-pack49.adb: Likewise. * libgnat/s-pack50.adb: Likewise. * libgnat/s-pack51.adb: Likewise. * libgnat/s-pack52.adb: Likewise. * libgnat/s-pack53.adb: Likewise. * libgnat/s-pack54.adb: Likewise. * libgnat/s-pack55.adb: Likewise. * libgnat/s-pack56.adb: Likewise. * libgnat/s-pack57.adb: Likewise. * libgnat/s-pack58.adb: Likewise. * libgnat/s-pack59.adb: Likewise. * libgnat/s-pack60.adb: Likewise. * libgnat/s-pack61.adb: Likewise. * libgnat/s-pack62.adb: Likewise. * libgnat/s-pack63.adb: Likewise. * libgnat/s-pack65.adb: Likewise. * libgnat/s-pack66.adb: Likewise. * libgnat/s-pack67.adb: Likewise. * libgnat/s-pack68.adb: Likewise. * libgnat/s-pack69.adb: Likewise. * libgnat/s-pack70.adb: Likewise. * libgnat/s-pack71.adb: Likewise. * libgnat/s-pack72.adb: Likewise. * libgnat/s-pack73.adb: Likewise. * libgnat/s-pack74.adb: Likewise. * libgnat/s-pack75.adb: Likewise. * libgnat/s-pack76.adb: Likewise. * libgnat/s-pack77.adb: Likewise. * libgnat/s-pack78.adb: Likewise. * libgnat/s-pack79.adb: Likewise. * libgnat/s-pack80.adb: Likewise. * libgnat/s-pack81.adb: Likewise. * libgnat/s-pack82.adb: Likewise. * libgnat/s-pack83.adb: Likewise. * libgnat/s-pack84.adb: Likewise. * libgnat/s-pack85.adb: Likewise. * libgnat/s-pack86.adb: Likewise. * libgnat/s-pack87.adb: Likewise. * libgnat/s-pack88.adb: Likewise. * libgnat/s-pack89.adb: Likewise. * libgnat/s-pack90.adb: Likewise. * libgnat/s-pack91.adb: Likewise. * libgnat/s-pack92.adb: Likewise. * libgnat/s-pack93.adb: Likewise. * libgnat/s-pack94.adb: Likewise. * libgnat/s-pack95.adb: Likewise. * libgnat/s-pack96.adb: Likewise. * libgnat/s-pack97.adb: Likewise. * libgnat/s-pack98.adb: Likewise. * libgnat/s-pack99.adb: Likewise.
Diffstat (limited to 'gcc/ada/libgnat/s-pack77.adb')
-rw-r--r--gcc/ada/libgnat/s-pack77.adb47
1 files changed, 23 insertions, 24 deletions
diff --git a/gcc/ada/libgnat/s-pack77.adb b/gcc/ada/libgnat/s-pack77.adb
index ca51862..1b0971a 100644
--- a/gcc/ada/libgnat/s-pack77.adb
+++ b/gcc/ada/libgnat/s-pack77.adb
@@ -89,30 +89,29 @@ package body System.Pack_77 is
C : Cluster_Ref with Address => A'Address, Import;
RC : Rev_Cluster_Ref with Address => A'Address, Import;
begin
- if Rev_SSO then
- case N07 (Uns (N) mod 8) is
- when 0 => return RC.E0;
- when 1 => return RC.E1;
- when 2 => return RC.E2;
- when 3 => return RC.E3;
- when 4 => return RC.E4;
- when 5 => return RC.E5;
- when 6 => return RC.E6;
- when 7 => return RC.E7;
- end case;
-
- else
- case N07 (Uns (N) mod 8) is
- when 0 => return C.E0;
- when 1 => return C.E1;
- when 2 => return C.E2;
- when 3 => return C.E3;
- when 4 => return C.E4;
- when 5 => return C.E5;
- when 6 => return C.E6;
- when 7 => return C.E7;
- end case;
- end if;
+ return
+ (if Rev_SSO then
+ (case N07 (Uns (N) mod 8) is
+ when 0 => RC.E0,
+ when 1 => RC.E1,
+ when 2 => RC.E2,
+ when 3 => RC.E3,
+ when 4 => RC.E4,
+ when 5 => RC.E5,
+ when 6 => RC.E6,
+ when 7 => RC.E7)
+
+ else
+ (case N07 (Uns (N) mod 8) is
+ when 0 => C.E0,
+ when 1 => C.E1,
+ when 2 => C.E2,
+ when 3 => C.E3,
+ when 4 => C.E4,
+ when 5 => C.E5,
+ when 6 => C.E6,
+ when 7 => C.E7)
+ );
end Get_77;
------------