SLAU132V October 2004 – February 2020
The CALLS pragma specifies a set of functions that can be called indirectly from a specified calling function.
The CALLS pragma is used by the compiler to embed debug information about indirect calls in object files. Using the CALLS pragma on functions that make indirect calls enables such indirect calls to be included in calculations for such functions' inclusive stack sizes. For more information on generating function stack usage information, see the -cg option of the Object File Display Utility in the "Invoking the Object File Display Utility" section of the MSP430 Assembly Language Tools User's Guide.
The CALLS pragma can precede either the calling function's definition or its declaration. In C, the pragma must have at least 2 arguments—the first argument is the calling function, followed by at least one function that will be indirectly called from the calling function. In C++, the pragma applies to the next function declared or defined, and the pragma must have at least one argument.
The syntax for the CALLS pragma in C is as follows. This indicates that calling_function can indirectly call function_1 through function_n.
#pragma CALLS ( calling_function, function_1, function_2, ..., function_n ) |
The syntax for the CALLS pragma in C++ is:
#pragma CALLS ( function_1_mangled_name, ..., function_n_mangled_name) |
Note that in C++, the arguments to the CALLS pragma must be the full mangled names for the functions that can be indirectly called from the calling function.
The GCC-style "calls" function attribute (see Section 5.17.2), which has the same effect as the CALLS pragma, has the following syntax:
__attribute__((calls("function_1","function_2",..., "function_n")))