Skip to content
Snippets Groups Projects
Commit f51b8e5b authored by Sheri Bernstein's avatar Sheri Bernstein Committed by Marc Poulhiès
Browse files

ada: Refactor multiple returns

Replace multiple returns 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-parame__qnx.adb: Refactor multiple returns.
parent 41d7d32c
No related branches found
No related tags found
No related merge requests found
......@@ -39,13 +39,11 @@ package body System.Parameters is
function Adjust_Storage_Size (Size : Size_Type) return Size_Type is
begin
if Size = Unspecified_Size then
return Default_Stack_Size;
elsif Size < Minimum_Stack_Size then
return Minimum_Stack_Size;
else
return Size;
end if;
return
(if Size = Unspecified_Size then Default_Stack_Size
elsif Size < Minimum_Stack_Size then Minimum_Stack_Size
else Size
);
end Adjust_Storage_Size;
------------------------
......@@ -56,14 +54,16 @@ package body System.Parameters is
Default_Stack_Size : constant Integer;
pragma Import (C, Default_Stack_Size, "__gl_default_stack_size");
begin
if Default_Stack_Size = -1 then
-- 256K is the default stack size on aarch64 QNX
return 256 * 1024;
elsif Size_Type (Default_Stack_Size) < Minimum_Stack_Size then
return Minimum_Stack_Size;
else
return Size_Type (Default_Stack_Size);
end if;
return
(if Default_Stack_Size = -1
then
(256 * 1024) -- 256K is the default stack size on aarch64 QNX
elsif Size_Type (Default_Stack_Size) < Minimum_Stack_Size
then
Minimum_Stack_Size
else
Size_Type (Default_Stack_Size)
);
end Default_Stack_Size;
------------------------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment