Main Content

-termination-functions

Specify process termination functions

Syntax

-termination-functions function1[,function2[,...]]

Description

-termination-functions function1[,function2[,...]] specifies functions that behave like the exit function and terminate your program.

Use this option to specify program termination functions that are declared but not defined in your code.

If you are running an analysis from the user interface (Polyspace® desktop products only), on the Configuration pane, you can enter this option in the Other field. See Other.

Examples

Polyspace detects an Integer division by zero defect in the following code because it does not recognize that my_exit terminates the program.

void my_exit(void);

void main() {
    double ans;
    ans = reciprocal(1);
    ans = reciprocal(0);
}

double reciprocal(int val) {
  if(val==0)
    my_exit();
  return (1/val);
}
To prevent Polyspace from flagging the division operation, use the -termination-functions option:
polyspace-bug-finder -termination-functions my_exit