blob: 24f0d310530dd1bede0ba8e890299557e69c5043 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
SPDX-License-Identifier: CC-BY-SA-4.0
copyrights:
- Copyright (C) 2020 embedded brains GmbH & Co. KG
enabled-by: true
functional-type: function
links:
- role: interface-function
uid: ../if/have-member-same-type
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: 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
|