[rtems-central commit] specview.py: Improve item validation

Sebastian Huber sebh at rtems.org
Tue Sep 28 09:14:44 UTC 2021


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Tue Sep 28 10:08:46 2021 +0200

specview.py: Improve item validation

---

 specview.py | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/specview.py b/specview.py
index 21cf100..f8d4b3c 100755
--- a/specview.py
+++ b/specview.py
@@ -177,6 +177,17 @@ _VALIDATION_LEAF = [
     "interface/enum", "interface/enumerator"
 ]
 
+_NOT_PRE_QUALIFIED = set([
+    "/acfg/constraint/option-not-pre-qualified",
+    "/constraint/directive-not-pre-qualified",
+])
+
+
+def _is_pre_qualified(item: Item) -> bool:
+    return not bool(
+        set(parent.uid for parent in item.parents("constraint")).intersection(
+            _NOT_PRE_QUALIFIED))
+
 
 def _no_validation(item: Item, path: List[str]) -> List[str]:
     path_2 = path + [item.uid]
@@ -189,7 +200,7 @@ def _no_validation(item: Item, path: List[str]) -> List[str]:
     for parent in item.parents(_PARENT_ROLES):
         path_2 = _no_validation(parent, path_2)
         leaf = False
-    if leaf and item.type not in _VALIDATION_LEAF:
+    if leaf and item.type not in _VALIDATION_LEAF and _is_pre_qualified(item):
         for index, component in enumerate(path_2):
             if component:
                 print(f"{'  ' * index}{component}")



More information about the vc mailing list