`A27-0-4`: C-Style (and arrays) detected when logging in assert or using the hash/stringize operator in a macro
まだ誰も着手していません。
評価
調査の方向性
まずルール A27-0-4 と A18-1-1 の実装から始め、次に提供された C++ の例を再現してください。マクロ、assert 呼び出し、文字列化された式に対する診断を、配列または文字列を直接使用するケースと比較してください。報告された誤検知が解消され、影響を受けるルールが意図されたケースを引き続き検出できれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Affected rules
A27-0-4A18-1-1
Description
Alerts of both rules are triggered even if no C-style array or string is directly used. It may also be relevant that the usage of the # operator is covered by rule M16-3-2.
Example
#include <cassert>
#define ASSERT(expr) ((expr) ? static_cast<void>(0) : [] { assert(false && #expr); }())
class a_class
{
public:
void some_operator()
{
ASSERT(flag_);
}
private:
bool flag_ = false;
};
int main()
{
assert((false) && "A way to add an assert message");
a_class instance;
instance.some_operator();
}
A27-0-4 and A18-1-1 alerts are signaled on ASSERT(flag_); as well as assert((false) && "A way ... message");
- 主要言語
- CodeQL
- スター
- 227
- フォーク
- 82
- 平均マージ
- 6日 7時間
- マージ済み PR(30日)
- 9
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
github/codeql-coding-standards のほかの issue
-
false positive/false negative Stardard-MISRA-C++
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
github/codeql-coding-standards#1172 ·
-
Difficulty-Low false positive/false negative false-negative Impact-Low Standard-MISRA-C
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
Difficulty-Medium false positive/false negative false-positive Impact-Medium Standard-CERT-C
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
github/codeql-coding-standards#1200 ·
-
`RULE-0-0-1`: "unreachable statement" false positives due to over-pruning of the control-flow graph オープンfalse positive/false negative
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
github/codeql-coding-standards#1190 ·
-
false positive/false negative
難易度 3/5 1〜2日 初心者へのやさしさ 65/100
github/codeql-coding-standards#1175 ·
github/codeql-coding-standards の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
-
難易度 1/5 1〜3時間 初心者へのやさしさ 86/100
DavidAnson/markdownlint-cli2#940 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
EclipseFdn/open-vsx.org#13385 · コメント 1 件 ·
-
bug ci good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100