diff options
author | Frank Kühndel <frank.kuehndel@embedded-brains.de> | 2021-09-16 18:55:57 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-09-24 13:18:26 +0200 |
commit | f256d34e8fe56e711d0efde14b22f926b8a05086 (patch) | |
tree | 2361431317709811030236aaef30caf483c6df1a | |
parent | spec: Specify <sys/lock.h> mutexes (diff) | |
download | rtems-central-f256d34e8fe56e711d0efde14b22f926b8a05086.tar.bz2 |
spec: Add STATIC_ANALYSIS and NOINIT specs
This specification is up to date for
./cpukit/include/rtems/score/basedefs.h with
commit 9e13cbe8721e725c67d2d8bd16df66265c39a75b
-rw-r--r-- | spec/rtems/basedefs/req/noinit-0.yml | 20 | ||||
-rw-r--r-- | spec/rtems/basedefs/req/section-0.yml | 2 | ||||
-rw-r--r-- | spec/rtems/basedefs/req/static-analysis-0.yml | 15 | ||||
-rw-r--r-- | spec/rtems/basedefs/req/static-analysis-1.yml | 15 | ||||
-rw-r--r-- | spec/rtems/basedefs/val/basedefs.yml | 60 |
5 files changed, 110 insertions, 2 deletions
diff --git a/spec/rtems/basedefs/req/noinit-0.yml b/spec/rtems/basedefs/req/noinit-0.yml new file mode 100644 index 00000000..b60d0c3a --- /dev/null +++ b/spec/rtems/basedefs/req/noinit-0.yml @@ -0,0 +1,20 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 +copyrights: +- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de) +enabled-by: true +links: +- role: interface-function + uid: ../if/noinit +non-functional-type: interface +rationale: null +references: [] +requirement-type: non-functional +text: | + When the code is compiled with the GNU C compiler, + and the ${../if/section:/name} macro is attached to a + global variable definition, + and the file format used supports arbitrary sections, + the macro shall cause the compiler to store the + variable in a section where its value is not initialized + during initial start up. +type: requirement diff --git a/spec/rtems/basedefs/req/section-0.yml b/spec/rtems/basedefs/req/section-0.yml index 7aa5daee..133069b7 100644 --- a/spec/rtems/basedefs/req/section-0.yml +++ b/spec/rtems/basedefs/req/section-0.yml @@ -18,6 +18,6 @@ text: | C sting containing valid linker section name, and the file format used supports arbitary sections, the macro shall cause the compiler to store the function or - variable is a section named like the result of the pre-processor + variable in a section named like the result of the pre-processor substitutions on its argument ${../if/section:/params[0]/name}. type: requirement diff --git a/spec/rtems/basedefs/req/static-analysis-0.yml b/spec/rtems/basedefs/req/static-analysis-0.yml new file mode 100644 index 00000000..346cf33e --- /dev/null +++ b/spec/rtems/basedefs/req/static-analysis-0.yml @@ -0,0 +1,15 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 +copyrights: +- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de) +enabled-by: true +links: +- role: interface-function + uid: ../if/static-analysis +non-functional-type: interface +rationale: null +references: [] +requirement-type: non-functional +text: | + When the macro ``__COVERITY__`` is defined, + the macro ${../if/static-analysis:/name} shall be defined. +type: requirement diff --git a/spec/rtems/basedefs/req/static-analysis-1.yml b/spec/rtems/basedefs/req/static-analysis-1.yml new file mode 100644 index 00000000..ee33b872 --- /dev/null +++ b/spec/rtems/basedefs/req/static-analysis-1.yml @@ -0,0 +1,15 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 +copyrights: +- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de) +enabled-by: true +links: +- role: interface-function + uid: ../if/static-analysis +non-functional-type: interface +rationale: null +references: [] +requirement-type: non-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 d3570814..617920ea 100644 --- a/spec/rtems/basedefs/val/basedefs.yml +++ b/spec/rtems/basedefs/val/basedefs.yml @@ -1,6 +1,6 @@ SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause copyrights: -- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de) +- Copyright (C) 2020, 2021 embedded brains GmbH (http://www.embedded-brains.de) enabled-by: true links: [] test-actions: @@ -755,6 +755,22 @@ test-actions: uid: ../req/no-return-0 links: [] - action-brief: | + Use the ${../if/noinit:/name} macro on ``noinit_variable`` at the + beginning of this file. + action-code: | + /* No action */ + checks: + - brief: | + It cannot be checked that the ${../if/noinit:/name} + macro has the desired effect. Yet, the check confirms that such a + macro exists and can be used. + code: | + T_step_not_null( ${step}, &noinit_variable ); + links: + - role: validation + uid: ../req/noinit-0 + links: [] +- action-brief: | Use the ${../if/obfuscate-variable:/name} macro. action-code: | short obfuscate_variable = 66; @@ -935,6 +951,46 @@ test-actions: uid: ../req/section-0 links: [] - action-brief: | + Use the ${../if/static-analysis:/name} macro. + 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 */ + 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 defined" ); + # endif + #endif + links: + - role: validation + uid: ../req/static-analysis-1 + links: [] +- action-brief: | Use the ${../if/static-assert:/name} macro. action-code: | RTEMS_STATIC_ASSERT( STATIC_ASSERT_COND 1, RTEMS_STATIC_ASSERT_test ); @@ -1509,6 +1565,8 @@ test-support: | } } + RTEMS_NOINIT static uint32_t noinit_variable; + static int ori_func( int x ) { return 2 * x; |