Global variables - Used non-shared variable

21 ビュー (過去 30 日間)
Narayan Narvekar
Narayan Narvekar 2021 年 3 月 15 日
コメント済み: Narayan Narvekar 2021 年 3 月 26 日
Hello,
I would like to get more information on a polyspace warning that occurs in every source file (.c file) which has static global variables defined in it. The warning occurs for each defined global variable. The warning is as follows:
"Operations on variable <global_variable_name> do not interfere with each other."
The source file contains different functions that would be called from a different translation unit, and these functions can both read from and write to the global variables. I do not see any issue in defining them as static global variables inside the source file.
What is the reason for this warning and is something expected from my side as a software developer to fix this warning?
Note: This code is not intended for multitasking

採用された回答

Anirban
Anirban 2021 年 3 月 16 日
編集済み: Anirban 2021 年 3 月 16 日
Hi,
Used non-shared variables are somewhat like green checks in Code Prover. They are not warnings. Since Code Prover reports all global variables, it does the following classification:
  • Shared variables : potentially unprotected (warning shown in orange), protected (benign and shown in green)
  • Unshared variables : unused (shown in grey), used (benign and not shown in any color since the proof aspect of Code Prover was not invoked)
For more information, see Global Variables in Code Prover.
As you can see, shared protected globals and unshared used globals are benign, and you do not need to fix anything. Just like green checks on divisions tell that Code Prover did evaluate the status of all divisions for division by zero, these are a way to tell the user that Code Prover did evaluate the status of all global variables.
  1 件のコメント
Narayan Narvekar
Narayan Narvekar 2021 年 3 月 26 日
Hello Anirban,
Thank you for your answer. The explanation you provided is sufficient for me.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGenerate Report についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by