Pragmas
Jump to navigation
Jump to search
The SCL pragmas are designed to allow annotation of C language constructs in such a way as to identify and define messages, function calls, and test units so that they can be transparently intercepted and remoted.
scl_function
The scl_function pragma allows the user to capture a function. When captured for the purpose of interception (intercept-able) the optional arguments are used to specify how the intercept should be executed.
Syntax
#pragma scl_function(function-name [,context, name-mangling, group-id])
Parameters | Type | Description |
function-name | Identifier | Name of the function to capture. |
context | String | Optional. Context in which the function is going to be intercepted. Possible values are "REFERENCE" - intercept at the function call (i.e. where the function is called) or "DEFINITION" - intercept at the function definition (i.e. where the function is implemented). |
name-mangling | String | Optional. Type of name mangling to be used when intercepted. Possible values are "EXPLICIT" or "IMPLICIT". If the context argument is defined the default will be IMPLICIT. Note that if EXPLICIT is set the srTEST_INTERCEPT(<function_name>)" macro is required. |
group-id | String | Optional. User defined identifier representing the group to which this function belongs when enabling interception. The default group-id is set to STRIDE_TEST_GROUP. |
Notes
- The function must be declared as a designator with external linkage.
- A compilation error is reported if an attempt is made to capture a function more than once.
Examples
Using the defaults for IMPLICIT and STRIDE_TEST_GROUP when capturing boo
int foo(int x);
void boo(void);
#pragma scl_function(foo)
#pragma scl_function(boo, "DEFINITION")
Setting a specific GROUP ID
void boo(void);
#pragma scl_function(boo, "DEFINITION", ''IMPLICIT'', ''MY_TEST_GROUP'')