10. Configuration for functions

  1. 10.1. Ellipsis in function calls
  2. 10.2. Static block level functions

10.1. Ellipsis in function calls

The directive:

#pragma TenDRA ident ... allow

may be used to enable or disable the use of ... as a primary expression in a function defined with ellipsis. The type of such an expression is implementation defined. This expression is used in the definition of the va_start macro in the <stdarg.h> header. This header automatically enables this switch.

An ellipsis is not an identifier and should not be used in a function call, even if, as in the program below, the function prototype contains an ellipsis:

int f (int a, ...)
{
    return 1;
}

int main()
{
    int x, y;
    x = f(y, ...);
    return 1;
}

In default mode the checker raises an error if an ellipsis is used as a parameter in a function call. The severity of this error can be modified by using:

#pragma TenDRA ident ... permit

If permit is replaced by allow the ellipsis is ignored, if warning is used tdfc2 produces a warning and if disallow is used the default behaviour is restored.

10.2. Static block level functions

The ISO C standard (Section 6.5.1) states that the declaration of an identifier for a function that has block scope shall have no explicit storage-class specifier other than extern. By default, tdfc2 raises an error for declarations which do not conform to this rule. The behaviour can be modified using:

#pragma TenDRA block function static permit

where permit is allow (accept block scope function declarations with other storage-class specifiers), disallow or warning.