]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] Remove redundant guards in detection of unreachable code
authorPiotr Trojanek <trojanek@adacore.com>
Mon, 30 May 2022 22:29:28 +0000 (00:29 +0200)
committerPierre-Marie de Rodat <derodat@adacore.com>
Tue, 5 Jul 2022 08:28:17 +0000 (08:28 +0000)
Routine Check_Unreachable_Code is only called on nodes belonging to a
list of statements (and it wouldn't make sense to call it on anything
else).

gcc/ada/

* sem_ch5.adb (Check_Unreachable_Code): Remove redundant guard;
the call to Present wasn't needed either.

gcc/ada/sem_ch5.adb

index 1f3ea5562355f79b6a2c5ed6c14be156322ae7d6..bb1e7b9cede2bed094975e687cc42237e9cb324d 100644 (file)
@@ -4398,7 +4398,7 @@ package body Sem_Ch5 is
       P          : Node_Id;
 
    begin
-      if Is_List_Member (N) and then Comes_From_Source (N) then
+      if Comes_From_Source (N) then
          Nxt := Original_Node (Next (N));
 
          --  Skip past pragmas
@@ -4415,8 +4415,7 @@ package body Sem_Ch5 is
 
          --  Otherwise see if we have a real statement following us
 
-         elsif Present (Nxt)
-           and then Comes_From_Source (Nxt)
+         elsif Comes_From_Source (Nxt)
            and then Is_Statement (Nxt)
          then
             --  Special very annoying exception. If we have a return that