[rtems-central commit] validation: Reliably remove duplicate pre-conds

Sebastian Huber sebh at rtems.org
Wed May 5 11:21:02 UTC 2021


Module:    rtems-central
Branch:    master
Commit:    0ce025e3bae4dc3e7dfaed07f47788229d3649ce
Changeset: http://git.rtems.org/rtems-central/commit/?id=0ce025e3bae4dc3e7dfaed07f47788229d3649ce

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Wed May  5 13:14:15 2021 +0200

validation: Reliably remove duplicate pre-conds

---

 rtemsspec/validation.py | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/rtemsspec/validation.py b/rtemsspec/validation.py
index aa8e385..e618dd5 100644
--- a/rtemsspec/validation.py
+++ b/rtemsspec/validation.py
@@ -632,8 +632,6 @@ def _compact(pre_conds: PreCondsOfPostCond) -> PreCondsOfPostCond:
         combined_pre_conds = [last]
         combined_count = 0
         for row in pre_conds[1:]:
-            if row == last:
-                continue
             diff = [
                 index for index, states in enumerate(last)
                 if states != row[index]
@@ -663,10 +661,11 @@ def _compact_more(pre_conds: PreCondsOfPostCond) -> PreCondsOfPostCond:
                     index for index, states in enumerate(first)
                     if states != row[index]
                 ]
-                if len(diff) == 1:
-                    index = diff[0]
-                    combined_count += 1
-                    first[index].extend(row[index])
+                if len(diff) <= 1:
+                    if diff:
+                        index = diff[0]
+                        combined_count += 1
+                        first[index].extend(row[index])
                     pre_conds.remove(row)
         pre_conds = next_pre_conds
         if combined_count == 0:



More information about the vc mailing list