summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank Kühndel <frank.kuehndel@embedded-brains.de>2020-12-02 11:17:34 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2020-12-09 08:13:51 +0100
commit6856765a1d447ef914887a8279b3e12ac8775dee (patch)
tree703b5fc092314eeed7fd4f262c2b7e7cccff95cb
parentconfig.yml: Add extra file (diff)
downloadrtems-central-6856765a1d447ef914887a8279b3e12ac8775dee.tar.bz2
spec: Requirements and validation for basedefs.h
-rw-r--r--config.yml1
-rw-r--r--spec/rtems/basedefs/req/alias-0.yml25
-rw-r--r--spec/rtems/basedefs/req/align-down-0.yml21
-rw-r--r--spec/rtems/basedefs/req/align-up-0.yml21
-rw-r--r--spec/rtems/basedefs/req/aligned-0.yml24
-rw-r--r--spec/rtems/basedefs/req/alloc-align-0.yml26
-rw-r--r--spec/rtems/basedefs/req/alloc-size-0.yml23
-rw-r--r--spec/rtems/basedefs/req/alloc-size-2-0.yml26
-rw-r--r--spec/rtems/basedefs/req/array-size-0.yml18
-rw-r--r--spec/rtems/basedefs/req/compiler-deprecated-attribute-0.yml15
-rw-r--r--spec/rtems/basedefs/req/compiler-memory-barrier-0.yml22
-rw-r--r--spec/rtems/basedefs/req/compiler-no-return-attribute-0.yml15
-rw-r--r--spec/rtems/basedefs/req/compiler-packed-attribute-0.yml15
-rw-r--r--spec/rtems/basedefs/req/compiler-pure-attribute-0.yml15
-rw-r--r--spec/rtems/basedefs/req/compiler-unused-attribute-0.yml15
-rw-r--r--spec/rtems/basedefs/req/concat-0.yml18
-rw-r--r--spec/rtems/basedefs/req/concat-1.yml17
-rw-r--r--spec/rtems/basedefs/req/concat-2.yml15
-rw-r--r--spec/rtems/basedefs/req/const-0.yml22
-rw-r--r--spec/rtems/basedefs/req/container-of-0.yml21
-rw-r--r--spec/rtems/basedefs/req/declare-global-symbol-0.yml22
-rw-r--r--spec/rtems/basedefs/req/deconst-0.yml20
-rw-r--r--spec/rtems/basedefs/req/define-global-symbol-0.yml25
-rw-r--r--spec/rtems/basedefs/req/define-global-symbol-1.yml15
-rw-r--r--spec/rtems/basedefs/req/deprecated-0.yml19
-rw-r--r--spec/rtems/basedefs/req/dequalify-0.yml22
-rw-r--r--spec/rtems/basedefs/req/dequalify-depthx-0.yml29
-rw-r--r--spec/rtems/basedefs/req/devolatile-0.yml21
-rw-r--r--spec/rtems/basedefs/req/expand-0.yml16
-rw-r--r--spec/rtems/basedefs/req/false-0.yml14
-rw-r--r--spec/rtems/basedefs/req/have-member-same-type-0.yml34
-rw-r--r--spec/rtems/basedefs/req/inline-routine-0.yml25
-rw-r--r--spec/rtems/basedefs/req/malloclike-0.yml27
-rw-r--r--spec/rtems/basedefs/req/no-inline-0.yml20
-rw-r--r--spec/rtems/basedefs/req/no-return-0.yml24
-rw-r--r--spec/rtems/basedefs/req/obfuscate-variable-0.yml20
-rw-r--r--spec/rtems/basedefs/req/packed-0.yml22
-rw-r--r--spec/rtems/basedefs/req/packed-1.yml25
-rw-r--r--spec/rtems/basedefs/req/packed-2.yml18
-rw-r--r--spec/rtems/basedefs/req/predict-false-0.yml24
-rw-r--r--spec/rtems/basedefs/req/predict-true-0.yml27
-rw-r--r--spec/rtems/basedefs/req/printflike-0.yml32
-rw-r--r--spec/rtems/basedefs/req/printflike-1.yml30
-rw-r--r--spec/rtems/basedefs/req/pure-0.yml23
-rw-r--r--spec/rtems/basedefs/req/return-address-0.yml29
-rw-r--r--spec/rtems/basedefs/req/section-0.yml23
-rw-r--r--spec/rtems/basedefs/req/static-assert-0.yml23
-rw-r--r--spec/rtems/basedefs/req/string-0.yml17
-rw-r--r--spec/rtems/basedefs/req/symbol-name-0.yml21
-rw-r--r--spec/rtems/basedefs/req/symbol-name-1.yml23
-rw-r--r--spec/rtems/basedefs/req/symbol-name-2.yml19
-rw-r--r--spec/rtems/basedefs/req/symbol-name-3.yml20
-rw-r--r--spec/rtems/basedefs/req/symbol-name-4.yml21
-rw-r--r--spec/rtems/basedefs/req/symbol-name-5.yml15
-rw-r--r--spec/rtems/basedefs/req/symbol-name-6.yml22
-rw-r--r--spec/rtems/basedefs/req/true-0.yml14
-rw-r--r--spec/rtems/basedefs/req/typeof-refx-0.yml28
-rw-r--r--spec/rtems/basedefs/req/unreachable-0.yml20
-rw-r--r--spec/rtems/basedefs/req/unused-0.yml17
-rw-r--r--spec/rtems/basedefs/req/unused-1.yml18
-rw-r--r--spec/rtems/basedefs/req/unused-2.yml18
-rw-r--r--spec/rtems/basedefs/req/unused-3.yml17
-rw-r--r--spec/rtems/basedefs/req/used-0.yml19
-rw-r--r--spec/rtems/basedefs/req/warn-unused-result-0.yml19
-rw-r--r--spec/rtems/basedefs/req/weak-0.yml20
-rw-r--r--spec/rtems/basedefs/req/weak-1.yml29
-rw-r--r--spec/rtems/basedefs/req/weak-alias-0.yml28
-rw-r--r--spec/rtems/basedefs/req/weak-alias-1.yml34
-rw-r--r--spec/rtems/basedefs/req/xconcat-0.yml19
-rw-r--r--spec/rtems/basedefs/req/xconcat-1.yml17
-rw-r--r--spec/rtems/basedefs/req/xconcat-2.yml18
-rw-r--r--spec/rtems/basedefs/req/xconcat-3.yml15
-rw-r--r--spec/rtems/basedefs/req/xstring-0.yml20
-rw-r--r--spec/rtems/basedefs/req/zero-length-array-0.yml44
-rw-r--r--spec/rtems/basedefs/val/basedefs.yml1688
75 files changed, 3264 insertions, 0 deletions
diff --git a/config.yml b/config.yml
index 4e7cb5e8..280f9b5d 100644
--- a/config.yml
+++ b/config.yml
@@ -30,6 +30,7 @@ build:
- cpukit/score/src/opt_ntp.h
- gccdeps.py
- long_gcc.py
+ - testsuites/validation/tc-basedefs-pendant.h
- testsuites/validation/tr-event-constant.h
- testsuites/validation/tr-event-send-receive.h
- testsuites/validation/tr-object-ident.h
diff --git a/spec/rtems/basedefs/req/alias-0.yml b/spec/rtems/basedefs/req/alias-0.yml
new file mode 100644
index 00000000..3a788e89
--- /dev/null
+++ b/spec/rtems/basedefs/req/alias-0.yml
@@ -0,0 +1,25 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/alias
+non-functional-type: interface
+rationale: null
+references: []
+requirement-type: non-functional
+text: |
+ When argument ${../if/alias:/params[0]/name} is a name of a function,
+ and the macro ${../if/alias:/name} call is in the same compilation unit
+ as the function,
+ and the macro is not used in block scope,
+ and the macro is used in this form:
+ ``<return-type> newname([argument-type-list]) ${../if/alias:/name}(oldname)``;,
+ and the ``<return-type>`` and ``argument-type-list`` match the
+ signature of the function ``oldname``,
+ and the code is compiled with the GNU C compiler,
+ the ${../if/alias:/name} macro shall cause the compiler to create
+ an additional name (``newname`` in the syntax) for the function
+ given as argument ${../if/alias:/params[0]/name}.
+type: requirement
diff --git a/spec/rtems/basedefs/req/align-down-0.yml b/spec/rtems/basedefs/req/align-down-0.yml
new file mode 100644
index 00000000..b0c824db
--- /dev/null
+++ b/spec/rtems/basedefs/req/align-down-0.yml
@@ -0,0 +1,21 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/align-down
+non-functional-type: interface
+rationale: null
+references: []
+requirement-type: non-functional
+text: |
+ When the argument ${../if/align-down:/params[1]/name} is a
+ positive power of two integer,
+ and argument ${../if/align-down:/params[0]/name} is a positive or 0
+ integer,
+ the macro ${../if/align-down:/name} shall result in a side-effect free formula
+ calculating an integer which is the *greatest* whole-number *multiple* of
+ ${../if/align-down:/params[1]/name} which is smaller or equal
+ ${../if/align-down:/params[0]/name}.
+type: requirement
diff --git a/spec/rtems/basedefs/req/align-up-0.yml b/spec/rtems/basedefs/req/align-up-0.yml
new file mode 100644
index 00000000..823c22c7
--- /dev/null
+++ b/spec/rtems/basedefs/req/align-up-0.yml
@@ -0,0 +1,21 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/align-up
+non-functional-type: interface
+rationale: null
+references: []
+requirement-type: non-functional
+text: |
+ When the argument ${../if/align-up:/params[1]/name} is a
+ positive power of two integer,
+ and argument ${../if/align-up:/params[0]/name} is a positive or 0
+ integer,
+ the macro ${../if/align-up:/name} shall result in a side-effect free formula
+ calculating an integer which is the *smallest* whole-number *multiple* of
+ ${../if/align-up:/params[1]/name} which is greater or equal
+ ${../if/align-up:/params[0]/name}.
+type: requirement
diff --git a/spec/rtems/basedefs/req/aligned-0.yml b/spec/rtems/basedefs/req/aligned-0.yml
new file mode 100644
index 00000000..3a4a57aa
--- /dev/null
+++ b/spec/rtems/basedefs/req/aligned-0.yml
@@ -0,0 +1,24 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/aligned
+non-functional-type: interface
+rationale: |
+ Note that the ${../if/aligned:/name} macro can often only increases the
+ alignment but under some circumstances, it can also decrease the alignment.
+references: []
+requirement-type: non-functional
+text: |
+ When the argument ${../if/aligned:/params[0]/name} is a
+ positive power of two integer,
+ and the macro ${../if/aligned:/name} is used on a none-``static``
+ variable or structure field,
+ and the used linker supports alignments of the size given by the
+ ${../if/aligned:/params[0]/name} argument,
+ and the code is compiled with the GNU C compiler,
+ the macro shall specify a minimum alignment for the variable or
+ structure field, measured in bytes.
+type: requirement
diff --git a/spec/rtems/basedefs/req/alloc-align-0.yml b/spec/rtems/basedefs/req/alloc-align-0.yml
new file mode 100644
index 00000000..c58050a5
--- /dev/null
+++ b/spec/rtems/basedefs/req/alloc-align-0.yml
@@ -0,0 +1,26 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/alloc-align
+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/alloc-align:/name} macro is used as last part of a
+ function declaration,
+ and ${../if/alloc-align:/params[0]/name} is a constant number
+ referring to an argument of that function
+ (counting of arguments starts at 1 from the left),
+ and the argument with that number is an integral value of a power of two,
+ and the declared function
+ returns a pointer to memory which starts at an integral *multiple*
+ of the value provided by the function argument number
+ ${../if/alloc-align:/params[0]/name},
+ the macro shall cause the compiler to use the information of the alignment
+ of the returned memory in its pointer analysis.
+type: requirement
diff --git a/spec/rtems/basedefs/req/alloc-size-0.yml b/spec/rtems/basedefs/req/alloc-size-0.yml
new file mode 100644
index 00000000..089388ee
--- /dev/null
+++ b/spec/rtems/basedefs/req/alloc-size-0.yml
@@ -0,0 +1,23 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/alloc-size
+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/alloc-size:/name} macro is used as last part of a
+ function declaration,
+ and ${../if/alloc-size:/params[0]/name} is a constant number
+ referring to an argument of that function
+ (counting of arguments starts at 1 from the left),
+ and the declared function returns a pointer to memory with the size in bytes
+ provided by the function argument number ${../if/alloc-size:/params[0]/name},
+ the macro shall cause the compiler to improve the correctness of
+ ``__builtin_object_sizepointer`` analysis.
+type: requirement
diff --git a/spec/rtems/basedefs/req/alloc-size-2-0.yml b/spec/rtems/basedefs/req/alloc-size-2-0.yml
new file mode 100644
index 00000000..6e2e26e3
--- /dev/null
+++ b/spec/rtems/basedefs/req/alloc-size-2-0.yml
@@ -0,0 +1,26 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/alloc-size-2
+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/alloc-size-2:/name} macro is used as last part of a
+ function declaration,
+ and ${../if/alloc-size-2:/params[0]/name} as well as
+ ${../if/alloc-size-2:/params[1]/name} are constant numbers
+ referring to two different arguments of that function
+ (counting of arguments starts at 1 from the left),
+ and the declared function returns a pointer to memory with the size in bytes
+ provided by the multiplication of the function arguments
+ number ${../if/alloc-size-2:/params[0]/name} and
+ ${../if/alloc-size-2:/params[1]/name},
+ the macro shall cause the compiler to improve the correctness of
+ ``__builtin_object_sizepointer`` analysis.
+type: requirement
diff --git a/spec/rtems/basedefs/req/array-size-0.yml b/spec/rtems/basedefs/req/array-size-0.yml
new file mode 100644
index 00000000..d00ee249
--- /dev/null
+++ b/spec/rtems/basedefs/req/array-size-0.yml
@@ -0,0 +1,18 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/array-size
+non-functional-type: interface
+rationale: null
+references: []
+requirement-type: non-functional
+text: |
+ When the argument ${../if/alloc-size:/params[0]/name} evaluates to an
+ value of a C one-dimensional array type,
+ and the evaluation of that argument has no side effects,
+ the macro ${../if/array-size:/name} shall result in the number of elements
+ with which that array has been defined.
+type: requirement
diff --git a/spec/rtems/basedefs/req/compiler-deprecated-attribute-0.yml b/spec/rtems/basedefs/req/compiler-deprecated-attribute-0.yml
new file mode 100644
index 00000000..31e45fa2
--- /dev/null
+++ b/spec/rtems/basedefs/req/compiler-deprecated-attribute-0.yml
@@ -0,0 +1,15 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/compiler-deprecated-attribute
+non-functional-type: interface
+rationale: null
+references: []
+requirement-type: non-functional
+text: |
+ The macro ${../if/compiler-deprecated-attribute:/name} shall
+ have exactly the same effect as the macro ${../if/deprecated:/name}.
+type: requirement
diff --git a/spec/rtems/basedefs/req/compiler-memory-barrier-0.yml b/spec/rtems/basedefs/req/compiler-memory-barrier-0.yml
new file mode 100644
index 00000000..e3101e55
--- /dev/null
+++ b/spec/rtems/basedefs/req/compiler-memory-barrier-0.yml
@@ -0,0 +1,22 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/compiler-memory-barrier
+non-functional-type: interface
+rationale: |
+ A Full Software Memory Barrier prevents the compiler to move loads and
+ stores (in any direction) beyond the point where the barrier is in the
+ code. Otherwise this may occur as part of compiler optimizations.
+ This is a compile time only barrier. The CPU optimizations can still
+ move instructions over the barrier at run-time.
+references: []
+requirement-type: non-functional
+text: |
+ When the code is compiled with the GNU C compiler,
+ the ${../if/compiler-memory-barrier:/name} macro shall
+ realize a Full Software Memory Barrier at the place in the code where
+ it occurs.
+type: requirement
diff --git a/spec/rtems/basedefs/req/compiler-no-return-attribute-0.yml b/spec/rtems/basedefs/req/compiler-no-return-attribute-0.yml
new file mode 100644
index 00000000..3413e9b4
--- /dev/null
+++ b/spec/rtems/basedefs/req/compiler-no-return-attribute-0.yml
@@ -0,0 +1,15 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/compiler-no-return-attribute
+non-functional-type: interface
+rationale: null
+references: []
+requirement-type: non-functional
+text: |
+ The macro ${../if/compiler-no-return-attribute:/name} shall
+ have exactly the same effect as the macro ${../if/no-return:/name}.
+type: requirement
diff --git a/spec/rtems/basedefs/req/compiler-packed-attribute-0.yml b/spec/rtems/basedefs/req/compiler-packed-attribute-0.yml
new file mode 100644
index 00000000..1dc6a698
--- /dev/null
+++ b/spec/rtems/basedefs/req/compiler-packed-attribute-0.yml
@@ -0,0 +1,15 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/compiler-packed-attribute
+non-functional-type: interface
+rationale: null
+references: []
+requirement-type: non-functional
+text: |
+ The macro ${../if/compiler-packed-attribute:/name} shall
+ have exactly the same effect as the macro ${../if/packed:/name}.
+type: requirement
diff --git a/spec/rtems/basedefs/req/compiler-pure-attribute-0.yml b/spec/rtems/basedefs/req/compiler-pure-attribute-0.yml
new file mode 100644
index 00000000..465d76bc
--- /dev/null
+++ b/spec/rtems/basedefs/req/compiler-pure-attribute-0.yml
@@ -0,0 +1,15 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/compiler-pure-attribute
+non-functional-type: interface
+rationale: null
+references: []
+requirement-type: non-functional
+text: |
+ The macro ${../if/compiler-pure-attribute:/name} shall
+ have exactly the same effect as the macro ${../if/pure:/name}.
+type: requirement
diff --git a/spec/rtems/basedefs/req/compiler-unused-attribute-0.yml b/spec/rtems/basedefs/req/compiler-unused-attribute-0.yml
new file mode 100644
index 00000000..57ef81aa
--- /dev/null
+++ b/spec/rtems/basedefs/req/compiler-unused-attribute-0.yml
@@ -0,0 +1,15 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/compiler-unused-attribute
+non-functional-type: interface
+rationale: null
+references: []
+requirement-type: non-functional
+text: |
+ The macro ${../if/compiler-unused-attribute:/name} shall
+ have exactly the same effect as the macro ${../if/unused:/name}.
+type: requirement
diff --git a/spec/rtems/basedefs/req/concat-0.yml b/spec/rtems/basedefs/req/concat-0.yml
new file mode 100644
index 00000000..e6e46d6c
--- /dev/null
+++ b/spec/rtems/basedefs/req/concat-0.yml
@@ -0,0 +1,18 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/concat
+non-functional-type: interface
+rationale: |
+ The rules for nested use of the ## operator are arcane. The result of such
+ nested macro calls is undefined.
+references: []
+requirement-type: non-functional
+text: |
+ When neither argument is a call of the macro ${../if/concat:/name} itself,
+ the macro shall result in both argument values
+ concatenated textually unaltered in the order they are provided.
+type: requirement
diff --git a/spec/rtems/basedefs/req/concat-1.yml b/spec/rtems/basedefs/req/concat-1.yml
new file mode 100644
index 00000000..f21e592e
--- /dev/null
+++ b/spec/rtems/basedefs/req/concat-1.yml
@@ -0,0 +1,17 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/concat
+non-functional-type: interface
+rationale: |
+ There should be no additional character before, between or after the
+ arguments in the result.
+references: []
+requirement-type: non-functional
+text: |
+ The macro ${../if/concat:/name} shall result in only those
+ characters which also appear in its argument values.
+type: requirement
diff --git a/spec/rtems/basedefs/req/concat-2.yml b/spec/rtems/basedefs/req/concat-2.yml
new file mode 100644
index 00000000..751836f6
--- /dev/null
+++ b/spec/rtems/basedefs/req/concat-2.yml
@@ -0,0 +1,15 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/concat
+non-functional-type: interface
+rationale: null
+references: []
+requirement-type: non-functional
+text: |
+ The macro ${../if/concat:/name} shall make its result
+ subject to C pre-processor operations.
+type: requirement
diff --git a/spec/rtems/basedefs/req/const-0.yml b/spec/rtems/basedefs/req/const-0.yml
new file mode 100644
index 00000000..47601ca3
--- /dev/null
+++ b/spec/rtems/basedefs/req/const-0.yml
@@ -0,0 +1,22 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/const
+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/const:/name} macro is attached to a
+ function declaration or definition,
+ and the return value of that function is not affected by changes
+ to the observable state of the program and that function has
+ no observable effects on such state other than to return a value,
+ the ${../if/const:/name} macro shall permit the compiler to replace
+ subsequent calls to the function with the same argument values by the
+ result of the first call.
+type: requirement
diff --git a/spec/rtems/basedefs/req/container-of-0.yml b/spec/rtems/basedefs/req/container-of-0.yml
new file mode 100644
index 00000000..8bb2aa9a
--- /dev/null
+++ b/spec/rtems/basedefs/req/container-of-0.yml
@@ -0,0 +1,21 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/container-of
+non-functional-type: interface
+rationale: null
+references: []
+requirement-type: non-functional
+text: |
+ When argument ${../if/container-of/params[0]/name} points to a
+ member field of a structure or union or C++ class,
+ and argument ${../if/container-of/params[1]/name} is the C type of this
+ structure or union or C++ class,
+ and argument ${../if/container-of/params[2]/name} is the name of
+ this member field,
+ the ${../if/container-of:/name} macro shall result in a pointer
+ to the start address of the structure or union or C++ class.
+type: requirement
diff --git a/spec/rtems/basedefs/req/declare-global-symbol-0.yml b/spec/rtems/basedefs/req/declare-global-symbol-0.yml
new file mode 100644
index 00000000..402925d7
--- /dev/null
+++ b/spec/rtems/basedefs/req/declare-global-symbol-0.yml
@@ -0,0 +1,22 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/declare-global-symbol
+non-functional-type: interface
+rationale: |
+ See also ${../if/define-global-symbol:/name}.
+references: []
+requirement-type: non-functional
+text: |
+ When the macro ${../if/declare-global-symbol:/name} appears at file scope,
+ and argument ${../if/declare-global-symbol:/params[0]/name} after undergoing
+ C pre-processor substitutions results in a valid C identifier name,
+ and this identifier name is not yet defined at file scope,
+ the macro ${../if/declare-global-symbol:/name} shall apply all possible C
+ pre-processor substitutions to its argument value
+ before it results in code which declares a global symbol
+ with the respective name.
+type: requirement
diff --git a/spec/rtems/basedefs/req/deconst-0.yml b/spec/rtems/basedefs/req/deconst-0.yml
new file mode 100644
index 00000000..c3b1aff0
--- /dev/null
+++ b/spec/rtems/basedefs/req/deconst-0.yml
@@ -0,0 +1,20 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/deconst
+non-functional-type: interface
+rationale: null
+references: []
+requirement-type: non-functional
+text: |
+ When ${../if/deconst:/params[0]/name} is a non-const pointer type,
+ and ${../if/deconst:/params[1]/name} is a pointer to a value of const type,
+ and the types of ${../if/deconst:/params[0]/name} and
+ ${../if/deconst:/params[1]/name} are compatible in the sense of C,
+ the macro ${../if/deconst:/name} shall result in an expression
+ which returns a pointer of type ${../if/deconst:/params[0]/name} pointing
+ to the same address as ${../if/deconst:/params[1]/name}.
+type: requirement
diff --git a/spec/rtems/basedefs/req/define-global-symbol-0.yml b/spec/rtems/basedefs/req/define-global-symbol-0.yml
new file mode 100644
index 00000000..f59ae9dc
--- /dev/null
+++ b/spec/rtems/basedefs/req/define-global-symbol-0.yml
@@ -0,0 +1,25 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/define-global-symbol
+non-functional-type: interface
+rationale: |
+ See also ${../if/declare-global-symbol:/name}.
+ *File scope* excludes for example a placement in a function body.
+references: []
+requirement-type: non-functional
+text: |
+ When the macro ${../if/define-global-symbol:/name} appears at file scope,
+ and argument ${../if/define-global-symbol:/params[0]/name} after undergoing
+ C pre-processor substitutions results in a valid C identifier name,
+ and this identifier name is not yet defined at file scope,
+ and argument ${../if/define-global-symbol:/params[1]/name} after undergoing
+ C pre-processor substitutions results in a valid assembler integer value,
+ the macro ${../if/define-global-symbol:/name} shall apply all possible C
+ pre-processor substitutions to its argument values
+ before it results in assembler code which defines a global symbol
+ with the respective name and value.
+type: requirement
diff --git a/spec/rtems/basedefs/req/define-global-symbol-1.yml b/spec/rtems/basedefs/req/define-global-symbol-1.yml
new file mode 100644
index 00000000..f66e543b
--- /dev/null
+++ b/spec/rtems/basedefs/req/define-global-symbol-1.yml
@@ -0,0 +1,15 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/define-global-symbol
+non-functional-type: interface
+rationale: null
+references: []
+requirement-type: non-functional
+text: |
+ The macro ${../if/define-global-symbol:/name} shall define
+ a global symbol of ``void`` pointer type with the value being an address.
+type: requirement
diff --git a/spec/rtems/basedefs/req/deprecated-0.yml b/spec/rtems/basedefs/req/deprecated-0.yml
new file mode 100644
index 00000000..a477f69e
--- /dev/null
+++ b/spec/rtems/basedefs/req/deprecated-0.yml
@@ -0,0 +1,19 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/deprecated
+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/deprecated:/name} macro is used as last part of a
+ function declaration or type declaration or variable declaration or
+ variable definition,
+ the macro shall cause the compiler to issue a warning message when it
+ encounters a use of the function, type or variable.
+type: requirement
diff --git a/spec/rtems/basedefs/req/dequalify-0.yml b/spec/rtems/basedefs/req/dequalify-0.yml
new file mode 100644
index 00000000..a94453b1
--- /dev/null
+++ b/spec/rtems/basedefs/req/dequalify-0.yml
@@ -0,0 +1,22 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/dequalify
+non-functional-type: interface
+rationale: null
+references: []
+requirement-type: non-functional
+text: |
+ When ${../if/dequalify:/params[0]/name} is a non-const non-volatile
+ pointer type,
+ and ${../if/dequalify:/params[1]/name} is a pointer to a value of
+ const volatile type,
+ and the types of ${../if/dequalify:/params[0]/name} and
+ ${../if/dequalify:/params[1]/name} are compatible in the sense of C,
+ the macro ${../if/dequalify:/name} shall result in an expression
+ which returns a pointer of type ${../if/dequalify:/params[0]/name} pointing
+ to the same address as ${../if/dequalify:/params[1]/name}.
+type: requirement
diff --git a/spec/rtems/basedefs/req/dequalify-depthx-0.yml b/spec/rtems/basedefs/req/dequalify-depthx-0.yml
new file mode 100644
index 00000000..7f86363c
--- /dev/null
+++ b/spec/rtems/basedefs/req/dequalify-depthx-0.yml
@@ -0,0 +1,29 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/dequalify-depthx
+non-functional-type: interface
+rationale: |
+ ${../if/dequalify-depthx:/name} checks for incompatible pointer types.
+references: []
+requirement-type: non-functional
+text: |
+ When the argument value of ${../if/dequalify-depthx:/params[0]/name} consists
+ of a sequence of *i* ``*`` and the types of both other arguments both
+ have *i* nested pointers (for example ``*`` for a pointer to ``int``,
+ ``**`` for a pointer to a pointer of ``int``, ``***`` for a pointer to
+ a pointer to a pointer to ``int``),
+ and ${../if/dequalify-depthx:/params[1]/name} is a pointer type with
+ different (compared to the type of
+ ${../if/dequalify-depthx:/params[2]/name}) qualifiers
+ (such as ``const`` or ``volatile``) or the same qualifiers or
+ without any qualifiers,
+ and the types of ${../if/dequalify-depthx:/params[1]/name} and
+ ${../if/dequalify-depthx:/params[2]/name} are compatible in the sense of C,
+ the macro ${../if/dequalify-depthx:/name} shall result in an expression
+ which returns a pointer of type ${../if/dequalify-depthx:/params[1]/name}
+ pointing to the same address as ${../if/dequalify-depthx:/params[2]/name}.
+type: requirement
diff --git a/spec/rtems/basedefs/req/devolatile-0.yml b/spec/rtems/basedefs/req/devolatile-0.yml
new file mode 100644
index 00000000..5125aa86
--- /dev/null
+++ b/spec/rtems/basedefs/req/devolatile-0.yml
@@ -0,0 +1,21 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/devolatile
+non-functional-type: interface
+rationale: null
+references: []
+requirement-type: non-functional
+text: |
+ When ${../if/devolatile:/params[0]/name} is a non-volatile pointer type,
+ and ${../if/devolatile:/params[1]/name} is a pointer to a value of
+ volatile type,
+ and the types of ${../if/devolatile:/params[0]/name} and
+ ${../if/devolatile:/params[1]/name} are compatible in the sense of C,
+ the macro ${../if/devolatile:/name} shall result in an expression
+ which returns a pointer of type ${../if/devolatile:/params[0]/name} pointing
+ to the same address as ${../if/devolatile:/params[1]/name}.
+type: requirement
diff --git a/spec/rtems/basedefs/req/expand-0.yml b/spec/rtems/basedefs/req/expand-0.yml
new file mode 100644
index 00000000..db8a4a4f
--- /dev/null
+++ b/spec/rtems/basedefs/req/expand-0.yml
@@ -0,0 +1,16 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/expand
+non-functional-type: interface
+rationale: null
+references: []
+requirement-type: non-functional
+text: |
+ The macro ${../if/expand:/name} shall apply all possible C
+ pre-processor substitutions to its argument value
+ before it results in the substituted value.
+type: requirement
diff --git a/spec/rtems/basedefs/req/false-0.yml b/spec/rtems/basedefs/req/false-0.yml
new file mode 100644
index 00000000..11f4c13e
--- /dev/null
+++ b/spec/rtems/basedefs/req/false-0.yml
@@ -0,0 +1,14 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/false
+non-functional-type: interface
+rationale: null
+references: []
+requirement-type: non-functional
+text: |
+ The macro ${../if/false:/name} shall result in the text 0.
+type: requirement
diff --git a/spec/rtems/basedefs/req/have-member-same-type-0.yml b/spec/rtems/basedefs/req/have-member-same-type-0.yml
new file mode 100644
index 00000000..9a72691a
--- /dev/null
+++ b/spec/rtems/basedefs/req/have-member-same-type-0.yml
@@ -0,0 +1,34 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/have-member-same-type
+non-functional-type: interface
+rationale: |
+ The ${../if/have-member-same-type:/name} does only work in C.
+ Type qualifiers do not matter (``const int`` is
+ compatible to ``int``); arrays with undefined length are compatible
+ with arrays of defined length (``int[]`` is compatible
+ to ``int[5]``); enums are always incompatible; the number of pointer
+ indirection matters (``**int`` is not compatible with ``*int``).
+ See https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html#index-_005f_005fbuiltin_005ftypes_005fcompatible_005fp
+references: []
+requirement-type: non-functional
+text: |
+ When the code is compiled with the GNU C compiler,
+ and argument ${../if/have-member-same-type:/params[0]/name} is a union or
+ structure,
+ and ${../if/have-member-same-type:/params[1]/name} is a member of
+ ${../if/have-member-same-type:/params[0]/name},
+ and argument ${../if/have-member-same-type:/params[2]/name} is a union or
+ structure,
+ and ${../if/have-member-same-type:/params[3]/name} is a member of
+ ${../if/have-member-same-type:/params[2]/name},
+ the ${../if/have-member-same-type:/name} macro shall
+ evaluate to the integer values 1 or 0 depending on whether
+ the types of the members {../if/have-member-same-type:/params[1]/name}
+ and ${../if/have-member-same-type:/params[3]/name} are compatible in
+ the sense of C.
+type: requirement
diff --git a/spec/rtems/basedefs/req/inline-routine-0.yml b/spec/rtems/basedefs/req/inline-routine-0.yml
new file mode 100644
index 00000000..3d74a129
--- /dev/null
+++ b/spec/rtems/basedefs/req/inline-routine-0.yml
@@ -0,0 +1,25 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/inline-routine
+non-functional-type: interface
+rationale: |
+ ``inline`` and ``__inline__`` have the same effect at least for the
+ GNU C compiler. ``__inline__`` works even if the GNU C compiler
+ is invoked with the ``-ansi``, or ``-std`` flags.
+
+ The compiler may still emit code for a function defined or declared
+ with ``static inline`` or ``static __inline__``. Therefore,
+ if you want to put an inline function definition into a header
+ file, consider ``extern inline`` instead (see the compiler
+ documentation).
+references: []
+requirement-type: non-functional
+text: |
+ The ${../if/inline-routine:/name} macro shall evaluate
+ to the keywords ``static inline`` or ``static __inline__``
+ which ever variant is available to the used compiler.
+type: requirement
diff --git a/spec/rtems/basedefs/req/malloclike-0.yml b/spec/rtems/basedefs/req/malloclike-0.yml
new file mode 100644
index 00000000..6bb7cc28
--- /dev/null
+++ b/spec/rtems/basedefs/req/malloclike-0.yml
@@ -0,0 +1,27 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/malloclike
+non-functional-type: interface
+rationale: |
+ Functions like malloc() and calloc() have this property but functions
+ like realloc() do not have this property because the memory it returns
+ may pointer to valid objects.
+references: []
+requirement-type: non-functional
+text: |
+ When the code is compiled with the GNU C compiler,
+ and the ${../if/malloclike:/name} macro is used as last part of a
+ function declaration or is attached to a function definition,
+ and the function returns a pointer to memory,
+ and this pointer cannot be an alias of any other pointer valid when
+ the function returns,
+ and no pointers to valid objects occur in any storage addressed by
+ that pointer,
+ and the function returns non-NULL in more than 50% of the cases,
+ the macro shall cause the compiler to use this information for
+ optimization.
+type: requirement
diff --git a/spec/rtems/basedefs/req/no-inline-0.yml b/spec/rtems/basedefs/req/no-inline-0.yml
new file mode 100644
index 00000000..9dde8a68
--- /dev/null
+++ b/spec/rtems/basedefs/req/no-inline-0.yml
@@ -0,0 +1,20 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/no-inline
+non-functional-type: interface
+rationale: |
+ If the function has no side effects, it may still be subject to inlining.
+ To avoid this, produce an artificial side effect with ``asm ("");``.
+references: []
+requirement-type: non-functional
+text: |
+ When the code is compiled with the GNU C compiler,
+ and the ${../if/no-inline:/name} macro is used as last part of a
+ function declaration or is attached to a function definition,
+ and the function has side-effects,
+ the macro shall prevent the compiler from inlining this function.
+type: requirement
diff --git a/spec/rtems/basedefs/req/no-return-0.yml b/spec/rtems/basedefs/req/no-return-0.yml
new file mode 100644
index 00000000..7643ef51
--- /dev/null
+++ b/spec/rtems/basedefs/req/no-return-0.yml
@@ -0,0 +1,24 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/no-return
+non-functional-type: interface
+rationale: |
+ The GNU C compiler can optimize such a function without regard to what would
+ happen if it ever did return. Declaring a function ${../if/no-return:/name}
+ also avoids spurious warnings of uninitialized variables.
+references: []
+requirement-type: non-functional
+text: |
+ When the code is compiled with the GNU C compiler starting at version 2.5
+ or the ``__cplusplus`` symbol is defined with version ``201103L`` or higher
+ or the ``__STDC_VERSION__`` symbol is defined with version ``201112L``
+ or higher,
+ and the ${../if/no-return:/name} macro is used as first part of a
+ function declaration or definition,
+ the ${../if/no-return:/name} macro shall
+ inform the compiler that this function does not return when called.
+type: requirement
diff --git a/spec/rtems/basedefs/req/obfuscate-variable-0.yml b/spec/rtems/basedefs/req/obfuscate-variable-0.yml
new file mode 100644
index 00000000..11a132d9
--- /dev/null
+++ b/spec/rtems/basedefs/req/obfuscate-variable-0.yml
@@ -0,0 +1,20 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/obfuscate-variable
+non-functional-type: interface
+rationale: null
+references: []
+requirement-type: non-functional
+text: |
+ When the code is compiled with the GNU C compiler,
+ and argument ${../if/obfuscate-variable:/params[0]/name}
+ is an automatic variable or function argument,
+ and the value of that variable or function argument is of a type
+ which fits into a register,
+ the ${../if/obfuscate-variable:/name} macro shall prevent the compiler
+ from performing optimizations based on the variable value.
+type: requirement
diff --git a/spec/rtems/basedefs/req/packed-0.yml b/spec/rtems/basedefs/req/packed-0.yml
new file mode 100644
index 00000000..2a6085be
--- /dev/null
+++ b/spec/rtems/basedefs/req/packed-0.yml
@@ -0,0 +1,22 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/packed
+non-functional-type: interface
+rationale: |
+ Note: The 4.1, 4.2 and 4.3 series of GCC ignore the packed attribute
+ on bit-fields of type char.
+references: []
+requirement-type: non-functional
+text: |
+ When the code is compiled with the GNU C compiler,
+ and the ${../if/packed:/name} macro is used as last part of a
+ structure member declaration,
+ and the ``aligned`` attribute or ${../if/aligned:/name} macro
+ is not used on this structure member,
+ the ${../if/packed:/name} macro shall cause the structure member
+ to be aligned at one bit for a bit-field member and one byte otherwise.
+type: requirement
diff --git a/spec/rtems/basedefs/req/packed-1.yml b/spec/rtems/basedefs/req/packed-1.yml
new file mode 100644
index 00000000..9f100baf
--- /dev/null
+++ b/spec/rtems/basedefs/req/packed-1.yml
@@ -0,0 +1,25 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/packed
+non-functional-type: interface
+rationale: |
+ The effect of the ${../if/packed:/name} macro is not propagated into any
+ structure, union or C++ class which is member of the structure, union or
+ C++ class declaration to which the macro is attached.
+references: []
+requirement-type: non-functional
+text: |
+ When the code is compiled with the GNU C compiler,
+ and the ${../if/packed:/name} macro is attached to a
+ struct, union, or C++ class type definition,
+ and the ``aligned`` attribute or ${../if/aligned:/name} macro
+ is not used on the struct, union, or C++ class type definition or
+ any member thereof,
+ the ${../if/packed:/name} macro shall cause all structure, union, or class
+ members to be aligned at one bit for a bit-field member and
+ one byte otherwise.
+type: requirement
diff --git a/spec/rtems/basedefs/req/packed-2.yml b/spec/rtems/basedefs/req/packed-2.yml
new file mode 100644
index 00000000..77240d51
--- /dev/null
+++ b/spec/rtems/basedefs/req/packed-2.yml
@@ -0,0 +1,18 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/packed
+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/packed:/name} macro is attached to a
+ enum type definition,
+ the ${../if/packed:/name} macro shall cause the use of the smallest integral
+ type to represent the values of the enum.
+type: requirement
diff --git a/spec/rtems/basedefs/req/predict-false-0.yml b/spec/rtems/basedefs/req/predict-false-0.yml
new file mode 100644
index 00000000..4d05c771
--- /dev/null
+++ b/spec/rtems/basedefs/req/predict-false-0.yml
@@ -0,0 +1,24 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/predict-false
+non-functional-type: interface
+rationale: |
+ Example: ``if ( ${../if/predict-false:/name}( -1 == i ) ) { ... }``.
+ The GNU C compiler uses this information for branch optimization.
+ ``builtin-expect-probability`` defaults to 90%.
+references: []
+requirement-type: non-functional
+text: |
+ When the code is compiled with the GNU C compiler,
+ and the ${../if/predict-false:/name} macro is used as a conditional
+ in ``if``-expressions and loop expressions,
+ and ${../if/predict-false:/params[0]/name} after undergoing all possible C
+ pre-processor substitutions is an integral expression,
+ the macro shall cause the compiler to assume that by the percentage of
+ cases defined by ``builtin-expect-probability`` the expression evaluates
+ to 0.
+type: requirement
diff --git a/spec/rtems/basedefs/req/predict-true-0.yml b/spec/rtems/basedefs/req/predict-true-0.yml
new file mode 100644
index 00000000..9c75707d
--- /dev/null
+++ b/spec/rtems/basedefs/req/predict-true-0.yml
@@ -0,0 +1,27 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/predict-true
+non-functional-type: interface
+rationale: |
+ Example: ``if ( ${../if/predict-true:/name}( 99 > i ) ) { ... }``.
+ The GNU C compiler uses this information for branch optimization.
+ ``builtin-expect-probability`` defaults to 90%.
+ Note the misleading name: The macro tells the compiler to assume
+ "the result is 1" not "the result is not 0" as one would expect for
+ ``true``.
+references: []
+requirement-type: non-functional
+text: |
+ When the code is compiled with the GNU C compiler,
+ and the ${../if/predict-true:/name} macro is used as a conditional
+ in ``if``-expressions and loop expressions,
+ and ${../if/predict-true:/params[0]/name} after undergoing all possible C
+ pre-processor substitutions is an integral expression,
+ the macro shall cause the compiler to assume that by the percentage of
+ cases defined by ``builtin-expect-probability`` the expression evaluates
+ to 1.
+type: requirement
diff --git a/spec/rtems/basedefs/req/printflike-0.yml b/spec/rtems/basedefs/req/printflike-0.yml
new file mode 100644
index 00000000..39c923dc
--- /dev/null
+++ b/spec/rtems/basedefs/req/printflike-0.yml
@@ -0,0 +1,32 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/printflike
+non-functional-type: interface
+rationale: |
+ Counting of arguments starts at 1 from the left with the
+ exception of non-static C++ methods where the counting starts with
+ 2 due to the implicit ``this`` argument.
+references: []
+requirement-type: non-functional
+text: |
+ When the code is compiled with the GNU C compiler,
+ and the ${../if/printflike:/name} macro is used as last part of a
+ function declaration or prefixes a function definition,
+ and ${../if/printflike:/params[0]/name} as well as
+ ${../if/printflike:/params[1]/name} are constant numbers
+ referring to two different arguments of that function,
+ and the function argument number ${../if/printflike:/params[0]/name}
+ is a ``printf``-format string,
+ and the function argument number {../if/printflike:/params[1]/name}
+ is the first argument to be used in the ``printf``-format string,
+ and all other arguments used in the ``printf``-format string
+ are arguments {../if/printflike:/params[1]/name} + 1,
+ {../if/printflike:/params[1]/name} + 2,
+ {../if/printflike:/params[1]/name} + 3, and so on,
+ the macro shall cause the compiler to use this information for
+ type checking the format string and arguments.
+type: requirement
diff --git a/spec/rtems/basedefs/req/printflike-1.yml b/spec/rtems/basedefs/req/printflike-1.yml
new file mode 100644
index 00000000..48d3f0b9
--- /dev/null
+++ b/spec/rtems/basedefs/req/printflike-1.yml
@@ -0,0 +1,30 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/printflike
+non-functional-type: interface
+rationale: |
+ This case is for functions where the arguments are not available
+ to be checked (such as ``vprintf``). The compiler will only check
+ the format string for consistency.
+
+ Counting of arguments starts at 1 from the left with the
+ exception of non-static C++ methods where the counting starts with
+ 2 due to the implicit ``this`` argument.
+references: []
+requirement-type: non-functional
+text: |
+ When the code is compiled with the GNU C compiler,
+ and the ${../if/printflike:/name} macro is used as last part of a
+ function declaration or prefixes a function definition,
+ and ${../if/printflike:/params[0]/name} is a constant number
+ referring to an argument of that function,
+ and the function argument number ${../if/printflike:/params[0]/name}
+ is a ``printf``-format string,
+ and the function argument {../if/printflike:/params[1]/name} is 0,
+ the macro shall cause the compiler to use this information for
+ checking the format string.
+type: requirement
diff --git a/spec/rtems/basedefs/req/pure-0.yml b/spec/rtems/basedefs/req/pure-0.yml
new file mode 100644
index 00000000..450b9804
--- /dev/null
+++ b/spec/rtems/basedefs/req/pure-0.yml
@@ -0,0 +1,23 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/pure
+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/pure:/name} macro is attached to a
+ function declaration or definition,
+ and the function has no observable effects on the state of the program other
+ than to return a value,
+ the ${../if/pure:/name} macro shall permit the compiler to replace
+ subsequent calls to the function with the same argument values by the result
+ of the first call
+ provided the state of the program observable by that function
+ does not change in between two calls.
+type: requirement
diff --git a/spec/rtems/basedefs/req/return-address-0.yml b/spec/rtems/basedefs/req/return-address-0.yml
new file mode 100644
index 00000000..dccc706f
--- /dev/null
+++ b/spec/rtems/basedefs/req/return-address-0.yml
@@ -0,0 +1,29 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/return-address
+non-functional-type: interface
+rationale: |
+ From the GNU C compiler documentation:
+
+ * When inlining the expected behavior is that the function returns
+ the address of the function that is returned to.
+ * When the top of the stack has been reached, this function returns
+ an unspecified value.
+ * Additional post-processing of the returned value may be needed, see
+ ``__builtin_extract_return_addr``.
+ * The stored representation of the return address in memory may be
+ different from the address returned by ``__builtin_return_address``.
+
+ Under these circumstances it is at least difficult to specify
+ what the actual result of this macro is.
+references: []
+requirement-type: non-functional
+text: |
+ When the code is compiled with the GNU C compiler,
+ the ${../if/return-address:/name} macro shall evaluate to the
+ code ``__builtin_return_address( 0 )``.
+type: requirement
diff --git a/spec/rtems/basedefs/req/section-0.yml b/spec/rtems/basedefs/req/section-0.yml
new file mode 100644
index 00000000..9274f10e
--- /dev/null
+++ b/spec/rtems/basedefs/req/section-0.yml
@@ -0,0 +1,23 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/section
+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
+ function declaration or definition or a global variable definition,
+ and the argument ${../if/section:/params[0]/name} after applying
+ all possible C pre-processor substitutions to its value is a
+ 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
+ substitutions on its argument ${../if/section:/params[0]/name}.
+type: requirement
diff --git a/spec/rtems/basedefs/req/static-assert-0.yml b/spec/rtems/basedefs/req/static-assert-0.yml
new file mode 100644
index 00000000..738c48d0
--- /dev/null
+++ b/spec/rtems/basedefs/req/static-assert-0.yml
@@ -0,0 +1,23 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/static-assert
+non-functional-type: interface
+rationale: null
+references: []
+requirement-type: non-functional
+text: |
+ When the argument ${../if/static-assert:/params[0]/name} after
+ applying all possible C pre-processor substitutions to its
+ value results in a valid C expression of integral type,
+ and this expression can be evaluated at compile time,
+ and the argument ${../if/static-assert:/params[1]/name} which
+ may or may not undergo C pre-processor substitutions results
+ into a valid C identifier,
+ the ${../if/static-assert:/name} macro shall cause the compiler to
+ produce a compilation error if the expression resulting from
+ ${../if/static-assert:/params[0]/name} evaluates to 0.
+type: requirement
diff --git a/spec/rtems/basedefs/req/string-0.yml b/spec/rtems/basedefs/req/string-0.yml
new file mode 100644
index 00000000..d16c06dc
--- /dev/null
+++ b/spec/rtems/basedefs/req/string-0.yml
@@ -0,0 +1,17 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/string
+non-functional-type: interface
+rationale: |
+ The exact rules on how this string is build are defined by the C standard
+ and are too complex to be repeated in this requirement.
+references: []
+requirement-type: non-functional
+text: |
+ The ${../if/string:/name} macro shall result in a string formed by
+ the C pre-processor ``#`` operator placed before the formal parameter.
+type: requirement
diff --git a/spec/rtems/basedefs/req/symbol-name-0.yml b/spec/rtems/basedefs/req/symbol-name-0.yml
new file mode 100644
index 00000000..a27f63fc
--- /dev/null
+++ b/spec/rtems/basedefs/req/symbol-name-0.yml
@@ -0,0 +1,21 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/symbol-name
+non-functional-type: interface
+rationale: null
+references: []
+requirement-type: non-functional
+text: |
+ When argument ${../if/symbol-name:/params[0]/name} after undergoing
+ C pre-processor substitutions results in a valid C identifier name,
+ while the symbol ``__USER_LABEL_PREFIX__`` is *not* defined
+ during pre-processing of the ``basedefs.h`` file,
+ the ${../if/symbol-name:/name} macro shall
+ apply all possible C pre-processor substitutions to its argument value
+ before it evaluates to the identifier name resulting
+ from the argument value.
+type: requirement
diff --git a/spec/rtems/basedefs/req/symbol-name-1.yml b/spec/rtems/basedefs/req/symbol-name-1.yml
new file mode 100644
index 00000000..45535a23
--- /dev/null
+++ b/spec/rtems/basedefs/req/symbol-name-1.yml
@@ -0,0 +1,23 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/symbol-name
+non-functional-type: interface
+rationale: null
+references: []
+requirement-type: non-functional
+text: |
+ When argument ${../if/symbol-name:/params[0]/name} after undergoing
+ C pre-processor substitutions results in a valid C identifier name,
+ while the symbol ``__USER_LABEL_PREFIX__`` *is* defined
+ during pre-processing of the ``basedefs.h`` file,
+ the ${../if/symbol-name:/name} macro shall
+ apply all possible C pre-processor substitutions to its argument value
+ and the value of ``__USER_LABEL_PREFIX__`` before it evaluates to the
+ concatenation of the value resulting from substituting
+ the symbol ``__USER_LABEL_PREFIX__`` and the identifier name resulting
+ from the argument value.
+type: requirement
diff --git a/spec/rtems/basedefs/req/symbol-name-2.yml b/spec/rtems/basedefs/req/symbol-name-2.yml
new file mode 100644
index 00000000..1141f2b5
--- /dev/null
+++ b/spec/rtems/basedefs/req/symbol-name-2.yml
@@ -0,0 +1,19 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/symbol-name
+non-functional-type: interface
+rationale: null
+references: []
+requirement-type: non-functional
+text: |
+ While the symbol ``__USER_LABEL_PREFIX__`` *is* defined
+ during pre-processing of the ``basedefs.h`` file,
+ the ${../if/symbol-name:/name} macro shall result
+ in the substituted values textually concatenated
+ in the order ``__USER_LABEL_PREFIX__`` left and
+ ${../if/symbol-name:/params[0]/name} right.
+type: requirement
diff --git a/spec/rtems/basedefs/req/symbol-name-3.yml b/spec/rtems/basedefs/req/symbol-name-3.yml
new file mode 100644
index 00000000..18daa006
--- /dev/null
+++ b/spec/rtems/basedefs/req/symbol-name-3.yml
@@ -0,0 +1,20 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/symbol-name
+non-functional-type: interface
+rationale: |
+ There should be no additional character before, between or after the
+ arguments in the result.
+references: []
+requirement-type: non-functional
+text: |
+ While the symbol ``__USER_LABEL_PREFIX__`` is *not* defined
+ during pre-processing of the ``basedefs.h`` file,
+ the ${../if/symbol-name:/name} shall result in only those
+ characters which also appear in its argument value
+ after applying all possible C pre-processor substitutions to it.
+type: requirement
diff --git a/spec/rtems/basedefs/req/symbol-name-4.yml b/spec/rtems/basedefs/req/symbol-name-4.yml
new file mode 100644
index 00000000..f2a07989
--- /dev/null
+++ b/spec/rtems/basedefs/req/symbol-name-4.yml
@@ -0,0 +1,21 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/symbol-name
+non-functional-type: interface
+rationale: |
+ There should be no additional character before, between or after the
+ arguments in the result.
+references: []
+requirement-type: non-functional
+text: |
+ While the symbol ``__USER_LABEL_PREFIX__`` *is* defined
+ during pre-processing of the ``basedefs.h`` file,
+ the ${../if/symbol-name:/name} shall result in only those
+ characters which also appear in the value of ``__USER_LABEL_PREFIX__``
+ and its argument value
+ after applying all possible C pre-processor substitutions to them.
+type: requirement
diff --git a/spec/rtems/basedefs/req/symbol-name-5.yml b/spec/rtems/basedefs/req/symbol-name-5.yml
new file mode 100644
index 00000000..508ee639
--- /dev/null
+++ b/spec/rtems/basedefs/req/symbol-name-5.yml
@@ -0,0 +1,15 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/symbol-name
+non-functional-type: interface
+rationale: null
+references: []
+requirement-type: non-functional
+text: |
+ The macro ${../if/symbol-name:/name} shall make its result
+ subject to C pre-processor substitutions.
+type: requirement
diff --git a/spec/rtems/basedefs/req/symbol-name-6.yml b/spec/rtems/basedefs/req/symbol-name-6.yml
new file mode 100644
index 00000000..e9394553
--- /dev/null
+++ b/spec/rtems/basedefs/req/symbol-name-6.yml
@@ -0,0 +1,22 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/symbol-name
+non-functional-type: interface
+rationale: |
+ First, if the ``__USER_LABEL_PREFIX__`` is defined when the macro is
+ defined, it must also be defined at all places where the macro is used.
+ Second, value of the ``__USER_LABEL_PREFIX__`` is not stored in the
+ macro but can be different each time the macro is called.
+references: []
+requirement-type: non-functional
+text: |
+ While the symbol ``__USER_LABEL_PREFIX__`` *is* defined
+ during pre-processing of the ``basedefs.h`` file,
+ the ${../if/symbol-name:/name} macro shall
+ use the value which the ``__USER_LABEL_PREFIX__`` has at the place
+ the macro call is processed.
+type: requirement
diff --git a/spec/rtems/basedefs/req/true-0.yml b/spec/rtems/basedefs/req/true-0.yml
new file mode 100644
index 00000000..1de18ee2
--- /dev/null
+++ b/spec/rtems/basedefs/req/true-0.yml
@@ -0,0 +1,14 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/true
+non-functional-type: interface
+rationale: null
+references: []
+requirement-type: non-functional
+text: |
+ The macro ${../if/true:/name} shall result in the text 1.
+type: requirement
diff --git a/spec/rtems/basedefs/req/typeof-refx-0.yml b/spec/rtems/basedefs/req/typeof-refx-0.yml
new file mode 100644
index 00000000..b6a92273
--- /dev/null
+++ b/spec/rtems/basedefs/req/typeof-refx-0.yml
@@ -0,0 +1,28 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/typeof-refx
+non-functional-type: interface
+rationale: |
+ From the GNU C compiler documentation:
+ The operand of ${../if/typeof-refx:/params[1]/name} is evaluated for
+ its side effects if and only if it is an expression of variably
+ modified type or the name of such a type.
+references: []
+requirement-type: non-functional
+text: |
+ When the argument value of ${../if/typeof-refx:/params[0]/name} consists
+ of a sequence of *i* ``*`` and the type of the other argument
+ has *i* or less than *i* nested pointers
+ (for example ``*`` for a pointer to ``int``,
+ ``**`` for a pointer to a pointer of ``int``, ``***`` for a pointer to
+ a pointer to a pointer to ``int``),
+ and ${../if/typeof-refx:/params[1]/name} is either a pointer type
+ (possibly with qualifiers) or an expression of such a pointer type,
+ the macro ${../if/typeof-refx:/name} shall result in a type expression
+ which is the type of argument ${../if/typeof-refx:/params[1]/name}
+ with the given number of pointers removed.
+type: requirement
diff --git a/spec/rtems/basedefs/req/unreachable-0.yml b/spec/rtems/basedefs/req/unreachable-0.yml
new file mode 100644
index 00000000..fb30d41c
--- /dev/null
+++ b/spec/rtems/basedefs/req/unreachable-0.yml
@@ -0,0 +1,20 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/unreachable
+non-functional-type: interface
+rationale: |
+ The use of this macro will suppress some compiler warnings
+ and may permit some compiler optimizations.
+references: []
+requirement-type: non-functional
+text: |
+ When the code is compiled with the GNU C compiler,
+ and the ${../if/unreachable:/name} macro is placed in a part of
+ the code which control flow can under no circumstances ever reach,
+ the macro shall inform the compiler that this place in code
+ cannot be reached.
+type: requirement
diff --git a/spec/rtems/basedefs/req/unused-0.yml b/spec/rtems/basedefs/req/unused-0.yml
new file mode 100644
index 00000000..8b79965c
--- /dev/null
+++ b/spec/rtems/basedefs/req/unused-0.yml
@@ -0,0 +1,17 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/unused
+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/unused:/name} macro is attached to a function definition,
+ the ${../if/unused:/name} macro shall prevent the compiler from emitting
+ a warning if this function is not used.
+type: requirement
diff --git a/spec/rtems/basedefs/req/unused-1.yml b/spec/rtems/basedefs/req/unused-1.yml
new file mode 100644
index 00000000..5778e3a0
--- /dev/null
+++ b/spec/rtems/basedefs/req/unused-1.yml
@@ -0,0 +1,18 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/unused
+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/unused:/name} macro is appended to a label in this form:
+ ``<label>: ${../if/unused:/name};``,
+ the ${../if/unused:/name} macro shall prevent the compiler from emitting
+ a warning if this label is not used.
+type: requirement
diff --git a/spec/rtems/basedefs/req/unused-2.yml b/spec/rtems/basedefs/req/unused-2.yml
new file mode 100644
index 00000000..1172d2bc
--- /dev/null
+++ b/spec/rtems/basedefs/req/unused-2.yml
@@ -0,0 +1,18 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/unused
+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/unused:/name} macro is attached to a type
+ (including a union or a struct),
+ the ${../if/unused:/name} macro shall prevent the compiler from emitting
+ a warning if variables of this type are not used.
+type: requirement
diff --git a/spec/rtems/basedefs/req/unused-3.yml b/spec/rtems/basedefs/req/unused-3.yml
new file mode 100644
index 00000000..58f768ad
--- /dev/null
+++ b/spec/rtems/basedefs/req/unused-3.yml
@@ -0,0 +1,17 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/unused
+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/unused:/name} macro is attached to a variable definition,
+ the ${../if/unused:/name} macro shall prevent the compiler from emitting
+ a warning if this variable is not used.
+type: requirement
diff --git a/spec/rtems/basedefs/req/used-0.yml b/spec/rtems/basedefs/req/used-0.yml
new file mode 100644
index 00000000..ef0fc158
--- /dev/null
+++ b/spec/rtems/basedefs/req/used-0.yml
@@ -0,0 +1,19 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/used
+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/used:/name} is macro attached to
+ a function or ``static`` variable definition,
+ the macro shall cause the compiler to emit the
+ function implementation or variable storage even if
+ there is no reference from C code to the function or variable.
+type: requirement
diff --git a/spec/rtems/basedefs/req/warn-unused-result-0.yml b/spec/rtems/basedefs/req/warn-unused-result-0.yml
new file mode 100644
index 00000000..88afe7fd
--- /dev/null
+++ b/spec/rtems/basedefs/req/warn-unused-result-0.yml
@@ -0,0 +1,19 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/warn-unused-result
+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/warn-unused-result:/name} macro is used as last part
+ of a function declaration or attached to a function definition,
+ and that function has a return type other than ``void``,
+ and the returned value is not used,
+ the macro shall cause the compiler to show a compiler warning.
+type: requirement
diff --git a/spec/rtems/basedefs/req/weak-0.yml b/spec/rtems/basedefs/req/weak-0.yml
new file mode 100644
index 00000000..68dd0f94
--- /dev/null
+++ b/spec/rtems/basedefs/req/weak-0.yml
@@ -0,0 +1,20 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/weak
+non-functional-type: interface
+rationale: null
+references: []
+requirement-type: non-functional
+text: |
+ When the code is compiled with the GNU C compiler,
+ and the produced target file format is ELF or a.out,
+ and the ${../if/weak:/name} macro is part of a function definition
+ at global scope or variable definition at global scope,
+ and there is no other symbol at global scope with the same name as the
+ one of the above mentioned function or variable,
+ the macro shall have no observable effect.
+type: requirement
diff --git a/spec/rtems/basedefs/req/weak-1.yml b/spec/rtems/basedefs/req/weak-1.yml
new file mode 100644
index 00000000..00905569
--- /dev/null
+++ b/spec/rtems/basedefs/req/weak-1.yml
@@ -0,0 +1,29 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/weak
+non-functional-type: interface
+rationale: |
+ The other symbol with the same name can possibly be defined in
+ another compilation unit and linked with the compilation
+ unit containing the function or variable defined with ${../if/weak:/name}.
+references: []
+requirement-type: non-functional
+text: |
+ When the code is compiled with the GNU C compiler,
+ and the produced target file format is ELF or a.out,
+ and the ${../if/weak:/name} macro is part of a function definition
+ at global scope or variable definition at global scope,
+ and there is another symbol at global scope with the same name as the above
+ mentioned function or variable,
+ and this other symbol is not defined with the ${../if/weak:/name} macro or
+ otherwise defined or declared ``weak``,
+ and both functions or variables have the same type,
+ and in case of variables both variables have the same alignment and
+ storage size,
+ the macro shall cause the code to behave as if the function or variable
+ defined with the ${../if/weak:/name} macro does not exist.
+type: requirement
diff --git a/spec/rtems/basedefs/req/weak-alias-0.yml b/spec/rtems/basedefs/req/weak-alias-0.yml
new file mode 100644
index 00000000..2d0de8b2
--- /dev/null
+++ b/spec/rtems/basedefs/req/weak-alias-0.yml
@@ -0,0 +1,28 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/weak-alias
+non-functional-type: interface
+rationale: null
+references: []
+requirement-type: non-functional
+text: |
+ When the code is compiled with the GNU C compiler,
+ and the produced target file format is ELF or a.out,
+ and argument ${../if/weak-alias:/params[0]/name} is a name of a function,
+ and the macro ${../if/weak-alias:/name} call is in the same compilation unit
+ as the function,
+ and the macro is not used in block scope,
+ and the macro is used in this form:
+ ``<return-type> newname([argument-type-list]) ${../if/weak-alias:/name}(oldname)``;,
+ and the ``<return-type>`` and ``argument-type-list`` match the
+ signature of the function ``oldname``,
+ and there is no other function symbol at global scope with the same name as
+ ``newname``,
+ the ${../if/weak-alias:/name} macro shall cause the compiler to create
+ an additional name (``newname`` in the syntax) for the function
+ given as argument ${../if/weak-alias:/params[0]/name}.
+type: requirement
diff --git a/spec/rtems/basedefs/req/weak-alias-1.yml b/spec/rtems/basedefs/req/weak-alias-1.yml
new file mode 100644
index 00000000..b8d26585
--- /dev/null
+++ b/spec/rtems/basedefs/req/weak-alias-1.yml
@@ -0,0 +1,34 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/weak-alias
+non-functional-type: interface
+rationale: |
+ The other function at global scope with the same name as
+ ``newname`` can possibly be defined in
+ another compilation unit and linked with the compilation
+ unit containing the function defined with ${../if/weak-alias:/name}.
+references: []
+requirement-type: non-functional
+text: |
+ When the code is compiled with the GNU C compiler,
+ and the produced target file format is ELF or a.out,
+ and argument ${../if/weak-alias:/params[0]/name} is a name of a function,
+ and the macro ${../if/weak-alias:/name} call is in the same compilation unit
+ as the function,
+ and the macro is not used in block scope,
+ and the macro is used in this form:
+ ``<return-type> newname([argument-type-list]) ${../if/weak-alias:/name}(oldname)``;,
+ and the ``<return-type>`` and ``argument-type-list`` match the
+ signature of the function ``oldname``,
+ and there is another function symbol at global scope with the same name as
+ ``newname``,
+ and this other function is not defined with the ${../if/weak:/name} macro or
+ otherwise defined or declared ``weak``,
+ and both functions have the same type,
+ the ${../if/weak-alias:/name} macro shall cause the code to behave as if
+ the function defined with the ${../if/weak-alias:/name} macro does not exist.
+type: requirement
diff --git a/spec/rtems/basedefs/req/xconcat-0.yml b/spec/rtems/basedefs/req/xconcat-0.yml
new file mode 100644
index 00000000..6c20e8d6
--- /dev/null
+++ b/spec/rtems/basedefs/req/xconcat-0.yml
@@ -0,0 +1,19 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/xconcat
+non-functional-type: interface
+rationale: |
+ All possible C pre-processor substitutions include here
+ calls to the macro itself as well as none if no substitution is
+ possible.
+references: []
+requirement-type: non-functional
+text: |
+ The macro ${../if/xconcat:/name} shall apply all possible C
+ pre-processor substitutions to its argument values
+ before it concatenates the resulting values.
+type: requirement
diff --git a/spec/rtems/basedefs/req/xconcat-1.yml b/spec/rtems/basedefs/req/xconcat-1.yml
new file mode 100644
index 00000000..b0c9e2ab
--- /dev/null
+++ b/spec/rtems/basedefs/req/xconcat-1.yml
@@ -0,0 +1,17 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/xconcat
+non-functional-type: interface
+rationale: null
+references: []
+requirement-type: non-functional
+text: |
+ The macro ${../if/xconcat:/name} shall result
+ in the substituted argument values textually concatenated
+ in the order ${../if/xconcat:/params[0]/name} left and
+ ${../if/xconcat:/params[1]/name} right.
+type: requirement
diff --git a/spec/rtems/basedefs/req/xconcat-2.yml b/spec/rtems/basedefs/req/xconcat-2.yml
new file mode 100644
index 00000000..b8c640a9
--- /dev/null
+++ b/spec/rtems/basedefs/req/xconcat-2.yml
@@ -0,0 +1,18 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/xconcat
+non-functional-type: interface
+rationale: |
+ There should be no additional character before, between or after the
+ arguments in the result.
+references: []
+requirement-type: non-functional
+text: |
+ The macro ${../if/xconcat:/name} shall result in only those
+ characters which also appear in its argument values
+ after applying all possible C pre-processor substitutions to them.
+type: requirement
diff --git a/spec/rtems/basedefs/req/xconcat-3.yml b/spec/rtems/basedefs/req/xconcat-3.yml
new file mode 100644
index 00000000..0073ee57
--- /dev/null
+++ b/spec/rtems/basedefs/req/xconcat-3.yml
@@ -0,0 +1,15 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/xconcat
+non-functional-type: interface
+rationale: null
+references: []
+requirement-type: non-functional
+text: |
+ The macro ${../if/xconcat:/name} shall make its result
+ subject to C pre-processor substitutions.
+type: requirement
diff --git a/spec/rtems/basedefs/req/xstring-0.yml b/spec/rtems/basedefs/req/xstring-0.yml
new file mode 100644
index 00000000..48e86591
--- /dev/null
+++ b/spec/rtems/basedefs/req/xstring-0.yml
@@ -0,0 +1,20 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/xstring
+non-functional-type: interface
+rationale: |
+ The exact rules on how this string is build are defined by the C
+ standard and are too complex to be repeated in this requirement.
+references: []
+requirement-type: non-functional
+text: |
+ The macro ${../if/xstring:/name} shall apply all possible C
+ pre-processor substitutions to its argument value before
+ the result of this substitution is converted to a
+ a string formed by the C pre-processor ``#`` operator and
+ the macro results in this string.
+type: requirement
diff --git a/spec/rtems/basedefs/req/zero-length-array-0.yml b/spec/rtems/basedefs/req/zero-length-array-0.yml
new file mode 100644
index 00000000..9f45ca50
--- /dev/null
+++ b/spec/rtems/basedefs/req/zero-length-array-0.yml
@@ -0,0 +1,44 @@
+SPDX-License-Identifier: CC-BY-SA-4.0
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links:
+- role: requirement-refinement
+ uid: ../if/zero-length-array
+non-functional-type: interface
+rationale: |
+ From GNU C documentation:
+
+ Although the size of a zero-length array is zero, an array member of this
+ kind may increase the size of the enclosing type as a result of tail padding.
+
+ Example::
+
+ struct line
+ {
+ int length;
+ char contents[RTEMS_ZERO_LENGTH_ARRAY];
+ };
+
+ struct line *thisline = (struct line *)
+ malloc (sizeof (struct line) + this_length);
+ thisline->length = this_length;
+
+ Zero-length arrays and especially objects ending with zero-length arrays
+ can be statically initialized so that they are larger than declared (have more
+ that 0 elements). See the documentation of the GNU C compiler
+ below keyword: *arrays of length zero*.
+references: []
+requirement-type: non-functional
+text: |
+ When the code is compiled with the GNU C compiler,
+ and the ${../if/zero-length-array:/name} macro is used as
+ element count of an array declaration,
+ and that array declaration is the last member of a ``struct`` that is
+ otherwise non-empty,
+ and that structure is never used as member of another structure or
+ array,
+ the macro shall cause the compiler to layout the structure as if the
+ array had an element count of one but to reduce the total size
+ of the structure by the size of that one array element.
+type: requirement
diff --git a/spec/rtems/basedefs/val/basedefs.yml b/spec/rtems/basedefs/val/basedefs.yml
new file mode 100644
index 00000000..05536ff8
--- /dev/null
+++ b/spec/rtems/basedefs/val/basedefs.yml
@@ -0,0 +1,1688 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+links: []
+test-actions:
+
+# ---- RTEMS_ALIAS ----
+
+- action: |
+ int alias_result;
+ alias_result = ori_func( 3 ) + alias_func( 5 );
+ checks:
+ - check: |
+ T_step_eq_int( ${step}, alias_result, 16 );
+ description: |
+ Check that ori_func() and alias_func() are the same function.
+ links:
+ - role: validation
+ uid: ../req/alias-0
+ description: |
+ Use the ${../if/alias:/name}() macro.
+ links: []
+
+# ---- RTEMS_ALIGN_DOWN ----
+
+- action: |
+ int align_down0_result;
+ int align_down1_result;
+ int align_down2_result;
+ int align_down3_result;
+ int align_down4_result;
+ int align_down5_result;
+ int align_down6_result;
+ int align_down7_result;
+ int align_down8_result;
+ int align_down9_result;
+
+ align_down0_result = RTEMS_ALIGN_DOWN( 0, 1 );
+ align_down1_result = RTEMS_ALIGN_DOWN( 0, 4 );
+ align_down2_result = RTEMS_ALIGN_DOWN( 1, 2 );
+ align_down3_result = RTEMS_ALIGN_DOWN( 2, 2 );
+ align_down4_result = RTEMS_ALIGN_DOWN( 3, 2 );
+ align_down5_result = RTEMS_ALIGN_DOWN( 4, 2 );
+ align_down6_result = RTEMS_ALIGN_DOWN( 5, 2 );
+ align_down7_result = RTEMS_ALIGN_DOWN( 255, 16 );
+ align_down8_result = RTEMS_ALIGN_DOWN( 256, 16 );
+ align_down9_result = RTEMS_ALIGN_DOWN( 257, 16 );
+ checks:
+ - check: |
+ T_step_eq_int( ${step}, align_down0_result, 0 );
+ T_step_eq_int( ${step}, align_down1_result, 0 );
+ T_step_eq_int( ${step}, align_down2_result, 0 );
+ T_step_eq_int( ${step}, align_down3_result, 2 );
+ T_step_eq_int( ${step}, align_down4_result, 2 );
+ T_step_eq_int( ${step}, align_down5_result, 4 );
+ T_step_eq_int( ${step}, align_down6_result, 4 );
+ T_step_eq_int( ${step}, align_down7_result, 240 );
+ T_step_eq_int( ${step}, align_down8_result, 256 );
+ T_step_eq_int( ${step}, align_down9_result, 256 );
+ description: |
+ Check that ${../if/align-down:/name}() calculates the expected result
+ and is side-effect free.
+ links:
+ - role: validation
+ uid: ../req/align-down-0
+ description: |
+ Use the ${../if/align-down:/name}() macro in various examples.
+ links: []
+
+# ---- RTEMS_ALIGN_UP ----
+
+- action: |
+ int align_up0_result;
+ int align_up1_result;
+ int align_up2_result;
+ int align_up3_result;
+ int align_up4_result;
+ int align_up5_result;
+ int align_up6_result;
+ int align_up7_result;
+ int align_up8_result;
+ int align_up9_result;
+
+ align_up0_result = RTEMS_ALIGN_UP( 0, 1 );
+ align_up1_result = RTEMS_ALIGN_UP( 0, 4 );
+ align_up2_result = RTEMS_ALIGN_UP( 1, 2 );
+ align_up3_result = RTEMS_ALIGN_UP( 2, 2 );
+ align_up4_result = RTEMS_ALIGN_UP( 3, 2 );
+ align_up5_result = RTEMS_ALIGN_UP( 4, 2 );
+ align_up6_result = RTEMS_ALIGN_UP( 5, 2 );
+ align_up7_result = RTEMS_ALIGN_UP( 255, 16 );
+ align_up8_result = RTEMS_ALIGN_UP( 256, 16 );
+ align_up9_result = RTEMS_ALIGN_UP( 257, 16 );
+ checks:
+ - check: |
+ T_step_eq_int( ${step}, align_up0_result, 0 );
+ T_step_eq_int( ${step}, align_up1_result, 0 );
+ T_step_eq_int( ${step}, align_up2_result, 2 );
+ T_step_eq_int( ${step}, align_up3_result, 2 );
+ T_step_eq_int( ${step}, align_up4_result, 4 );
+ T_step_eq_int( ${step}, align_up5_result, 4 );
+ T_step_eq_int( ${step}, align_up6_result, 6 );
+ T_step_eq_int( ${step}, align_up7_result, 256 );
+ T_step_eq_int( ${step}, align_up8_result, 256 );
+ T_step_eq_int( ${step}, align_up9_result, 272 );
+ description: |
+ Check that ${../if/align-up:/name}() calculates the expected result
+ and is side-effect free.
+ links:
+ - role: validation
+ uid: ../req/align-up-0
+ description: |
+ Use the ${../if/align-up:/name}() macro in various examples.
+ links: []
+
+# ---- RTEMS_ALIGNED ----
+
+- action: |
+ char unaligned_var = 'c';
+ char aligned_var RTEMS_ALIGNED( 8 ) = 'd';
+ alias_result = ori_func( 3 ) + alias_func( 5 );
+ (void) unaligned_var;
+ checks:
+ - check: |
+ T_step_eq_int( ${step}, ( ( uintptr_t ) &aligned_var ) % 8, 0 );
+ T_step_eq_int( ${step},
+ offsetof( aligned_member_struct, aligned_member ) % 8, 0 );
+ description: |
+ Check that ${../if/aligned:/name}() correctly aligns a variable on the stack
+ and a structure member.
+ links:
+ - role: validation
+ uid: ../req/aligned-0
+ description: |
+ Use the ${../if/aligned:/name}() macro.
+ links: []
+
+# ---- RTEMS_ALLOC_ALIGN ----
+
+- action: |
+ void *free_ptr;
+ void *alloc_align_ptr;
+ alloc_align_ptr = basedefs_alloc_align_func( 1024, &free_ptr, 64 );
+ basedefs_free( free_ptr );
+ checks:
+ - check: |
+ T_step_not_null( ${step}, alloc_align_ptr );
+ T_step_eq_int( ${step}, ( ( uintptr_t ) alloc_align_ptr ) % 64, 0 );
+ T_step_ge_uptr( ${step}, ( ( uintptr_t ) alloc_align_ptr ),
+ ( ( uintptr_t ) free_ptr ) );
+ T_step_lt_uptr( ${step}, ( ( uintptr_t ) alloc_align_ptr ),
+ ( ( uintptr_t ) free_ptr ) + 64 );
+ description: |
+ It cannot be checked that the ${../if/alloc-align:/name}() macro has
+ the desired effect. Yet, the check confirms that such a macro exists and
+ that it can be used on such a memory function and that the
+ argument counting starts at 1.
+ links:
+ - role: validation
+ uid: ../req/alloc-align-0
+ description: |
+ Use a function declared with the ${../if/alloc-align:/name}() macro.
+ links: []
+
+# ---- RTEMS_ALLOC_SIZE ----
+
+- action: |
+ void *alloc_size_ptr;
+ alloc_size_ptr = basedefs_alloc_size_func( 1024 );
+ basedefs_free( alloc_size_ptr );
+ checks:
+ - check: |
+ T_step_not_null( ${step}, alloc_size_ptr );
+ description: |
+ It cannot be checked that the ${../if/alloc-size:/name}() macro has
+ the desired effect. Yet, the check confirms that such a macro exists and
+ that it can be used on such a memory function and that the
+ argument counting starts at 1.
+ links:
+ - role: validation
+ uid: ../req/alloc-size-0
+ description: |
+ Use a function declared with the ${../if/alloc-size:/name}() macro.
+ links: []
+
+# ---- RTEMS_ALLOC_SIZE_2 ----
+
+- action: |
+ void *alloc_size_2_ptr;
+ alloc_size_2_ptr = basedefs_alloc_size_2_func( 8, 128 );
+ basedefs_free( alloc_size_2_ptr );
+ checks:
+ - check: |
+ T_step_not_null( ${step}, alloc_size_2_ptr );
+ description: |
+ It cannot be checked that the ${../if/alloc-size-2:/name}() macro has
+ the desired effect. Yet, the check confirms that such a macro exists and
+ that it can be used on such a memory function and that the
+ argument counting starts at 1.
+ links:
+ - role: validation
+ uid: ../req/alloc-size-2-0
+ description: |
+ Use a function declared with the ${../if/alloc-size-2:/name}() macro.
+ links: []
+
+# ---- RTEMS_ARRAY_SIZE ----
+
+- action: |
+ int array[] = { 10, 20, 30, 40, 50 };
+ unsigned char array2[12];
+ int array_size = RTEMS_ARRAY_SIZE(array);
+ int array2_size = RTEMS_ARRAY_SIZE(array2);
+ checks:
+ - check: |
+ T_step_eq_sz( ${step}, array_size, 5 );
+ T_step_eq_sz( ${step}, array2_size, 12 );
+ description: |
+ Check that the calculated size of the arrays fit their definition.
+ links:
+ - role: validation
+ uid: ../req/array-size-0
+ description: |
+ Use the ${../if/array-size:/name}() macro.
+ links: []
+
+# ---- RTEMS_COMPILER_DEPRECATED_ATTRIBUTE ----
+
+- action: |
+ int compiler_deprecated_attribute RTEMS_COMPILER_DEPRECATED_ATTRIBUTE = 42;
+ checks:
+ - check: |
+ /*
+ * Derivation from Coding Style:
+ * The following code suppresses a compiler warning (instead of fixing
+ * it).
+ * Rational: The variable compiler_deprecated_attribute is not really
+ * deprecated but its purpose is to test the RTEMS_DEPRECATED macro.
+ * The RTEMS_DEPRECATED macro must result in a compiler warning here.
+ */
+ _Pragma( "GCC diagnostic push" )
+ _Pragma( "GCC diagnostic ignored \"-Wdeprecated-declarations\"" )
+ T_step_eq_int( ${step}, compiler_deprecated_attribute, 42 );
+ _Pragma( "GCC diagnostic pop" )
+ description: |
+ It cannot automatically be checked that the
+ ${../if/compiler-deprecated-attribute:/name}() macro has the desired
+ effect. The gcc compiler should issue a warning about the use of a
+ deprecated variable on the above line
+ where the ``compiler_deprecated_attribute`` is used.
+ links:
+ - role: validation
+ uid: ../req/compiler-deprecated-attribute-0
+ description: |
+ Use the ${../if/compiler-deprecated-attribute:/name} macro.
+ links: []
+
+# ---- RTEMS_COMPILER_MEMORY_BARRIER ----
+
+- action: |
+ RTEMS_COMPILER_MEMORY_BARRIER();
+ checks:
+ - check: ''
+ description: |
+ It cannot be checked that the
+ ${../if/compiler-memory-barrier:/name} macro has the desired
+ effect. It is only checked that such a macro exists.
+ links:
+ - role: validation
+ uid: ../req/compiler-memory-barrier-0
+ description: |
+ Use the ${../if/compiler-memory-barrier:/name} macro.
+ links: []
+
+# ---- RTEMS_COMPILER_NO_RETURN_ATTRIBUTE ----
+
+- action: |
+ (void) compiler_no_return_attribute_func;
+ checks:
+ - check: ''
+ description: |
+ It cannot be checked that the
+ ${../if/compiler-no-return-attribute:/name} macro has the desired
+ effect. It is only checked that such a macro exists.
+ links:
+ - role: validation
+ uid: ../req/compiler-no-return-attribute-0
+ description: |
+ Use of the ${../if/compiler-no-return-attribute:/name} macro at the
+ beginning of this file.
+ links: []
+
+# ---- RTEMS_COMPILER_PACKED_ATTRIBUTE ----
+
+- action: |
+ typedef struct {
+ uint8_t c;
+ RTEMS_COMPILER_PACKED_ATTRIBUTE uint32_t i;
+ } compiler_packed_attribute_struct;
+ int compiler_packed_attribute_offset =
+ offsetof( compiler_packed_attribute_struct, i );
+ checks:
+ - check: |
+ T_step_eq_int( ${step}, compiler_packed_attribute_offset, 1 );
+ description: |
+ Check that ${../if/compiler-packed-attribute:/name}() correctly aligns
+ a structure member.
+ links:
+ - role: validation
+ uid: ../req/compiler-packed-attribute-0
+ description: |
+ Use the ${../if/compiler-packed-attribute:/name} macro.
+ links: []
+
+# ---- RTEMS_COMPILER_PURE_ATTRIBUTE ----
+
+- action: |
+ int compiler_pure_attribute_result;
+ int compiler_pure_attribute_result_2;
+ compiler_pure_attribute_result = compiler_pure_attribute_func();
+ compiler_pure_attribute_result_2 =
+ compiler_pure_attribute_func();
+ checks:
+ - check: |
+ T_step_eq_int( ${step}, compiler_pure_attribute_result, 21 );
+ T_step_eq_int( ${step}, compiler_pure_attribute_result_2, 21 );
+ description: |
+ It cannot be checked that the ${../if/compiler-pure-attribute:/name}
+ macro has the desired effect. It is checked that such a macro exists.
+ links:
+ - role: validation
+ uid: ../req/compiler-pure-attribute-0
+ description: |
+ Use the ${../if/compiler-pure-attribute:/name} macro at the beginning
+ of this file.
+ links: []
+
+# ---- RTEMS_COMPILER_UNUSED_ATTRIBUTE ----
+
+- action: |
+ int compiler_unused_attribute_var RTEMS_COMPILER_UNUSED_ATTRIBUTE;
+ checks:
+ - check: ''
+ description: |
+ It cannot automatically be checked that the
+ ${../if/compiler-unused-attribute:/name}
+ macro has the desired effect. It is checked that such a macro exists
+ and one can manually check that no compiler warnings are produced
+ for the compiler_unused_attribute_var.
+ links:
+ - role: validation
+ uid: ../req/compiler-unused-attribute-0
+ description: |
+ Use the ${../if/compiler-unused-attribute:/name} macro.
+ links: []
+
+# ---- RTEMS_CONCAT ----
+
+- action: |
+ int concat0_result;
+ int concat1_result;
+ concat0_result = RTEMS_CONCAT( con, cat )();
+ concat1_result = RTEMS_CONCAT( abc, cat )();
+ checks:
+ - check: |
+ T_step_eq_int( ${step}, concat0_result, 91 );
+ description: |
+ Check that the two arguments of ${../if/concat:/name}() are concatenated to a
+ new token.
+ links:
+ - role: validation
+ uid: ../req/concat-0
+ - role: validation
+ uid: ../req/concat-1
+ - check: |
+ T_step_eq_int( ${step}, concat1_result, 91 );
+ description: |
+ Check that the result of the ${../if/concat:/name}() expansion is subject to
+ a further pre-processor substitution.
+ links:
+ - role: validation
+ uid: ../req/concat-2
+ description: |
+ Invoke the ${../if/concat:/name}() macro on examples.
+ links: []
+
+# ---- RTEMS_CONST ----
+
+- action: |
+ int const_result;
+ int const_result_2;
+ const_result = const_func( 7 );
+ const_result_2 = const_func( 7 );
+ checks:
+ - check: |
+ T_step_eq_int( ${step}, const_result, 28 );
+ T_step_eq_int( ${step}, const_result_2, 28 );
+ description: |
+ It cannot be checked that the ${../if/const:/name}
+ macro has the desired effect. It is checked that such a macro exists.
+ links:
+ - role: validation
+ uid: ../req/const-0
+ description: |
+ Use the ${../if/const:/name} macro at the beginning of this file.
+ links: []
+
+# ---- RTEMS_CONTAINER_OF ----
+
+- action: |
+ typedef struct {
+ int a;
+ int b;
+ } container_of_struct;
+
+ container_of_struct container_of_struct_var;
+ int *container_of_struct_b_adr = &container_of_struct_var.b;
+ container_of_struct *container_of_struct_adr;
+ container_of_struct_adr =
+ RTEMS_CONTAINER_OF( container_of_struct_b_adr, container_of_struct, b );
+ checks:
+ - check: |
+ T_step_eq_ptr( ${step},
+ container_of_struct_adr, &container_of_struct_var );
+ description: |
+ Check that the ${../if/container-of:/name}
+ macro evaluates to a pointer to container_of_struct_var.
+ links:
+ - role: validation
+ uid: ../req/container-of-0
+ description: |
+ Use the ${../if/container-of:/name} macro.
+ links: []
+
+# ---- RTEMS_DECLARE_GLOBAL_SYMBOL ----
+
+- action: |
+ /* No action */
+ checks:
+ - check: |
+ T_step_eq_int( ${step}, basedefs_get_global_symbol(), 0xabc );
+ description: |
+ Check that the ${../if/declare-global-symbol:/name}
+ macro declares a global symbol which can be accessed by function
+ basedefs_get_global_symbol() which is defined in a file
+ different from the file in which the gobal symbol is defined.
+ links:
+ - role: validation
+ uid: ../req/declare-global-symbol-0
+ description: |
+ Use the ${../if/declare-global-symbol:/name} macro in the
+ file tc-basedefs-pendant.h.
+ links: []
+
+# ---- RTEMS_DECONST ----
+
+- action: |
+ const int deconst_array[] = { 52, 55 };
+ int *deconst_pointer;
+ deconst_pointer = RTEMS_DECONST( int *, deconst_array );
+ checks:
+ - check: |
+ T_step_eq_int( ${step}, deconst_pointer[0], 52 );
+ T_step_eq_int( ${step}, deconst_pointer[1], 55 );
+ deconst_pointer[1] = 13;
+ T_step_eq_int( ${step}, deconst_pointer[1], 13 );
+ description: |
+ Check that the ${../if/deconst:/name} macro returns a pointer
+ which allows to write into an otherwise const value.
+ links:
+ - role: validation
+ uid: ../req/deconst-0
+ description: |
+ Use the ${../if/deconst:/name} macro.
+ links: []
+
+# ---- RTEMS_DEFINE_GLOBAL_SYMBOL ----
+
+- action: |
+ /* No action */
+ checks:
+ - check: |
+ T_step_eq_int( ${step}, (uintptr_t) global_symbol, 0xabc );
+ description: |
+ Check that the ${../if/define-global-symbol:/name}
+ macro defines a global symbol with the correct value.
+ links:
+ - role: validation
+ uid: ../req/define-global-symbol-0
+ - role: validation
+ uid: ../req/define-global-symbol-1
+ description: |
+ Use the ${../if/define-global-symbol:/name} macro at the
+ beginning of this file.
+ links: []
+
+# ---- RTEMS_DEPRECATED ----
+
+- action: |
+ int deprecated_result;
+ /*
+ * Derivation from Coding Style:
+ * The following code suppresses a compiler warning (instead of fixing it).
+ * Rational: The function deprecated_func() is not really deprecated
+ * but its purpose is to test the RTEMS_DEPRECATED macro.
+ * The RTEMS_DEPRECATED macro must result in a compiler warning here.
+ */
+ _Pragma( "GCC diagnostic push" )
+ _Pragma( "GCC diagnostic ignored \"-Wdeprecated-declarations\"" )
+ deprecated_result = deprecated_func( 5 );
+ _Pragma( "GCC diagnostic pop" )
+ checks:
+ - check: |
+ T_step_eq_int( ${step}, deprecated_result, 15 );
+ description: |
+ It cannot automatically be checked that the
+ ${../if/deprecated:/name} macro has the desired
+ effect. The gcc compiler should issue a warning about the use of a
+ deprecated function on the above line
+ where the ``deprecated_func`` is used.
+ links:
+ - role: validation
+ uid: ../req/deprecated-0
+ description: |
+ Use a function declared with the ${../if/deprecated:/name}() macro.
+ links: []
+
+# ---- RTEMS_DEQUALIFY_DEPTHX ----
+
+- action: |
+ const volatile int dequalify_depthx_array[] = { 52, 55 };
+ const char dequalify_depthx_var = 'a';
+ const char *dequalify_depthx_one_pointer = &dequalify_depthx_var;
+ const char **dequalify_depthx_two_pointer =
+ &dequalify_depthx_one_pointer;
+ int *dequalify_depthx_pointer;
+ volatile char **dequalify_depthx_twice_pointer;
+ dequalify_depthx_pointer =
+ RTEMS_DEQUALIFY_DEPTHX( *, int *, dequalify_depthx_array );
+ dequalify_depthx_twice_pointer = RTEMS_DEQUALIFY_DEPTHX(
+ **, volatile char **, dequalify_depthx_two_pointer );
+ checks:
+ - check: |
+ T_step_eq_int( ${step}, dequalify_depthx_pointer[0], 52 );
+ T_step_eq_int( ${step}, dequalify_depthx_pointer[1], 55 );
+ dequalify_depthx_pointer[0] = 13;
+ T_step_eq_int( ${step}, dequalify_depthx_pointer[0], 13 );
+ T_step_eq_char( ${step}, **dequalify_depthx_twice_pointer, 'a' );
+ **dequalify_depthx_twice_pointer = 'Z';
+ T_step_eq_char( ${step}, **dequalify_depthx_twice_pointer, 'Z' );
+ description: |
+ Check that the ${../if/dequalify-depthx:/name} macro returns a pointer
+ which allows to write into an otherwise const (volatile) value.
+ links:
+ - role: validation
+ uid: ../req/dequalify-depthx-0
+ description: |
+ Use the ${../if/dequalify-depthx:/name} macro.
+ links: []
+
+# ---- RTEMS_DEQUALIFY ----
+
+- action: |
+ const volatile int dequalify_array[] = { 52, 55 };
+ int *dequalify_pointer;
+ dequalify_pointer = RTEMS_DECONST( int *, dequalify_array );
+ checks:
+ - check: |
+ T_step_eq_int( ${step}, dequalify_pointer[0], 52 );
+ T_step_eq_int( ${step}, dequalify_pointer[1], 55 );
+ dequalify_pointer[0] = 13;
+ T_step_eq_int( ${step}, dequalify_pointer[0], 13 );
+ description: |
+ Check that the ${../if/dequalify:/name} macro returns a pointer
+ which allows to write into an otherwise const volatile value.
+ links:
+ - role: validation
+ uid: ../req/dequalify-0
+ description: |
+ Use the ${../if/dequalify:/name} macro.
+ links: []
+
+# ---- RTEMS_DEVOLATILE ----
+
+- action: |
+ volatile int devolatile_array[] = { 52, 55 };
+ int *devolatile_pointer;
+ devolatile_pointer = RTEMS_DEVOLATILE( int *, devolatile_array );
+ checks:
+ - check: |
+ T_step_eq_int( ${step}, devolatile_pointer[0], 52 );
+ T_step_eq_int( ${step}, devolatile_pointer[1], 55 );
+ devolatile_pointer[1] = 13;
+ T_step_eq_int( ${step}, devolatile_pointer[1], 13 );
+ description: |
+ Check that the ${../if/devolatile:/name} macro returns a pointer
+ which allows to write into an otherwise volatile value.
+ links:
+ - role: validation
+ uid: ../req/devolatile-0
+ description: |
+ Use the ${../if/devolatile:/name} macro.
+ links: []
+
+# ---- RTEMS_EXPAND ----
+
+- action: |
+ int expand_result;
+ expand_result = RTEMS_EXPAND( EXPAND )();
+ checks:
+ - check: |
+ T_step_eq_int( ${step}, expand_result, 82 );
+ description: |
+ Check that the argument of ${../if/expand:/name}() is expanded and
+ returned.
+ links:
+ - role: validation
+ uid: ../req/expand-0
+ description: |
+ Invoke the ${../if/expand:/name}() macro on an example.
+ links: []
+
+# ---- RTEMS_FALSE ----
+
+- action: |
+ char *false_result;
+ false_result = _TO_STR( FALSE );
+ checks:
+ - check: |
+ T_step_eq_str( ${step}, false_result, "0" );
+ description: |
+ Check that of ${../if/false:/name} is substituted by 0.
+ links:
+ - role: validation
+ uid: ../req/false-0
+ description: |
+ Invoke the ${../if/false:/name}() macro on an example.
+ links: []
+
+# ---- RTEMS_HAVE_MEMBER_SAME_TYPE ----
+
+- action: |
+ typedef union {
+ short s;
+ int **i;
+ char *c;
+ int a[5];
+ } same_type_union;
+ typedef struct {
+ const short u;
+ short v;
+ int *w;
+ char *x;
+ volatile int y[5];
+ int z;
+ } same_type_struct;
+ int same_type_result_0 = RTEMS_HAVE_MEMBER_SAME_TYPE(
+ same_type_union, s, same_type_struct, v );
+ int same_type_result_1 = RTEMS_HAVE_MEMBER_SAME_TYPE(
+ same_type_union, s, same_type_struct, z );
+ int same_type_result_2 = RTEMS_HAVE_MEMBER_SAME_TYPE(
+ same_type_union, i, same_type_struct, w );
+ int same_type_result_3 = RTEMS_HAVE_MEMBER_SAME_TYPE(
+ same_type_union, c, same_type_struct, x );
+ int same_type_result_4 = RTEMS_HAVE_MEMBER_SAME_TYPE(
+ same_type_union, a, same_type_struct, y );
+ int same_type_result_5 = RTEMS_HAVE_MEMBER_SAME_TYPE(
+ same_type_union, s, same_type_union, s );
+ int same_type_result_6 = RTEMS_HAVE_MEMBER_SAME_TYPE(
+ same_type_union, i, same_type_union, i );
+ int same_type_result_7 = RTEMS_HAVE_MEMBER_SAME_TYPE(
+ same_type_union, s, same_type_struct, y );
+ int same_type_result_8 = RTEMS_HAVE_MEMBER_SAME_TYPE(
+ same_type_union, a, same_type_struct, w );
+ int same_type_result_9 = RTEMS_HAVE_MEMBER_SAME_TYPE(
+ same_type_union, s, same_type_struct, u );
+ checks:
+ - check: |
+ T_step_eq_int( ${step}, same_type_result_0, 1 );
+ T_step_eq_int( ${step}, same_type_result_1, 0 );
+ T_step_eq_int( ${step}, same_type_result_2, 0 );
+ T_step_eq_int( ${step}, same_type_result_3, 1 );
+ T_step_eq_int( ${step}, same_type_result_4, 1 );
+ T_step_eq_int( ${step}, same_type_result_5, 1 );
+ T_step_eq_int( ${step}, same_type_result_6, 1 );
+ T_step_eq_int( ${step}, same_type_result_7, 0 );
+ T_step_eq_int( ${step}, same_type_result_8, 0 );
+ T_step_eq_int( ${step}, same_type_result_9, 1 );
+ description: |
+ Check that of ${../if/have-member-same-type:/name} returns 0 and 1
+ depending on whether these types are compatible.
+ links:
+ - role: validation
+ uid: ../req/have-member-same-type-0
+ description: |
+ Invoke the ${../if/have-member-same-type:/name}() macro on examples.
+ links: []
+
+# ---- RTEMS_INLINE_ROUTINE ----
+
+- action: |
+ const int inline_routine_step = ${step};
+ int inline_routine_result;
+ char *inline_routine_text;
+ inline_routine_result = inline_routine_func( 3 );
+ inline_routine_text = _TO_STR( RTEMS_INLINE_ROUTINE );
+ checks:
+ - check: |
+ if( 0 == strcmp( "static inline", inline_routine_text ) ) {
+ T_step_eq_str( inline_routine_step,
+ inline_routine_text, "static inline" );
+ } else {
+ T_step_eq_str( inline_routine_step,
+ inline_routine_text, "static __inline__" );
+ }
+ T_step_eq_int( ${step}, inline_routine_result, 8 );
+ description: |
+ Check that the ${../if/inline-routine:/name} exists
+ and that it produces the desired text.
+ links:
+ - role: validation
+ uid: ../req/inline-routine-0
+ description: |
+ Use the ${../if/inline-routine:/name} in the definition of function
+ inline_routine_func() at the beginning of this file. Obtain the text
+ the macro ${../if/inline-routine:/name} produces.
+ links: []
+
+# ---- RTEMS_MALLOCLIKE ----
+
+- action: |
+ void *malloclike_ptr;
+ /*
+ * If this code is not compiled using GNU C, I still have to run a check
+ * to avoid trouble with the {step} counter of the checks.
+ */
+ const char *malloclike_text = "__attribute__((__malloc__))";
+ malloclike_ptr = basedefs_malloclike_func( 102 );
+ basedefs_free( malloclike_ptr );
+ #if defined( __GNUC__ )
+ malloclike_text = remove_white_space( _TO_STR( RTEMS_MALLOCLIKE ) );
+ #endif
+ checks:
+ - check: |
+ T_step_not_null( ${step}, malloclike_ptr );
+ T_step_eq_str( ${step}, malloclike_text, "__attribute__((__malloc__))" );
+ description: |
+ It cannot be checked that the ${../if/malloclike:/name} macro has
+ the desired effect. Yet, the check confirms that such a macro exists and
+ that it can be used on such a memory function and that it produces
+ the correct code.
+ links:
+ - role: validation
+ uid: ../req/malloclike-0
+ description: |
+ Use a function declared with the ${../if/malloclike:/name}() macro.
+ links: []
+
+# ---- RTEMS_NO_INLINE ----
+
+- action: |
+ int no_inline_result;
+ /*
+ * If this code is not compiled using GNU C, I still have to run a check
+ * to avoid trouble with the {step} counter of the checks.
+ */
+ const char *no_inline_text = "__attribute__((__noinline__))";
+ no_inline_result = no_inline_func();
+ #if defined( __GNUC__ )
+ no_inline_text = remove_white_space( _TO_STR( RTEMS_NO_INLINE ) );
+ #endif
+ checks:
+ - check: |
+ T_step_eq_int( ${step}, no_inline_result, 75 );
+ T_step_eq_str( ${step}, no_inline_text, "__attribute__((__noinline__))" );
+ description: |
+ It cannot be checked that the ${../if/no-inline:/name} macro has
+ the desired effect. Yet, the check confirms that such a macro exists and
+ that it can be used on such a function and that it produces
+ the correct code.
+ links:
+ - role: validation
+ uid: ../req/no-inline-0
+ description: |
+ Use a function declared with the ${../if/no-inline:/name}() macro.
+ links: []
+
+# ---- RTEMS_NO_RETURN ----
+
+- action: |
+ (void) no_return_func;
+ checks:
+ - check: ''
+ description: |
+ It cannot be checked that the
+ ${../if/no-return:/name} macro has the desired
+ effect. It is only checked that such a macro exists.
+ links:
+ - role: validation
+ uid: ../req/no-return-0
+ description: |
+ Use of the ${../if/no-return:/name} macro at the beginning of this file.
+ links: []
+
+# ---- RTEMS_OBFUSCATE_VARIABLE ----
+
+- action: |
+ short obfuscate_variable = 66;
+ RTEMS_OBFUSCATE_VARIABLE( obfuscate_variable );
+ checks:
+ - check: |
+ T_step_eq_int( ${step}, obfuscate_variable, 66 );
+ description: |
+ It cannot be checked that the ${../if/obfuscate-variable:/name}
+ macro has the desired effect. Yet, the check confirms that such a
+ macro exists and can be used.
+ links:
+ - role: validation
+ uid: ../req/obfuscate-variable-0
+ description: |
+ Use the ${../if/obfuscate-variable:/name}() macro.
+ links: []
+
+# ---- RTEMS_PACKED ----
+
+- action: |
+ int packed_offset;
+ int packed_full_i_offset;
+ int packed_full_j_offset;
+ int packed_enum_size;
+ typedef struct {
+ uint8_t c;
+ RTEMS_PACKED uint32_t i;
+ } packed_struct;
+ typedef struct RTEMS_PACKED {
+ uint8_t c;
+ uint32_t i;
+ uint32_t j;
+ } packed_full_struct;
+ typedef enum RTEMS_PACKED {
+ red = 1,
+ green,
+ yellow,
+ blue = 255
+ } packed_enum;
+ packed_offset = offsetof( packed_struct, i );
+ packed_full_i_offset = offsetof( packed_full_struct, i );
+ packed_full_j_offset = offsetof( packed_full_struct, j );
+ packed_enum_size = sizeof( packed_enum );
+ checks:
+ - check: |
+ T_step_eq_int( ${step}, packed_offset, 1 );
+ description: |
+ Check that ${../if/packed:/name}() correctly aligns a structure member.
+ links:
+ - role: validation
+ uid: ../req/packed-0
+ - check: |
+ T_step_eq_int( ${step}, packed_full_i_offset, 1 );
+ T_step_eq_int( ${step}, packed_full_j_offset, 5 );
+ description: |
+ Check that ${../if/packed:/name}() correctly aligns all structure members.
+ links:
+ - role: validation
+ uid: ../req/packed-1
+ - check: |
+ T_step_eq_int( ${step}, packed_enum_size, 1 );
+ description: |
+ Check that ${../if/packed:/name}() correctly enforces a minimal enum type.
+ links:
+ - role: validation
+ uid: ../req/packed-2
+ description: |
+ Use the ${../if/packed:/name} macro.
+ links: []
+
+# ---- RTEMS_PREDICT_FALSE ----
+
+- action: |
+ /* No action */
+ checks:
+ - check: |
+ T_step_eq_int( ${step}, RTEMS_PREDICT_FALSE( PREDICT_FALSE 1 ), 0 );
+ description: |
+ It cannot be checked that the ${../if/predict-false:/name}
+ macro has the desired effect. Yet, the check confirms that such a
+ macro exists and can be used.
+ links:
+ - role: validation
+ uid: ../req/predict-false-0
+ description: |
+ Use the ${../if/predict-false:/name}() macro.
+ links: []
+
+# ---- RTEMS_PREDICT_TRUE ----
+
+- action: |
+ /* No action */
+ checks:
+ - check: |
+ T_step_eq_int( ${step}, RTEMS_PREDICT_TRUE( 6 - 5 ), 1 );
+ description: |
+ It cannot be checked that the ${../if/predict-true:/name}
+ macro has the desired effect. Yet, the check confirms that such a
+ macro exists and can be used.
+ links:
+ - role: validation
+ uid: ../req/predict-true-0
+ description: |
+ Use the ${../if/predict-true:/name}() macro.
+ links: []
+
+# ---- RTEMS_PRINTFLIKE ----
+
+- action: |
+ int printflike_result;
+ printflike_result = printflike_func(
+ "RTEMS_PRINTFLIKE",
+ "%d %lx %s\n",
+ 123,
+ 0xABCDEFL,
+ "test output"
+ );
+ checks:
+ - check: |
+ T_step_eq_int( ${step}, printflike_result, 23 );
+ description: |
+ It cannot automatically be checked that the ${../if/printflike:/name}
+ macro has the desired effect. Yet, the check confirms that such a macro
+ exists and that it can be used on such a printf-like function and that
+ the argument numbers are correct.
+ links:
+ - role: validation
+ uid: ../req/printflike-0
+ - role: validation
+ uid: ../req/printflike-1
+ description: |
+ Use a function declared with the ${../if/printflike:/name}() macro.
+ links: []
+
+# ---- RTEMS_PURE ----
+
+- action: |
+ int pure_result;
+ int pure_result_2;
+ pure_result = pure_func();
+ pure_result_2 = pure_func();
+ checks:
+ - check: |
+ T_step_eq_int( ${step}, pure_result, 21 );
+ T_step_eq_int( ${step}, pure_result_2, 21 );
+ description: |
+ It cannot be checked that the ${../if/pure:/name}
+ macro has the desired effect. It is checked that such a macro exists.
+ links:
+ - role: validation
+ uid: ../req/pure-0
+ description: |
+ Use the ${../if/pure:/name} macro at the beginning of this file.
+ links: []
+
+# ---- RTEMS_RETURN_ADDRESS ----
+
+- action: |
+ /*
+ * If this code is not compiled using GNU C, I still have to run a check
+ * to avoid trouble with the {step} counter of the checks.
+ */
+ const char *return_address_text = "__builtin_return_address(0)";
+ #if defined( __GNUC__ )
+ return_address_text =
+ remove_white_space( _TO_STR( RTEMS_RETURN_ADDRESS() ) );
+ #endif
+ checks:
+ - check: |
+ T_step_eq_str( ${step},
+ return_address_text, "__builtin_return_address(0)" );
+ description: |
+ The check confirms that a ${../if/return-address:/name}() macro exists
+ and that it produces the correct code.
+ links:
+ - role: validation
+ uid: ../req/return-address-0
+ description: |
+ Get the code the ${../if/return-address:/name}() macro produces as string.
+ links: []
+
+# ---- RTEMS_SECTION ----
+
+- action: |
+ short section_result;
+ section_result = section_func( 1234567 );
+ checks:
+ - check: |
+ T_step_eq_int( ${step}, section_var, 28 );
+ T_step_eq_int( ${step}, section_result, 67 );
+ description: |
+ It cannot be checked that the ${../if/section:/name}()
+ macro has the desired effect. Yet, the check confirms that such a
+ macro exists and can be used.
+ links:
+ - role: validation
+ uid: ../req/section-0
+ description: |
+ Use the ${../if/section:/name}() macro on ``section_variable`` and
+ ``section_func`` at the beginning of this file.
+ links: []
+
+# ---- RTEMS_STATIC_ASSERT ----
+
+- action: |
+ RTEMS_STATIC_ASSERT( STATIC_ASSERT_COND 1, RTEMS_STATIC_ASSERT_test );
+ checks:
+ - check: ''
+ description: |
+ It cannot be automatically check that
+ the ${../if/static-assert:/name}() macro has the desired effect.
+ Yet, it can be checked that the macro exists and accepts the
+ specified arguments.
+ links:
+ - role: validation
+ uid: ../req/static-assert-0
+ description: |
+ Use the ${../if/static-assert:/name}() macro.
+ links: []
+
+# ---- RTEMS_STRING ----
+
+- action: |
+ const char *string_var;
+ const char *string_empty_var;
+ /* strange spacing and tabs belong to the test */
+ string_var = RTEMS_STRING( \\ STRING_PREFIX cat""\n );
+ string_empty_var = RTEMS_STRING();
+ checks:
+ - check: |
+ T_step_eq_str( ${step}, string_var, "\\ STRING_PREFIX cat\"\"\n" );
+ T_step_eq_str( ${step}, string_empty_var, "" );
+ description: |
+ Check that the ${../if/string:/name}() macro
+ converts its argument into a string without applying
+ pre-processor substitutions on its argument.
+ links:
+ - role: validation
+ uid: ../req/string-0
+ description: |
+ Use the ${../if/string:/name}() macro.
+ links: []
+
+# ---- RTEMS_SYMBOL_NAME ----
+
+- action: |
+ const int symbol_name = 321;
+ int symbol_name_0_var;
+ int symbol_name_1_var;
+ int prefixed_symbol_name_var;
+ int prefixed_symbol_id_var;
+ int prefixed_upper_symbol_name_var;
+ symbol_name_0_var = RTEMS_SYMBOL_NAME( symbol_name );
+ symbol_name_1_var = RTEMS_SYMBOL_NAME( SYMBOL_NAME );
+ prefixed_symbol_name_var = basedefs_use_prefixed_symbol_name();
+ prefixed_symbol_id_var = basedefs_use_prefixed_symbol_id();
+ prefixed_upper_symbol_name_var = basedefs_use_prefixed_upper_symbol_name();
+ checks:
+ - check: |
+ T_step_eq_int( ${step}, symbol_name_0_var, 321 );
+ description: |
+ Case ``__USER_LABEL_PREFIX__`` undefined.
+ Check that the ${../if/symbol-name:/name}() macro
+ without any pre-processor substitutions applicable results
+ in its literal argument.
+ links:
+ - role: validation
+ uid: ../req/symbol-name-3
+ - check: |
+ T_step_eq_int( ${step}, symbol_name_1_var, 321 );
+ description: |
+ Case ``__USER_LABEL_PREFIX__`` undefined.
+ Check that the ${../if/symbol-name:/name}() macro
+ applies pre-processor substitutions to its argument
+ and its result.
+ links:
+ - role: validation
+ uid: ../req/symbol-name-0
+ - role: validation
+ uid: ../req/symbol-name-3
+ - role: validation
+ uid: ../req/symbol-name-5
+ - check: |
+ T_step_eq_int( ${step}, prefixed_symbol_name_var, 124 );
+ description: |
+ Case ``__USER_LABEL_PREFIX__`` defined.
+ Check that the ${../if/symbol-name:/name}() macro
+ without any pre-processor substitutions applicable results
+ in the literal prefix and argument.
+ links:
+ - role: validation
+ uid: ../req/symbol-name-1
+ - role: validation
+ uid: ../req/symbol-name-2
+ - check: |
+ T_step_eq_int( ${step}, prefixed_upper_symbol_name_var, 125 );
+ description: |
+ Case ``__USER_LABEL_PREFIX__`` defined.
+ Check that the ${../if/symbol-name:/name}() macro
+ applies pre-processor substitutions to its argument.
+ links:
+ - role: validation
+ uid: ../req/symbol-name-1
+ - role: validation
+ uid: ../req/symbol-name-2
+ - role: validation
+ uid: ../req/symbol-name-6
+ - check: |
+ T_step_eq_int( ${step}, prefixed_symbol_id_var, 126 );
+ description: |
+ Case ``__USER_LABEL_PREFIX__`` defined.
+ Check that the ${../if/symbol-name:/name}() macro
+ applies pre-processor substitutions to its result.
+ links:
+ - role: validation
+ uid: ../req/symbol-name-4
+ - role: validation
+ uid: ../req/symbol-name-5
+ - role: validation
+ uid: ../req/symbol-name-6
+ description: |
+ Use the ${../if/symbol-name:/name}() macro on examples.
+ links: []
+
+# ---- RTEMS_TRUE ----
+
+- action: |
+ char *true_result;
+ true_result = _TO_STR( TRUE );
+ checks:
+ - check: |
+ T_step_eq_str( ${step}, true_result, "1" );
+ description: |
+ Check that of ${../if/true:/name} is substituted by 0.
+ links:
+ - role: validation
+ uid: ../req/true-0
+ description: |
+ Invoke the ${../if/true:/name}() macro on an example.
+ links: []
+
+# ---- RTEMS_TYPEOF_REFX ----
+
+- action: |
+ int type_refx_val = 7;
+ char type_refx_chr = 'c';
+ char *type_refx_chr_p = &type_refx_chr;
+ char **type_refx_chr_pp = &type_refx_chr_p;
+ const short type_refx_const_val = 333;
+ RTEMS_TYPEOF_REFX( *, int *) type_refx_x_int = 8;
+ RTEMS_TYPEOF_REFX( **, int **) type_refx_xx_int = 9;
+ RTEMS_TYPEOF_REFX( ***, int ***) type_refx_xxx_int = 10;
+ RTEMS_TYPEOF_REFX( **, int ***) type_refx_xxx_int_p = &type_refx_val;
+ RTEMS_TYPEOF_REFX( **, &type_refx_chr_p) type_refx_ax_char = 'd';
+ RTEMS_TYPEOF_REFX( *, type_refx_chr_p) type_refx_x_char = 'e';
+ RTEMS_TYPEOF_REFX( , *type_refx_chr_p) type_refx_char = 'f';
+ RTEMS_TYPEOF_REFX( *, type_refx_chr_pp[0]) type_refx_xx_char = 'g';
+ RTEMS_TYPEOF_REFX( *, const short **)
+ type_refx_xx_const_short_p = &type_refx_const_val;
+ checks:
+ - check: |
+ T_step_eq_int( ${step}, type_refx_val, 7 );
+ T_step_eq_int( ${step}, type_refx_x_int, 8 );
+ T_step_eq_int( ${step}, type_refx_xx_int, 9 );
+ T_step_eq_int( ${step}, type_refx_xxx_int, 10 );
+ T_step_eq_int( ${step}, *type_refx_xxx_int_p, 7 );
+ T_step_eq_char( ${step}, type_refx_chr, 'c' );
+ T_step_eq_char( ${step}, type_refx_ax_char, 'd' );
+ T_step_eq_char( ${step}, type_refx_x_char, 'e' );
+ T_step_eq_char( ${step}, type_refx_char, 'f' );
+ T_step_eq_char( ${step}, type_refx_xx_char, 'g' );
+ T_step_eq_short( ${step}, *type_refx_xx_const_short_p, 333 );
+ description: |
+ The checks here are proforma. The macro is tested by the fact that
+ the action will not compile if the macro returns a wrong result.
+ links:
+ - role: validation
+ uid: ../req/typeof-refx-0
+ description: |
+ Use of the ${../if/typeof-refx:/name}() macro on several examples.
+ This use is already the test as the statements will not compile
+ without error if the macro did not evaluate to the correct type.
+ links: []
+
+# ---- RTEMS_UNUSED ----
+
+- action: |
+ int unused_var RTEMS_UNUSED;
+ typedef struct RTEMS_UNUSED {
+ char c;
+ int i;
+ } unused_struct_t;
+ unused_struct_t unused_struct = { '@', 13 };
+ checks:
+ - check: ''
+ description: |
+ It cannot automatically be checked that the ${../if/unused:/name}
+ macro has the desired effect. It is checked that such a macro exists
+ and one can manually check that no compiler warnings are produced
+ for the unused_func().
+ links:
+ - role: validation
+ uid: ../req/unused-0
+ - check: |
+ unused_lable:
+ RTEMS_UNUSED;
+ description: |
+ It cannot automatically be checked that the ${../if/unused:/name}
+ macro has the desired effect. It is checked that such a macro exists
+ and one can manually check that no compiler warnings are produced
+ for the unused_lable.
+ links:
+ - role: validation
+ uid: ../req/unused-1
+ - check: ''
+ description: |
+ It cannot automatically be checked that the ${../if/unused:/name}
+ macro has the desired effect. It is checked that such a macro exists
+ and one can manually check that no compiler warnings are produced
+ for the unused_struct.
+ links:
+ - role: validation
+ uid: ../req/unused-2
+ - check: ''
+ description: |
+ It cannot automatically be checked that the ${../if/unused:/name}
+ macro has the desired effect. It is checked that such a macro exists
+ and one can manually check that no compiler warnings are produced
+ for the unused items unused_var and the unused argument and variable
+ in unused_func().
+ links:
+ - role: validation
+ uid: ../req/unused-3
+ description: |
+ Use the ${../if/unused:/name} macro. See also unused_func() at the
+ beginning of this file.
+ links: []
+
+# ---- RTEMS_UNREACHABLE ----
+
+- action: |
+ int unreachable_result;
+ unreachable_result = unreachable_func(2101);
+ checks:
+ - check: |
+ T_step_eq_int( ${step}, unreachable_result, 2101 );
+ description: |
+ It cannot be checked that the ${../if/unreachable:/name}
+ macro has the desired effect. It is checked that such a macro exists
+ and the compiler warning about the missing return statement is suppressed.
+ links:
+ - role: validation
+ uid: ../req/unreachable-0
+ description: |
+ Use of the ${../if/unreachable:/name} macro in function definition of
+ unreachable_func() at the beginning of this file.
+ links: []
+
+# ---- RTEMS_USED ----
+
+- action: |
+ /* No action */
+ checks:
+ - check: ''
+ description: |
+ It cannot be checked that the ${../if/used:/name} macro has the
+ desired effect. It is checked that such a macro exists.
+ links:
+ - role: validation
+ uid: ../req/used-0
+ description: |
+ Use of the ${../if/used:/name} macro in function definition of
+ used_func() at the beginning of this file and with used_var above.
+ links: []
+
+# ---- RTEMS_WARN_UNUSED_RESULT ----
+
+- action: |
+ int warn_unused_result;
+ warn_unused_result = warn_unused_func( 33 );
+ /*
+ * Derivation from Coding Style:
+ * The following code suppresses a compiler warning (instead of fixing
+ * it).
+ * Rational: Ignoring the function warn_unused_func() result is not really
+ * a bug but its purpose is to test the RTEMS_WARN_UNUSED_RESULT macro.
+ * The RTEMS_WARN_UNUSED_RESULT macro must result in a compiler warning
+ * here.
+ */
+ _Pragma( "GCC diagnostic push" )
+ _Pragma( "GCC diagnostic ignored \"-Wunused-result\"" )
+ warn_unused_func( 66 );
+ _Pragma( "GCC diagnostic pop" )
+ checks:
+ - check: |
+ T_step_eq_int( ${step}, warn_unused_result, 11 );
+ description: |
+ It cannot be checked that the ${../if/warn-unused-result:/name} macro
+ has the desired effect. The GNU C compiler should issue a warning
+ about the disregarded result returned by the call
+ to the ``warn_unused_func()`` function.
+ links:
+ - role: validation
+ uid: ../req/warn-unused-result-0
+ description: |
+ Use of the ${../if/warn-unused-result:/name} macro in function definition of
+ warn_unused_func() at the beginning of this file.
+ links: []
+
+# ---- RTEMS_WEAK_ALIAS ----
+
+- action: |
+ int weak_alias_0_result;
+ int weak_alias_1_result;
+ weak_alias_0_result = ori_func( 3 ) + basedefs_weak_alias_0_func( 5 );
+ weak_alias_1_result = ori_func( 3 ) + basedefs_weak_alias_1_func( 5 );
+ checks:
+ - check: |
+ T_step_eq_int( ${step}, weak_alias_0_result, 16 );
+ description: |
+ There exists no strong alias for basedefs_weak_alias_0_func().
+ Check that ori_func() and basedefs_weak_alias_0_func() are the
+ same function.
+ links:
+ - role: validation
+ uid: ../req/weak-alias-0
+ - check: |
+ T_step_eq_int( ${step}, weak_alias_1_result, 56 );
+ description: |
+ File ``tc_basedefs_pndant.c`` defines a strong function for
+ basedefs_weak_alias_1_func().
+ Check that ori_func() and basedefs_weak_alias_1_func() are not
+ the same function.
+ links:
+ - role: validation
+ uid: ../req/weak-alias-1
+ description: |
+ Use of ``basedefs_weak_alias_0/1_func()`` which are defined with the
+ ${../if/weak-alias:/name} macro at the beginning of this file.
+ links: []
+
+# ---- RTEMS_WEAK ----
+
+- action: |
+ int weak_0_result;
+ int weak_1_result;
+ weak_0_result = basedefs_weak_0_func();
+ weak_1_result = basedefs_weak_1_func();
+ checks:
+ - check: |
+ T_step_eq_int( ${step}, basedefs_weak_0_var, 60 );
+ T_step_eq_int( ${step}, weak_0_result, 63 );
+ description: |
+ For ``basedefs_weak_0_var`` and ``basedefs_weak_0_func()`` there
+ exists no other symbols with the same name.
+ Hence, the checks test that the weak symbols are used.
+ links:
+ - role: validation
+ uid: ../req/weak-0
+ - check: |
+ T_step_eq_int( ${step}, basedefs_weak_1_var, 62 );
+ T_step_eq_int( ${step}, weak_1_result, 65 );
+ description: |
+ ``basedefs_weak_1_var`` and ``basedefs_weak_1_func()``
+ are overwritten by strong symbols defined in file
+ ``tc_basedefs_pendant.c``. Hence, the checks test that the strong
+ variants are used.
+ links:
+ - role: validation
+ uid: ../req/weak-1
+ description: |
+ Use of ``basedefs_weak_0/1_var`` and ``basedefs_weak_0/1_func()``
+ which are defined with the ${../if/weak:/name} macro at the
+ beginning of this file.
+ links: []
+
+# ---- RTEMS_XCONCAT ----
+
+- action: |
+ int xconcat0_result;
+ int xconcat1_result;
+ int xconcat2_result;
+ int xconcat3_result;
+ xconcat0_result = RTEMS_XCONCAT( con, cat )();
+ xconcat1_result = RTEMS_XCONCAT( CON, CAT )();
+ xconcat2_result =
+ RTEMS_XCONCAT( RTEMS_XCONCAT( CO, N ), RTEMS_XCONCAT( ca, t ) )();
+ xconcat3_result = RTEMS_CONCAT( def, cat )();
+ checks:
+ - check: |
+ T_step_eq_int( ${step}, xconcat0_result, 91 );
+ description: |
+ Check that the two arguments of ${../if/xconcat:/name}() are
+ concatenated without inserting new characters.
+ links:
+ - role: validation
+ uid: ../req/xconcat-0
+ - role: validation
+ uid: ../req/xconcat-1
+ - check: |
+ T_step_eq_int( ${step}, xconcat1_result, 91 );
+ description: |
+ Check that the two arguments of ${../if/xconcat:/name}() are
+ substituted before they are concatenated.
+ links:
+ - role: validation
+ uid: ../req/xconcat-2
+ - check: |
+ T_step_eq_int( ${step}, xconcat2_result, 91 );
+ description: |
+ Check that the two arguments of ${../if/xconcat:/name}() are can
+ be the macro itself.
+ links:
+ - role: validation
+ uid: ../req/xconcat-3
+ - check: |
+ T_step_eq_int( ${step}, xconcat3_result, 91 );
+ description: |
+ Check that the result of the ${../if/xconcat:/name}() expansion
+ is subject to a further pre-processor substitution.
+ links:
+ - role: validation
+ uid: ../req/xconcat-2
+ description: |
+ Invoke the ${../if/xconcat:/name}() macro on examples.
+ links: []
+
+# ---- RTEMS_XSTRING ----
+
+- action: |
+ const char *xstring_var;
+ const char *xstring_empty_var;
+ /* strange spacing and tabs belong to the test */
+ xstring_var = RTEMS_XSTRING( \\ STRING_PREFIX cat""\n );
+ xstring_empty_var = RTEMS_XSTRING();
+ checks:
+ - check: |
+ T_step_eq_str( ${step}, xstring_var, "\\ str cat\"\"\n" );
+ T_step_eq_str( ${step}, xstring_empty_var, "" );
+ description: |
+ Check that the ${../if/xstring:/name}() macro applies
+ pre-processor substitutions on its argument and
+ converts its argument into a string.
+ links:
+ - role: validation
+ uid: ../req/xstring-0
+ description: |
+ Use the ${../if/xstring:/name}() macro.
+ links: []
+
+# ---- RTEMS_ZERO_LENGTH_ARRAY ----
+
+- action: |
+ typedef struct {
+ char chr;
+ int array[RTEMS_ZERO_LENGTH_ARRAY];
+ } zero_length_struct_0;
+ typedef struct {
+ char chr;
+ int array[1];
+ } zero_length_struct_1;
+ checks:
+ - check: |
+ T_step_eq_sz( ${step}, sizeof( zero_length_struct_0 ),
+ sizeof( zero_length_struct_1 ) - sizeof( int ) );
+ T_step_eq_sz( ${step}, offsetof( zero_length_struct_0, chr ),
+ offsetof( zero_length_struct_1, chr ) );
+ T_step_eq_sz( ${step}, offsetof( zero_length_struct_0, array ),
+ offsetof( zero_length_struct_1, array ) );
+ description: |
+ Checked that the ${../if/zero-length-array:/name} macro
+ produces a structure similar to a structure with one element.
+ links:
+ - role: validation
+ uid: ../req/zero-length-array-0
+ description: |
+ Use of the ${../if/zero-length-array:/name} macro in a declaration of
+ a structure.
+ links: []
+test-brief: |
+ Tests the basedefs macros of the Classic API.
+test-description: null
+test-epilogue: null
+test-fixture: null
+test-header: null
+test-includes:
+- stddef.h
+- stdarg.h
+- rtems.h
+test-local-includes:
+- tc-basedefs-pendant.h
+test-prologue: null
+test-support: |
+ #define WHITE_SPACE_STRING_MAX_LENGTH 80
+ #define abccat concat
+ #define abc ABC
+ #define CON con
+ #define CAT cat
+ #define defcat concat
+ #define GLOBAL_SYMBOL_VALULE( _hex ) 0x ## _hex
+ #define EXPAND expand
+ #define PREDICT_FALSE 1 -
+ #define SECTION_NAME ".rtemsroset.test"
+ #define STATIC_ASSERT_COND 0 +
+ #define STRING_PREFIX str
+ #define SYMBOL_NAME SYMBOL_name
+ #define SYMBOL_name symbol_name
+ #define _TO_STR2( _text ) #_text
+ #define _TO_STR( _text ) _TO_STR2( _text )
+
+ /*
+ * For some reasons - which I fail to fully understand - _TO_STR()
+ * seems to remove spaces around `()` at times and at other times
+ * not. For example, I get
+ *
+ * * "__attribute__(( __malloc__ ))" or
+ * * "__attribute__((__malloc__))".
+ *
+ * To avoid trouble, the function below returns a version of a
+ * string without any spaces. Albeit, the implementation is rather
+ * brute and raw. It returns a pointer to a static buffer of fixed
+ * size. That will do for tests but not serve as generic function.
+ */
+ static const char *remove_white_space( const char *str )
+ {
+ char c;
+ int i = 0;
+ static char buffer[WHITE_SPACE_STRING_MAX_LENGTH] = {};
+
+ /* Sanity check */
+ if( strlen( str ) >= sizeof( buffer ) ) {
+ T_assert_true( false,
+ "Buffer too small; increase WHITE_SPACE_STRING_MAX_LENGTH" );
+ }
+
+ /* Copy string but skip white spaces */
+ do {
+ c = *( str++ );
+ if ( ' ' != c && '\t' !=c ) {
+ buffer[i++] = c;
+ }
+ } while ( '\0' != c );
+
+ return buffer;
+ }
+
+ static int alias_func( int i ) RTEMS_ALIAS( ori_func );
+
+ typedef struct {
+ uint8_t c;
+ uint8_t aligned_member RTEMS_ALIGNED( 8 );
+ } aligned_member_struct;
+
+ static int concat( void )
+ {
+ return 91;
+ }
+
+ RTEMS_CONST static int const_func( int arg )
+ {
+ return 4 * arg;
+ }
+
+ RTEMS_COMPILER_NO_RETURN_ATTRIBUTE
+ static void compiler_no_return_attribute_func( int i );
+ static void compiler_no_return_attribute_func( int i )
+ {
+ while ( true ) {
+ /* Loop forever */
+ }
+ }
+
+ RTEMS_COMPILER_PURE_ATTRIBUTE static int compiler_pure_attribute_func( void )
+ {
+ return 21;
+ }
+
+ RTEMS_DEFINE_GLOBAL_SYMBOL(
+ GLOBAL_SYMBOL, GLOBAL_SYMBOL_VALULE( abc ) );
+
+ static int deprecated_func( int i ) RTEMS_DEPRECATED;
+ static int deprecated_func( int i )
+ {
+ return 3 * i;
+ }
+
+ static int expand( void )
+ {
+ return 82;
+ }
+
+ RTEMS_INLINE_ROUTINE int inline_routine_func( int arg )
+ {
+ return 1 << arg;
+ }
+
+ RTEMS_NO_INLINE static int no_inline_func( void )
+ {
+ asm ("");
+ return 75;
+ }
+
+ RTEMS_NO_RETURN static void no_return_func( int i )
+ {
+ while ( true ) {
+ /* Loop forever */
+ }
+ }
+
+ static int ori_func( int x )
+ {
+ return 2 * x;
+ }
+
+ RTEMS_PRINTFLIKE(2, 3) static int printflike_func(
+ const char *prefix,
+ const char *fmt,
+ ...
+ )
+ {
+ int result;
+ va_list va_list;
+
+ T_printf( "%s: ", prefix );
+ va_start( va_list, fmt );
+ result = T_vprintf( fmt, va_list );
+ va_end( va_list );
+
+ return result;
+ }
+
+ RTEMS_PURE static int pure_func( void )
+ {
+ return 21;
+ }
+
+ RTEMS_SECTION( ".rtemsrwset.test" ) static int section_var = 28;
+ RTEMS_SECTION( SECTION_NAME ) static int section_func( int arg )
+ {
+ return arg % 100;
+ }
+
+ static int unreachable_func( int arg )
+ {
+ if ( 1 == arg % 100 ) {
+ return arg;
+ } else {
+ T_assert_true( false,
+ "Oops! Function caled with bad argument." );
+ RTEMS_UNREACHABLE();
+ }
+ }
+
+ RTEMS_USED static int used_var = 4711;
+ RTEMS_USED static int used_func( void )
+ {
+ return 35;
+ }
+
+ static int warn_unused_func( int arg ) RTEMS_WARN_UNUSED_RESULT;
+ static int warn_unused_func( int arg )
+ {
+ return arg / 3;
+ }
+
+ int basedefs_weak_alias_0_func( int i ) RTEMS_WEAK_ALIAS( ori_func );
+ int basedefs_weak_alias_1_func( int i ) RTEMS_WEAK_ALIAS( ori_func );
+
+ RTEMS_WEAK const volatile int basedefs_weak_0_var = 60;
+ RTEMS_WEAK const volatile int basedefs_weak_1_var = 61;
+ RTEMS_WEAK int basedefs_weak_0_func( void )
+ {
+ return 63;
+ }
+
+ RTEMS_WEAK int basedefs_weak_1_func( void )
+ {
+ return 64;
+ }
+test-target: testsuites/validation/tc-basedefs.c
+type: test-case