[rtems-central commit] spec: Add functional type for undefined defines

Sebastian Huber sebh at rtems.org
Tue May 9 13:45:27 UTC 2023


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri May  5 14:41:20 2023 +0200

spec: Add functional type for undefined defines

---

 ...tatic-analysis-0.yml => no-static-analysis.yml} |  8 ++---
 spec/rtems/basedefs/req/static-analysis-1.yml      | 15 --------
 spec/rtems/basedefs/val/basedefs.yml               | 41 +++++-----------------
 spec/spec/requirement-functional-generic.yml       |  4 +++
 4 files changed, 17 insertions(+), 51 deletions(-)

diff --git a/spec/rtems/basedefs/req/static-analysis-0.yml b/spec/rtems/basedefs/req/no-static-analysis.yml
similarity index 64%
rename from spec/rtems/basedefs/req/static-analysis-0.yml
rename to spec/rtems/basedefs/req/no-static-analysis.yml
index d87021b8..7ec9ea27 100644
--- a/spec/rtems/basedefs/req/static-analysis-0.yml
+++ b/spec/rtems/basedefs/req/no-static-analysis.yml
@@ -1,8 +1,9 @@
 SPDX-License-Identifier: CC-BY-SA-4.0
 copyrights:
 - Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
-enabled-by: true
-functional-type: function
+enabled-by:
+  not: __COVERITY__
+functional-type: interface-define-not-defined
 links:
 - role: interface-function
   uid: ../if/static-analysis
@@ -10,6 +11,5 @@ rationale: null
 references: []
 requirement-type: functional
 text: |
-  When the macro ``__COVERITY__`` is defined,
-  the macro ${../if/static-analysis:/name} shall be defined.
+  The define ${../if/static-analysis:/name} shall not be defined.
 type: requirement
diff --git a/spec/rtems/basedefs/req/static-analysis-1.yml b/spec/rtems/basedefs/req/static-analysis-1.yml
deleted file mode 100644
index bd7cec3d..00000000
--- a/spec/rtems/basedefs/req/static-analysis-1.yml
+++ /dev/null
@@ -1,15 +0,0 @@
-SPDX-License-Identifier: CC-BY-SA-4.0
-copyrights:
-- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
-enabled-by: true
-functional-type: function
-links:
-- role: interface-function
-  uid: ../if/static-analysis
-rationale: null
-references: []
-requirement-type: functional
-text: |
-  When the macro ``__COVERITY__`` is not defined,
-  the macro ${../if/static-analysis:/name} shall be not defined.
-type: requirement
diff --git a/spec/rtems/basedefs/val/basedefs.yml b/spec/rtems/basedefs/val/basedefs.yml
index 1005faee..740b1412 100644
--- a/spec/rtems/basedefs/val/basedefs.yml
+++ b/spec/rtems/basedefs/val/basedefs.yml
@@ -951,44 +951,21 @@ test-actions:
       uid: ../req/section-0
   links: []
 - action-brief: |
-    Use the ${../if/static-analysis:/name} macro.
+    Evaluate if ${../if/static-analysis:/name} is defined.
   action-code: |
-    /* No action */
-  checks:
-  - brief: |
-      It cannot be automatically check that
-      the ${../if/static-analysis:/name} macro has the desired effect.
-    code: |
-      #if defined(__COVERITY__)
-      #  if defined(RTEMS_STATIC_ANALYSIS)
-        T_quiet_true( true, "test passes, no output" );
-      #  else
-        T_quiet_true( false, "RTEMS_STATIC_ANALYSIS not defined" );
-      #  endif
-      #endif
-    links:
-    - role: validation
-      uid: ../req/static-analysis-0
-  links: []
-- action-brief: |
-    Use the ${../if/static-analysis:/name} macro.
-  action-code: |
-    /* No action */
+    #if defined(RTEMS_STATIC_ANALYSIS)
+    bool defined = true;
+    #else
+    bool defined = false;
+    #endif
   checks:
   - brief: |
-      It cannot be automatically check that
-      the ${../if/static-analysis:/name} macro has the desired effect.
+      Check that ${../if/static-analysis:/name} was not defined.
     code: |
-      #if !defined(__COVERITY__)
-      #  if !defined(RTEMS_STATIC_ANALYSIS)
-        T_quiet_true( true, "test passes, no output" );
-      #  else
-        T_quiet_true( false, "RTEMS_STATIC_ANALYSIS defined" );
-      #  endif
-      #endif
+      T_step_false( ${.:/step}, defined );
     links:
     - role: validation
-      uid: ../req/static-analysis-1
+      uid: ../req/no-static-analysis
   links: []
 - action-brief: |
     Use the ${../if/static-assert:/name} macro.
diff --git a/spec/spec/requirement-functional-generic.yml b/spec/spec/requirement-functional-generic.yml
index 99717bf4..e2fe53cb 100644
--- a/spec/spec/requirement-functional-generic.yml
+++ b/spec/spec/requirement-functional-generic.yml
@@ -17,6 +17,10 @@ links:
   spec-key: functional-type
   spec-value: function
   uid: requirement-functional
+- role: spec-refinement
+  spec-key: functional-type
+  spec-value: interface-define-not-defined
+  uid: requirement-functional
 - role: spec-refinement
   spec-key: functional-type
   spec-value: operational



More information about the vc mailing list