Merge pull request #18194 from github/calumgrant/bmn/wrong-number-format-arguments2

C++: Fix a FP in cpp/wrong-number-format-arguments caused by an extraction error
This commit is contained in:
Calum Grant
2024-12-06 10:14:06 +00:00
committed by GitHub
4 changed files with 19 additions and 2 deletions

View File

@@ -44,7 +44,8 @@ where
) and
// A typical problem is that string literals are concatenated, but if one of the string
// literals is an undefined macro, then this just leads to a syntax error.
not exists(SyntaxError e | e.affects(fl))
not exists(SyntaxError e | e.affects(fl)) and
not ffc.getArgument(_) instanceof ErrorExpr
select ffc,
"Format for " + ffcName + " expects " + expected.toString() + " arguments but given " +
given.toString()

View File

@@ -0,0 +1,4 @@
---
category: minorAnalysis
---
* The "Too few arguments to formatting function" query (`cpp/wrong-number-format-arguments`) query no longer produces results if an argument has an extraction error.