[COMMITTED] ada: Remove redundant guards from handling of record components

Message ID 20230526073604.2068445-1-poulhies@adacore.com
State Accepted
Headers
Series [COMMITTED] ada: Remove redundant guards from handling of record components |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Marc Poulhiès May 26, 2023, 7:36 a.m. UTC
  From: Piotr Trojanek <trojanek@adacore.com>

Call to First on empty list is intentionally returning Empty.

gcc/ada/

	* sem_util.adb (Gather_Components): Remove guard for empty list of
	components.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/sem_util.adb | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
  

Patch

diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index ea5be2ff4b5..d0e0fcd3da1 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -9748,14 +9748,9 @@  package body Sem_Util is
 
       if No (Comp_List) or else Null_Present (Comp_List) then
          return;
-
-      elsif Present (Component_Items (Comp_List)) then
-         Comp_Item := First (Component_Items (Comp_List));
-
-      else
-         Comp_Item := Empty;
       end if;
 
+      Comp_Item := First (Component_Items (Comp_List));
       while Present (Comp_Item) loop
 
          --  Skip the tag of a tagged record, as well as all items that are not