aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2021-12-08 16:00:05 +0100
committerPierre-Marie de Rodat <derodat@adacore.com>2022-01-06 17:11:41 +0000
commitd2bc32602c58f14cddc8634fe36141137e2861d1 (patch)
tree4fe45ba18c1680782aa29759a554b662b2daeac9 /gcc
parent362c58c423daaea092194fda6f4905bd3af23c1c (diff)
downloadgcc-d2bc32602c58f14cddc8634fe36141137e2861d1.zip
gcc-d2bc32602c58f14cddc8634fe36141137e2861d1.tar.gz
gcc-d2bc32602c58f14cddc8634fe36141137e2861d1.tar.bz2
[Ada] Simplify traversal for removing warnings from dead code
gcc/ada/ * errout.adb (Remove_Warning_Messages): Use traversal procedure instead of traversal function, since we discard status of each step anyway.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/errout.adb36
1 files changed, 11 insertions, 25 deletions
diff --git a/gcc/ada/errout.adb b/gcc/ada/errout.adb
index 8bfbe46..b40a8bb 100644
--- a/gcc/ada/errout.adb
+++ b/gcc/ada/errout.adb
@@ -3254,7 +3254,7 @@ package body Errout is
function Check_For_Warning (N : Node_Id) return Traverse_Result;
-- This function checks one node for a possible warning message
- function Check_All_Warnings is new Traverse_Func (Check_For_Warning);
+ procedure Check_All_Warnings is new Traverse_Proc (Check_For_Warning);
-- This defines the traversal operation
-----------------------
@@ -3341,37 +3341,23 @@ package body Errout is
-- the current tree. Given that we are in unreachable code, this
-- modification to the tree is harmless.
- declare
- Status : Traverse_Final_Result;
-
- begin
- if Is_List_Member (N) then
- Set_Condition (N, Original_Node (N));
- Status := Check_All_Warnings (Condition (N));
- else
- Rewrite (N, Original_Node (N));
- Status := Check_All_Warnings (N);
- end if;
-
- return Status;
- end;
-
- else
- return OK;
+ if Is_List_Member (N) then
+ Set_Condition (N, Original_Node (N));
+ Check_All_Warnings (Condition (N));
+ else
+ Rewrite (N, Original_Node (N));
+ Check_All_Warnings (N);
+ end if;
end if;
+
+ return OK;
end Check_For_Warning;
-- Start of processing for Remove_Warning_Messages
begin
if Warnings_Detected /= 0 then
- declare
- Discard : Traverse_Final_Result;
- pragma Warnings (Off, Discard);
-
- begin
- Discard := Check_All_Warnings (N);
- end;
+ Check_All_Warnings (N);
end if;
end Remove_Warning_Messages;