メインコンテンツ

-termination-functions

プロセス終了関数を指定します。

構文

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

説明

-termination-functions function1[,function2[,...]] は、関数 exit と同様に動作しプログラムを終了する関数を指定します。

このオプションは、宣言されているがコード内に定義されていないプログラム終了関数を指定するために使用します。

ユーザー インターフェイス (Polyspace® デスクトップ製品のみ) では、[構成] ペインの [その他] フィールドにこのオプションを入力します。Otherを参照してください。

Polyspace は my_exit がプログラムを終了するのを認識しないため、次のコードで [整数のゼロ除算] 欠陥を検出します。

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);
}
Polyspace が除算演算にフラグ設定するのを防ぐため、次のように -termination-functions オプションを使用します。
polyspace-bug-finder -termination-functions my_exit