RTEMS 6.3
Loading...
Searching...
No Matches

Tests the basedefs macros of the Classic API. More...

Files

file  testsuites/validation/tc-basedefs-pendant.c
 Helper file to verify the requirements towards the basedefs.
file  testsuites/validation/tc-basedefs-pendant.h
 Helper file to verify the requirements towards the basedefs.
file  testsuites/validation/tc-basedefs.c

Data Structures

struct  aligned_member_struct

Macros

#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)
#define EXPAND   expand
#define PREDICT_FALSE   1 -
#define SECTION_NAME   ".rtemsroset.test"
#define STATIC_ASSERT_COND   0 +
#define STRING_PREFIX   str
#define SYMBOL_NAME   global_object
#define _TO_STR2(_text)
#define _TO_STR(_text)

Functions

 __asm__ ("\n\t.set " RTEMS_XSTRING(RTEMS_SYMBOL_NAME(address_of_global_object)) ", " RTEMS_XSTRING(RTEMS_SYMBOL_NAME(SYMBOL_NAME)) "\n")
 RTEMS_DEFINE_GLOBAL_SYMBOL (GLOBAL_SYMBOL, RTEMS_SYMBOL_NAME(global_symbol_base)+GLOBAL_SYMBOL_VALULE(abc))
 RTEMS_DECLARE_GLOBAL_SYMBOL (global_symbol_2)
 RTEMS_DEFINE_GLOBAL_SYMBOL (global_symbol_2, 0x123)
RTEMS_INLINE_ROUTINE int inline_routine_func (int arg)
 RTEMS_PRINTFLIKE (2, 3)
 RTEMS_SECTION (".rtemsrwset.test")
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 int basedefs_weak_0_func (void)
RTEMS_WEAK int basedefs_weak_1_func (void)
 T_TEST_CASE (RtemsBasedefsValBasedefs)

Variables

int global_object
int address_of_global_object
RTEMS_WEAK const volatile int basedefs_weak_0_var = 60
RTEMS_WEAK const volatile int basedefs_weak_1_var = 61

Detailed Description

Tests the basedefs macros of the Classic API.

This test case performs the following actions:

  • Use the RTEMS_ALIAS() macro.
    • Check that ori_func() and alias_func() are the same function.
  • Use the RTEMS_ALIGN_DOWN() macro in various examples.
  • Use the RTEMS_ALIGN_UP() macro in various examples.
    • Check that RTEMS_ALIGN_UP() calculates the expected result and is side-effect free.
  • Use the RTEMS_ALIGNED() macro.
    • Check that RTEMS_ALIGNED() correctly aligns a variable on the stack and a structure member.
  • Use the RTEMS_ALIGNOF() macro.
    • Check that the RTEMS_ALIGNOF() macro results in the alignment of the type.
    • If the RTEMS_ALIGNOF() macro would evaluate its argument, it could not figure out how much menory to reserve for it.
    • If the RTEMS_ALIGNOF() macro would evaluate the size expression, the division by zero would cause an error.
    • Ensure the constant value of the RTEMS_ALIGNOF() macro is of type size_t.
  • Use a function declared with the RTEMS_ALLOC_ALIGN() macro.
    • It cannot be checked that the RTEMS_ALLOC_ALIGN() 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.
  • Use a function declared with the RTEMS_ALLOC_SIZE() macro.
    • It cannot be checked that the RTEMS_ALLOC_SIZE() 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.
  • Use a function declared with the RTEMS_ALLOC_SIZE_2() macro.
    • It cannot be checked that the RTEMS_ALLOC_SIZE_2() 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.
  • Use the RTEMS_ARRAY_SIZE() macro.
    • Check that the calculated size of the arrays fit their definition.
  • Use the RTEMS_COMPILER_DEPRECATED_ATTRIBUTE macro.
    • It cannot automatically be checked that the RTEMS_COMPILER_DEPRECATED_ATTRIBUTE 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.
  • Use the RTEMS_COMPILER_MEMORY_BARRIER() macro.
  • Use of the RTEMS_COMPILER_NO_RETURN_ATTRIBUTE macro at the beginning of this file.
    • It cannot be checked that the RTEMS_COMPILER_NO_RETURN_ATTRIBUTE macro has the desired effect. It is only checked that such a macro exists.
  • Use the RTEMS_COMPILER_PACKED_ATTRIBUTE macro.
    • Check that RTEMS_COMPILER_PACKED_ATTRIBUTE correctly aligns a structure member.
  • Use the RTEMS_COMPILER_PURE_ATTRIBUTE macro at the beginning of this file.
    • It cannot be checked that the RTEMS_COMPILER_PURE_ATTRIBUTE macro has the desired effect. It is checked that such a macro exists.
  • Use the RTEMS_COMPILER_UNUSED_ATTRIBUTE macro.
    • It cannot automatically be checked that the RTEMS_COMPILER_UNUSED_ATTRIBUTE 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.
  • Invoke the RTEMS_CONCAT() macro on examples.
    • Check that the two arguments of RTEMS_CONCAT() are concatenated to a new token.
    • Check that the result of the RTEMS_CONCAT() expansion is subject to a further pre-processor substitution.
  • Use the RTEMS_CONST macro at the beginning of this file.
    • It cannot be checked that the RTEMS_CONST macro has the desired effect. It is checked that such a macro exists.
  • Use the RTEMS_CONTAINER_OF() macro.
  • Use the RTEMS_DECLARE_GLOBAL_SYMBOL() macro in the file tc-basedefs-pendant.h.
    • Check that the RTEMS_DECLARE_GLOBAL_SYMBOL() 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.
  • Use the RTEMS_DECONST() macro.
    • Check that the RTEMS_DECONST() macro returns a pointer which allows to write into an otherwise const value.
  • Use the RTEMS_DEFINE_GLOBAL_SYMBOL() macro at the beginning of this file.
  • Use a function declared with the RTEMS_DEPRECATED macro.
    • It cannot automatically be checked that the RTEMS_DEPRECATED 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.
  • Use the RTEMS_DEQUALIFY_DEPTHX() macro.
    • Check that the RTEMS_DEQUALIFY_DEPTHX() macro returns a pointer which allows to write into an otherwise const (volatile) value.
  • Use the RTEMS_DEQUALIFY() macro.
    • Check that the RTEMS_DEQUALIFY() macro returns a pointer which allows to write into an otherwise const volatile value.
  • Use the RTEMS_DEVOLATILE() macro.
    • Check that the RTEMS_DEVOLATILE() macro returns a pointer which allows to write into an otherwise volatile value.
  • Invoke the RTEMS_EXPAND() macro on an example.
  • Invoke the FALSE macro on an example.
    • Check that of FALSE is substituted by 0.
  • Invoke the RTEMS_HAVE_MEMBER_SAME_TYPE() macro on examples.
  • Use the RTEMS_INLINE_ROUTINE in the definition of function inline_routine_func() at the beginning of this file. Obtain the text the macro RTEMS_INLINE_ROUTINE produces.
    • Check that the RTEMS_INLINE_ROUTINE exists and that it produces the desired text.
  • Use a function declared with the RTEMS_MALLOCLIKE macro.
    • It cannot be checked that the RTEMS_MALLOCLIKE 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.
  • Use a function declared with the RTEMS_NO_INLINE macro.
    • It cannot be checked that the RTEMS_NO_INLINE 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.
  • Use of the RTEMS_NO_RETURN macro at the beginning of this file.
    • It cannot be checked that the RTEMS_NO_RETURN macro has the desired effect. It is only checked that such a macro exists.
  • Use the RTEMS_NOINIT macro on noinit_variable at the beginning of this file.
    • It cannot be checked that the RTEMS_NOINIT macro has the desired effect. Yet, the check confirms that such a macro exists and can be used.
  • Use the RTEMS_OBFUSCATE_VARIABLE() macro.
    • It cannot be checked that the RTEMS_OBFUSCATE_VARIABLE() macro has the desired effect. Yet, the check confirms that such a macro exists and can be used.
  • Use the RTEMS_PACKED macro.
    • Check that RTEMS_PACKED correctly aligns a structure member.
    • Check that RTEMS_PACKED correctly aligns all structure members.
    • Check that RTEMS_PACKED correctly enforces a minimal enum type.
  • Use the RTEMS_PREDICT_FALSE() macro.
    • It cannot be checked that the RTEMS_PREDICT_FALSE() macro has the desired effect. Yet, the check confirms that such a macro exists and can be used.
  • Use the RTEMS_PREDICT_TRUE() macro.
    • It cannot be checked that the RTEMS_PREDICT_TRUE() macro has the desired effect. Yet, the check confirms that such a macro exists and can be used.
  • Use a function declared with the RTEMS_PRINTFLIKE() macro.
    • It cannot automatically be checked that the RTEMS_PRINTFLIKE() 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.
  • Use the RTEMS_PURE macro at the beginning of this file.
    • It cannot be checked that the RTEMS_PURE macro has the desired effect. It is checked that such a macro exists.
  • Get the code the RTEMS_RETURN_ADDRESS() macro produces as string.
  • Use the RTEMS_SECTION() macro on section_variable and section_func at the beginning of this file.
    • It cannot be checked that the RTEMS_SECTION() macro has the desired effect. Yet, the check confirms that such a macro exists and can be used.
  • Evaluate if RTEMS_STATIC_ANALYSIS is defined.
    • Check that RTEMS_STATIC_ANALYSIS was not defined.
  • Use the RTEMS_STATIC_ASSERT() macro.
    • It cannot be automatically check that the RTEMS_STATIC_ASSERT() macro has the desired effect. Yet, it can be checked that the macro exists and accepts the specified arguments.
  • Use the RTEMS_STRING() macro.
    • Check that the RTEMS_STRING() macro converts its arguments into a single string without applying pre-processor substitutions on its arguments.
  • Use the RTEMS_SYMBOL_NAME() macro with an example object.
  • Invoke the TRUE macro on an example.
    • Check that of TRUE is substituted by 0.
  • Use of the RTEMS_TYPEOF_REFX() 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.
    • 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.
  • Use the RTEMS_UNUSED macro. See also unused_func() at the beginning of this file.
    • It cannot automatically be checked that the RTEMS_UNUSED 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().
    • It cannot automatically be checked that the RTEMS_UNUSED 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.
    • It cannot automatically be checked that the RTEMS_UNUSED 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.
    • It cannot automatically be checked that the RTEMS_UNUSED 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().
  • Use of the RTEMS_UNREACHABLE() macro in function definition of unreachable_func() at the beginning of this file.
    • It cannot be checked that the RTEMS_UNREACHABLE() macro has the desired effect. It is checked that such a macro exists and the compiler warning about the missing return statement is suppressed.
  • Use of the RTEMS_USED macro in function definition of used_func() at the beginning of this file and with used_var above.
    • It cannot be checked that the RTEMS_USED macro has the desired effect. It is checked that such a macro exists.
  • Use of the RTEMS_WARN_UNUSED_RESULT macro in function definition of warn_unused_func() at the beginning of this file.
    • It cannot be checked that the RTEMS_WARN_UNUSED_RESULT 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.
  • Use of basedefs_weak_alias_0/1_func() which are defined with the RTEMS_WEAK_ALIAS() macro at the beginning of this file.
    • 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.
    • 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.
  • Use of basedefs_weak_0/1_var and basedefs_weak_0/1_func() which are defined with the RTEMS_WEAK macro at the beginning of this file.
    • 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.
    • 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.
  • Invoke the RTEMS_XCONCAT() macro on examples.
    • Check that the two arguments of RTEMS_XCONCAT() are concatenated without inserting new characters.
    • Check that the two arguments of RTEMS_XCONCAT() are substituted before they are concatenated.
    • Check that the two arguments of RTEMS_XCONCAT() are can be the macro itself.
    • Check that the result of the RTEMS_XCONCAT() expansion is subject to a further pre-processor substitution.
  • Use the RTEMS_XSTRING() macro.
    • Check that the RTEMS_XSTRING() macro applies pre-processor substitutions on its arguments and converts its arguments into a single string.
  • Use of the RTEMS_ZERO_LENGTH_ARRAY macro in a declaration of a structure.
    • Checked that the RTEMS_ZERO_LENGTH_ARRAY macro produces a structure similar to a structure with one element.
  • Use the RTEMS_DEFINE_GLOBAL_SYMBOL() macro at the beginning of this file and assign the address of the symbol to an object.

Macro Definition Documentation

◆ _TO_STR

#define _TO_STR ( _text)
Value:
_TO_STR2( _text )

◆ _TO_STR2

#define _TO_STR2 ( _text)
Value:
#_text

◆ GLOBAL_SYMBOL_VALULE

#define GLOBAL_SYMBOL_VALULE ( _hex)
Value:
0x ## _hex