summaryrefslogtreecommitdiffstats
path: root/spec/rtems/basedefs/val/basedefs.yml
diff options
context:
space:
mode:
Diffstat (limited to 'spec/rtems/basedefs/val/basedefs.yml')
-rw-r--r--spec/rtems/basedefs/val/basedefs.yml1688
1 files changed, 1688 insertions, 0 deletions
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