mirror of
https://github.com/github/codeql.git
synced 2026-04-28 18:25:24 +02:00
CPP: Allow declarations of library printf functions in source (repairs most of the tests).
This commit is contained in:
@@ -13,7 +13,7 @@ class Printf extends FormattingFunction {
|
||||
hasGlobalName("wprintf_s") or
|
||||
hasGlobalName("g_printf")
|
||||
) and
|
||||
not exists(getADeclarationEntry().getFile().getRelativePath())
|
||||
not exists(getDefinition().getFile().getRelativePath())
|
||||
}
|
||||
|
||||
override int getFormatParameterIndex() { result=0 }
|
||||
@@ -34,7 +34,7 @@ class Fprintf extends FormattingFunction {
|
||||
hasGlobalName("fwprintf") or
|
||||
hasGlobalName("g_fprintf")
|
||||
) and
|
||||
not exists(getADeclarationEntry().getFile().getRelativePath())
|
||||
not exists(getDefinition().getFile().getRelativePath())
|
||||
}
|
||||
|
||||
override int getFormatParameterIndex() { result=1 }
|
||||
@@ -57,7 +57,7 @@ class Sprintf extends FormattingFunction {
|
||||
hasGlobalName("g_sprintf") or
|
||||
hasGlobalName("__builtin___sprintf_chk")
|
||||
) and
|
||||
not exists(getADeclarationEntry().getFile().getRelativePath())
|
||||
not exists(getDefinition().getFile().getRelativePath())
|
||||
}
|
||||
|
||||
override predicate isWideCharDefault() {
|
||||
@@ -111,7 +111,7 @@ class Snprintf extends FormattingFunction {
|
||||
or hasGlobalName("wnsprintf")
|
||||
or hasGlobalName("__builtin___snprintf_chk")
|
||||
) and
|
||||
not exists(getADeclarationEntry().getFile().getRelativePath())
|
||||
not exists(getDefinition().getFile().getRelativePath())
|
||||
}
|
||||
|
||||
override int getFormatParameterIndex() {
|
||||
@@ -150,7 +150,7 @@ class Snprintf extends FormattingFunction {
|
||||
hasGlobalName("__builtin___snprintf_chk") or
|
||||
hasGlobalName("snprintf_s")
|
||||
) and
|
||||
not exists(getADeclarationEntry().getFile().getRelativePath())
|
||||
not exists(getDefinition().getFile().getRelativePath())
|
||||
}
|
||||
|
||||
override int getSizeParameterIndex() {
|
||||
@@ -173,7 +173,7 @@ class StringCchPrintf extends FormattingFunction {
|
||||
or hasGlobalName("StringCbPrintf_l")
|
||||
or hasGlobalName("StringCbPrintf_lEx")
|
||||
) and
|
||||
not exists(getADeclarationEntry().getFile().getRelativePath())
|
||||
not exists(getDefinition().getFile().getRelativePath())
|
||||
}
|
||||
|
||||
override int getFormatParameterIndex() {
|
||||
|
||||
Reference in New Issue
Block a user